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.
POST
#
Generate a Bearer Token https://api.botlhale.xyz/generateAuthToken
This endpoint generates a bearer auth token for secure access to our APIs.
Request Params | Data Type | Description | |
---|---|---|---|
REFRESH_TOKEN | string | Required | Refresh token used to generate a new authentication token. |
#
Request Example- Python
- JavaScript
- NodeJs - Request
- cURL
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)
var formdata = new FormData();formdata.append("REFRESH_TOKEN", REFRESH_TOKEN);
var requestOptions = {method: 'POST',body: formdata,redirect: 'follow'};
fetch("https://api.botlhale.xyz/generateAuthToken", requestOptions).then(response => response.text()).then(result => console.log(result)).catch(error => console.log('error', error));
var request = require('request');var options = { 'method': 'POST', 'url': 'https://api.botlhale.xyz/generateAuthToken', 'headers': {
}, formData: { 'REFRESH_TOKEN': '<IdToken>' }};request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body);});
curl --location --request POST 'https://api.botlhale.io/generateAuthToken' \--form 'REFRESH_TOKEN=<REFRESH_TOKEN>'
#
Response body{ "AuthenticationResult": { "AccessToken": "YOUR_ACCESS_TOKEN", "ExpiresIn": 3600, "IdToken": "YOUR_ID_TOKEN", "RefreshToken": "YOUR_REFRESH_TOKEN", "TokenType": "Bearer" } }
#
API AuthenticationInclude 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.