Web API
All POST Web API calls require an admin token unless noted otherwise (cron GET endpoints are the exception).
Sending the token
| Location | Example |
|---|---|
| Request body | "token": "your-admin-token" |
| HTTP header | token: your-admin-token |
The header is checked if token is missing from the body.
Obtaining a token
- Sign in to your Aysali Bot admin panel (Admin URL from the tenant portal).
- Open Users.
- Open the profile box of a user with type admin.
- Copy the token field.
If the token is missing or invalid, the API does not execute the requested function.
Success response
{
"success": true,
"response": {}
}
success—truewhen the call completed without a validation error.response— return value: object, array, string, boolean, or number depending on the function.
Some functions return success: false with a string response code for validation errors (same HTTP 200).
Error response
Errors use HTTP status codes and a JSON body:
{
"status": "error",
"response": "error-code",
"message": "Human-readable detail"
}
| HTTP | response code | Meaning |
|---|---|---|
| 400 | missing-function-name | No function in the request |
| 400 | missing-argument | Required parameter missing |
| 400 | app-not-installed | Function needs an app that is not active |
| 401 | token-not-found | No admin token provided |
| 401 | invalid-token | Token is not an admin token |
| 404 | function-not-found | Unknown function name |
App-gated functions
Some functions require an installed channel or integration (for example SB_WHATSAPP, SB_MESSENGER, SB_WHATSAPP_AYSALI, SB_DIALOGFLOW). If the app is not active, you receive app-not-installed.
Check the Requires app note on each endpoint in the API reference.