Skip to content

Authentication

Before making API calls to our system, you need to make sure that you obtain a valid Access Token. Every API call should be accompanied with Authorization header having a bearer access_token obtained the following steps.

STEP1: Obtain the API Key (apiKey) of your account from teleport portal.
  • Go to Teletops's Manage Api Page and copy api key if there is one or click on the 'Generate Api Key' button to generate a new one.
Step 2: Get your access token.

In order to get your access token you have to login to teletop.et as a client and get your access token.

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,
    );
  });

The response you would get from would contain an access token that you are going to use to make other api calls in this documentation. The response would look like

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

NOTE

  1. Obtained access_token is a singed JWT token which is valid only for 300 seconds after it's issuance.
  2. You should obtain your access_token with this API call from a secure back-channel of your application

Step 3. Test

Access Token is relevant when in every request in this documentation. It should be provided as a header with the name "x-api-token" providing the value you got from the login endpoint. To test that everything has go well try to run the test endpoint.

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

If the response is

json
{
  "test": "sucessfull"
}

you can proceed. If not, please verify whether you have followed the steps above or contact the team on Teleport please.