Skip to main content

Authentication

The Botlhale AI APIs use API keys to authenticate requests. Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-facing code, and so on.

Authentication to all API endpoints is performed via Bearer Authentication. Bearer Authentication (also called token authentication) is an HTTP authentication scheme that makes use of security tokens called "bearer tokens". Bearer Authentication can be understood as "giving access to the bearer of this token". The bearer token is a cryptic string, usually generated by the server in response to a login request. The client must send this token in the Authorization header when making requests to protected resources.

To perform Bearer Authentication, you need to use the REFRESH_TOKEN made available to you upon sign-up. This refreshToken does not expire and is used to generate the API key you will use to interact with the API endpoints.

Authorization: Bearer <IdToken>
tip

You can get your API keys by going navigating to Profile > API on the platform.

warning

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Generate a Bearer Token POST#

https://api.botlhale.xyz/generateAuthToken

This endpoint generates a bearer auth token for secure access to our APIs.

Request ParamsData TypeDescription
REFRESH_TOKENstringRequiredRefresh token used to generate a new authentication token.

Request Example#

import requestsurl = "https://api.botlhale.xyz/generateAuthToken"
payload={'REFRESH_TOKEN': <REFRESH_TOKEN>,}files=[]
headers = {}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)

Response body#

{    "AuthenticationResult": {        "AccessToken": "YOUR_ACCESS_TOKEN",        "ExpiresIn": 3600,        "IdToken": "YOUR_ID_TOKEN",        "RefreshToken": "YOUR_REFRESH_TOKEN",        "TokenType": "Bearer"    } }

API Authentication#

Include IdToken as the Bearer Token in headers for Authorization on other API endpoints. All API endpoints require a Bearer Token in the header. For example:

headers = {"Authorization": "Bearer <IdToken>"}
info

We are here to help! Please email support@botlhale.ai with any questions.