API Reference Overview
The Anvil API gives you programmatic access to your leads, collections, conversations, and analytics data. This page provides a high-level overview of the API design and conventions.
Base URL
All API requests should be made to:
https://api.anvilhk.com/v1All requests must be made over HTTPS. HTTP requests will be rejected.
Authentication
The API uses Bearer token authentication. Include your API key in the Authorization header:
Authorization: Bearer your_api_key_hereYou can generate API keys from **Settings > API Keys** in the dashboard. Starter plans have read-only API access, Pro plans have read-write access, and Enterprise plans have full access including admin endpoints.
Request Format
Response Format
All responses return JSON with a consistent envelope:
{
"success": true,
"data": { ... },
"meta": {
"page": 1,
"per_page": 20,
"total": 150
}
}Error responses follow the same pattern:
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "You have exceeded the rate limit. Please retry after 60 seconds."
}
}Error Handling
Standard HTTP status codes are used:
Rate Limits
Rate limits vary by plan:
| Plan | Requests / minute | Requests / day |
|---|---|---|
| Starter | 60 | 10,000 |
| Pro | 300 | 100,000 |
| Enterprise | 1,000 | Unlimited |
Rate limit headers are included in every response: X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset.
SDKs
We provide official SDKs for popular languages:
Community SDKs are also available for Ruby, PHP, and Java.