API Reference v1
The Ayla API is a set of REST endpoints that expose the intelligence stack to your application. All endpoints return JSON. Authentication is via bearer token. Base URL: https://api.ayla.ai/v1
Include your API key in every request as a bearer token in the Authorization header.
API keys are scoped per environment. Use ayla_test_sk_ keys for sandbox and ayla_live_sk_ for production. Keys are generated in the developer dashboard.
Score a message for fraud risk before dispatch. Returns a fraud score between 0 (clean) and 1 (highly suspicious), and an action recommendation.
| Parameter | Type | Description |
|---|---|---|
| sender_idrequired | string | The sender ID of the message (e.g. "GTBANKNG") |
| msisdnrequired | string | Recipient phone number in E.164 format |
| message_typerequired | string | One of: otp, transactional, promotional, alert |
| corridoroptional | string | Carrier corridor identifier (e.g. "MTN-NG") |
| volume_1hoptional | number | Messages sent from this sender in the past hour |
Get the optimal channel and route for a given message. Returns the recommended primary channel, route score, and failover chain.
| Parameter | Type | Description |
|---|---|---|
| message_typerequired | string | One of: otp, transactional, promotional, alert |
| msisdnrequired | string | Recipient phone number in E.164 format |
| urgencyoptional | string | One of: high, medium, low. Default: medium |
| allowed_channelsoptional | array | Restrict to specific channels: ["sms","whatsapp","email"] |
Run a Sender ID through the 3-layer verification pipeline: rules engine, Claude AI compliance check, and external registry lookup.
| Parameter | Type | Description |
|---|---|---|
| sender_idrequired | string | The sender ID to verify (max 11 characters) |
| country_coderequired | string | ISO 3166-1 alpha-2 country code (e.g. "NG", "GH") |
| organisation_typeoptional | string | Hint for compliance engine: bank, fintech, telco, other |
Retrieve current health scores for all monitored carrier corridors. Useful for building dashboards or triggering application-level routing logic.
| Parameter | Type | Description |
|---|---|---|
| countryoptional | string | Filter by country code (e.g. "NG") |
| min_scoreoptional | number | Return only corridors above this score threshold |
Default rate limits by plan:
| Plan | Requests/sec | Requests/day |
|---|---|---|
| Developer | 10 | 10,000 |
| Growth | 100 | 500,000 |
| Enterprise | Custom | Unlimited |
Rate limit headers are included in every response: X-RateLimit-Remaining and X-RateLimit-Reset. Exceeded limits return HTTP 429.
All errors follow a consistent structure:
Common status codes: 400 Bad request · 401 Unauthorized · 422 Validation error · 429 Rate limited · 500 Internal error