API Overview
Integrate with the Kantos REST API.
The Kantos API provides programmatic access to your CRM data. Build integrations, automate workflows, sync with external systems, and create custom applications using our RESTful API.
API-First Design
Everything you can do in the Kantos dashboard is also available via the API. This includes managing records, objects, automations, users, and more.
Base URL
All API requests are made to:
https://kantos.ai/apiRequest Format
The API accepts JSON request bodies and returns JSON responses. Always include the appropriate headers:
curl -X POST "https://kantos.ai/api/crm/record" \
-H "X-Api-Key: kantos_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"object_id": "obj_contacts",
"field_values": {
"name": "John Doe",
"email": "john@example.com"
}
}'Response Format
Successful responses return the requested data directly. The response format varies by endpoint:
Single Record Response
{
"id": "rec_abc123",
"object_id": "obj_contacts",
"field_values": {
"name": "John Doe",
"email": "john@example.com",
"phone": "+1 (555) 123-4567",
"company": "rec_company_456"
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z",
"created_by": "user_789"
}List Response (Paginated)
{
"data": [
{ "id": "rec_abc123", ... },
{ "id": "rec_def456", ... }
],
"pagination": {
"total": 156,
"page": 1,
"per_page": 25,
"total_pages": 7
}
}Error Handling
Errors return appropriate HTTP status codes with a JSON body describing the issue:
{
"error": "Record not found",
"code": "NOT_FOUND",
"status": 404,
"details": {
"record_id": "rec_invalid123"
}
}Common Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | BAD_REQUEST | Invalid request body or parameters |
| 401 | UNAUTHORIZED | Missing or invalid API key |
| 403 | FORBIDDEN | API key lacks required permissions |
| 404 | NOT_FOUND | Resource does not exist |
| 409 | CONFLICT | Duplicate record or constraint violation |
| 422 | VALIDATION_ERROR | Field validation failed |
| 429 | RATE_LIMITED | Too many requests |
| 500 | INTERNAL_ERROR | Server error (contact support) |
SDKs & Libraries
Official and community SDKs make integration easier:
JavaScript / TypeScript
npm install @kantos/sdkimport { Kantos } from '@kantos/sdk';
const kantos = new Kantos({
apiKey: process.env.KANTOS_API_KEY
});
// Create a contact
const contact = await kantos.records.create({
objectId: 'obj_contacts',
fieldValues: { name: 'John Doe', email: 'john@example.com' }
});
// Query records
const leads = await kantos.records.query({
objectId: 'obj_contacts',
filters: { status: 'new' },
sort: 'created_at',
order: 'desc'
});Python
pip install kantosfrom kantos import Kantos
client = Kantos(api_key=os.environ['KANTOS_API_KEY'])
# Create a contact
contact = client.records.create(
object_id='obj_contacts',
field_values={ 'name': 'John Doe', 'email': 'john@example.com' }
)
# Query records
leads = client.records.query(
object_id='obj_contacts',
filters={'status': 'new'},
sort='created_at',
order='desc'
)Best Practices
Security
- Store API keys in environment variables, never in code
- Use secret keys only on the server, publishable keys for client-side
- Rotate keys periodically and after any suspected compromise
- Use HTTPS for all API requests
Performance
- Batch operations when possible to reduce API calls
- Use pagination for large datasets
- Cache responses where appropriate
- Implement retry logic with exponential backoff
Next Steps
- Authentication — Set up API keys
- Records API — CRUD operations on CRM data
- Objects API — Manage your schema
- Fields API — Configure object fields
- Webhooks — Real-time event notifications
- Rate Limits — Understand request quotas