Skip to content

Authentication - Partner Companies

Before making API calls to our system, you need to obtain a valid Access Token. Every API call must be accompanied by an Authorization header containing a bearer access token.

Step 1: Obtain Your API Key

Navigate to the Manage API Page and either copy your existing API key or click "Generate Api Key" to create a new one.

Step 2: Register Your Server IP Address

In the Manage APIs page of the portal, you'll see a field for entering IP addresses. Register one or more IP addresses according to your needs. We only allow requests from whitelisted IPs.

Step 3: Get Your Access Token

To obtain your access token, submit a login request with your API key:

sh
curl -H 'Content-Type: application/json' \
  -d '{ "key":"API_KEY" }' \
  -X POST \
  "BASE_URL/auth/login"
typescript
import * as axios from "axios";

const data = {
  key: "API_KEY",
};

axios
  .post("BASE_URL/auth/login", data, {
    headers: {
      "Content-Type": "application/json",
    },
  })
  .then((response) => {
    console.log("Success:", response.data);
  })
  .catch((error) => {
    console.error(
      "Error:",
      error.response ? error.response.data : error.message,
    );
  });

Response Format

The response contains your access token:

json
{
  "accessToken": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImZlYzZjNzA2LWJkMDYtNDE3Mi1hNDA..........",
  "success": true,
  "statusCode": 200,
  "message": "Login Successful"
}

NOTE

  1. The access token is a signed JWT valid for 300 seconds (5 minutes) after issuance
  2. Always obtain the access token from a secure back-channel of your application, never from client-side code

Step 4: Test Your Configuration

Use the test endpoint to verify your setup. Include the access token in the x-api-token header:

sh
curl -X GET https://api.telesend.et/api/v1/client/test \
  -H "x-api-token: ACCESS_TOKEN"

Expected Response:

json
{
  "test": "successful"
}

If successful, you're ready to make API calls. If not, verify you've followed the steps above or contact the OmniVAS team.

Example: Making an Authenticated Request

javascript
import * as axios from "axios";

const data = {
  amount: 1,
  msisdn: "251933555233",
  exchangeRate: "125",
  currency: "USD",
  originatingCountry: "USA",
};

axios
  .post("BASE_URL/topup-transactions/airtime-topup", data, {
    headers: {
      "Content-Type": "application/json",
      "x-api-token": "ACCESS-TOKEN-FROM-LOGIN",
    },
  })
  .then((response) => {
    console.log("Success:", response.data);
  })
  .catch((error) => {
    console.error(
      "Error:",
      error.response ? error.response.data : error.message,
    );
  });

Next Steps: Check out the API Reference for detailed endpoint documentation.