Overview

OpenAPI uses API keys for authentication. Get your API token from our API interfaces . We provide open APIs for Gen AI Platform by clicking on the top API button on this page openAPI.

  • First you need to login to our website.
  • Then click the picture icon in the upper right corner of the website, and click the “APl Credentials” function to set the key pair (clientId, clientSecret) used when accessing the API and save it.
  • Use the secret key pair just saved to send the api interface to obtain the access token.
All API requests should include your API token in the HTTP header. Bearer tokens are generally composed of a random string of characters. Formally, it takes the form of the “Bearer” keyword and the token value separated by spaces. The following is the general form of a Bearer token:
Authorization: Bearer {token}
Here is an example of an actual Bearer token:
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYyYTA2Mjg1N2YzNWNjNTJlM2UxNzYyMCIsInR5cGUiOiJ1c2VyIiwiZnJvbSI6InRvYiIsImVtYWlsIjoiZ3VvZG9uZ2RvbmdAYWtvb2wuY29tIiwiZmlyc3ROYW1lIjoiZGQiLCJ1aWQiOjkwMzI4LCJjb2RlIjoiNTY1NCIsImlhdCI6MTczMjg2NzczMiwiZXhwIjoxNzMyODY3NzMzfQ._pilTnv8sPsrKCzrAyh9Lsvyge8NPxUG5Y_8CTdxad0

Remember, your API token is secret! Do not share it with others or expose it in any client-side code (browser, application). Production requests must be routed through your own backend server, and your API token can be securely loaded from environment variables or a key management service.

API

Get the token

POST https://openapi.akool.com/api/open/v3/getToken

Body Attributes

ParameterDescription
clientIdUsed for request creation authorization
clientSecretUsed for request creation authorization

Response Attributes

ParameterValueDescription
code1000Interface returns business status code(1000:success)
tokenAPI token
Please note that the generated token is valid for more than 1 year.

Example

Body

{
  "clientId": "64db241f6d9e5c4bd136c187",
  "clientSecret": "openapi.akool.com"
}

Request

Response

{
"code": 1000,
"token": "xxxxxxxxxxxxxxxx"
}

All API requests should include your API token in the HTTP header. Bearer tokens are generally composed of a random string of characters. Formally, it takes the form of the “Bearer” keyword and the token value separated by spaces. The following is the general form of a Bearer token:

Authorization: Bearer {token}

Here is an example of an actual Bearer token:

Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYyYTA2Mjg1N2YzNWNjNTJlM2UxNzYyMCIsInR5cGUiOiJ1c2VyIiwiZnJvbSI6InRvYiIsImVtYWlsIjoiZ3VvZG9uZ2RvbmdAYWtvb2wuY29tIiwiZmlyc3ROYW1lIjoiZGQiLCJ1aWQiOjkwMzI4LCJjb2RlIjoiNTY1NCIsImlhdCI6MTczMjg2NzczMiwiZXhwIjoxNzMyODY3NzMzfQ._pilTnv8sPsrKCzrAyh9Lsvyge8NPxUG5Y_8CTdxad0

Remember, your API token is secret! Do not share it with others or expose it in any client-side code (browser, application). Production requests must be routed through your own backend server, and your API token can be securely loaded from environment variables or a key management service.

Response Code Description

Please note that if the value of the response code is not equal to 1000, the request is failed or wrong
ParameterValueDescription
code1000Success
code1101Invalid authorization or The request token has expired
code1102Authorization cannot be empty
code1200The account has been banned