APIv2 is a publicly available API for developers who need to integrate the functionality of the Kommo AI into their services. Currently, publicly available methods allow you to perform the following actions:
AI Suggested Reply
- Adding sources
AI Agent
- Adding sources with special properties - policies
- Synchronization of products from CRM to AI
Authorization
Authorization token
For authorization of requests in public API endpoints, you can use both OAuth 2.0 and Long-Lived tokens.
This token must be sent in the Authorization header:
authorization: Bearer <YOUR TOKEN>
Possible negative authorization responses
{
"code": 401,
"status": "error",
"detail": "Something went wrong. Please contact our support team.",
"error_reason": "No token provided"
}
This error occurs if the authorization token was not passed in the expected header.
{
"code": 403,
"status": "error",
"detail": "Something went wrong. Please try again.",
"error_reason": "Bearer token verification failed"
}
In cases when it's impossible to verify the authenticity of the token, several errors may occur.
This error occurs if the authorization server hasn't confirmed that the token belongs to the account.
{
"code": 403,
"status": "error",
"detail": "Something went wrong. Please try again.",
"error_reason": "Error while getting account data via provided token"
}
This error occurs if it wasn't possible to obtain account data to continue the service. Most often, it occurs if a request to the service for this account comes for the first time via an Oauth2 token, since it doesn't contain additional load. However, this can only happen if the service was unable to reach the root service.
Pre-processing of requests
Before the API processes the request, it checks:
- What language the response should be in (X-Language header)
- Whether the service is currently available
- Whether access is allowed for your account
Language
This property is needed to display localized texts. By default, it is set to English. It can be changed by passing a special query header:
X-Language: {en|es|pt|ru}
Valid values: en/es/pt/ru
If an unsupported language is passed, English will be used by default.
Service availability
We check if the service is enabled for Kommo. If it isn't available, the following error will be returned:
{
"code": 403,
"status": "error",
"detail": "AI temporarily unavailable",
"error_reason": "Service unavailable"
}
If such an error occurs, it means a major issue has occurred on the server. Our specialists are already working on this problem, and service will be restored shortly. You can only wait for the error to be fixed.
Service availability for the account
For the Kommo platform, a check is performed to see if the account can access this service. There are two possible blocking conditions:
- Access was manually restricted for this account. This will result in the following error:
{
"code": 402,
"status": "error",
"detail": "AI temporarily unavailable",
"error_reason": "Disabled for account"
}
- This account has exceeded its monthly API usage limit. This will result in the following error:
{
"code": 402,
"status": "error",
"detail": "You've reached your monthly request limit. To continue using prompts, please contact our support team.",
"error_reason": "Limit reached"
}