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/api

Request 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

StatusCodeDescription
400BAD_REQUESTInvalid request body or parameters
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENAPI key lacks required permissions
404NOT_FOUNDResource does not exist
409CONFLICTDuplicate record or constraint violation
422VALIDATION_ERRORField validation failed
429RATE_LIMITEDToo many requests
500INTERNAL_ERRORServer error (contact support)

SDKs & Libraries

Official and community SDKs make integration easier:

JavaScript / TypeScript

npm install @kantos/sdk
import { 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 kantos
from 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

    API Reference | Kantos Docs