Appearance
API Introduction
The autoch.at CRM REST API provides programmatic access to your CRM data.
Base URL
https://your-instance.supabase.co/functions/v1/crm-api/v1Replace your-instance with your Supabase project URL.
Authentication
All API requests require authentication using an API key.
API Key Header
Include your API key in the request header:
http
Authorization: Bearer YOUR_API_KEYGetting an API Key
- Log in to autoch.at CRM
- Go to Settings → Integrations → API Keys
- Click Create API Key
- Set a name and select scopes
- Copy the key immediately (shown only once)
- Store securely
API Versioning
The API uses URL versioning:
- Current version:
v1 - Version in URL:
/v1/... - Future versions:
/v2/...
Request Format
Content Type
All requests use JSON:
http
Content-Type: application/jsonRequest Body
POST and PUT requests include JSON body:
json
{
"field1": "value1",
"field2": "value2"
}Response Format
Success Response
json
{
"data": {
"id": "uuid",
"field": "value"
}
}Error Response
json
{
"error": {
"message": "Error description",
"code": "ERROR_CODE"
}
}HTTP Status Codes
200 OK: Success201 Created: Resource created400 Bad Request: Invalid request401 Unauthorized: Invalid API key403 Forbidden: Insufficient permissions404 Not Found: Resource not found429 Too Many Requests: Rate limit exceeded500 Internal Server Error: Server error
Rate Limiting
API requests are rate-limited:
- Default: 100 requests per minute per API key
- Rate limit headers included in responses
- Exceeding limit returns 429 status
Rate Limit Headers
http
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200Scopes & Permissions
API keys have scoped permissions:
Available Scopes
clients:read- Read clientsclients:write- Create/update clientsinvoices:read- Read invoicesinvoices:write- Create/update invoicesquotes:read- Read quotesquotes:write- Create/update quotespayments:read- Read paymentspayments:write- Create/update paymentsproducts:read- Read products/servicesproducts:write- Create/update products/servicesprojects:read- Read projectsprojects:write- Create/update projectswebhooks:read- Read webhookswebhooks:write- Create/update webhooksmarketing:write- Marketing operations
Scope Requirements
Each endpoint requires specific scopes:
- Check endpoint documentation for required scopes
- Requests without required scope return 403
Idempotency
POST requests support idempotency:
http
Idempotency-Key: unique-key-here- Prevents duplicate processing
- Use unique keys per request
- Same key returns same result
Tenant Context
All API requests are scoped to your tenant:
- API key is tenant-specific
- Data is automatically filtered
- Cannot access other tenants' data
Endpoints
Clients
GET /v1/clients- List clientsGET /v1/clients/:id- Get clientPOST /v1/clients- Create clientPUT /v1/clients/:id- Update clientDELETE /v1/clients/:id- Delete client
Invoices
GET /v1/invoices- List invoicesGET /v1/invoices/:id- Get invoicePOST /v1/invoices- Create invoicePUT /v1/invoices/:id- Update invoicePATCH /v1/invoices/:id/status- Update status
Products & Services
GET /v1/products- List products/servicesGET /v1/products/:id- Get product/servicePOST /v1/products- Create product/servicePUT /v1/products/:id- Update product/service
Webhooks
GET /v1/webhooks- List webhooksGET /v1/webhooks/:id- Get webhookPOST /v1/webhooks- Create webhookPUT /v1/webhooks/:id- Update webhookDELETE /v1/webhooks/:id- Delete webhookPOST /v1/webhooks/:id/test- Test webhook
Examples
List Clients
bash
curl -X GET \
'https://your-instance.supabase.co/functions/v1/crm-api/v1/clients' \
-H 'Authorization: Bearer YOUR_API_KEY'List Products
bash
curl -X GET \
'https://your-instance.supabase.co/functions/v1/crm-api/v1/products?type=service' \
-H 'Authorization: Bearer YOUR_API_KEY'Create Invoice
bash
curl -X POST \
'https://your-instance.supabase.co/functions/v1/crm-api/v1/invoices' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"client_id": "uuid",
"due_date": "2024-12-31",
"line_items": [
{
"description": "Service",
"quantity": 1,
"rate": 100.00
}
]
}'Next Steps
- Client Endpoints - Client API operations
- Invoice Endpoints - Invoice API operations
- Product Endpoints - Products & Services API operations
- Webhook Endpoints - Webhook API operations
- Error Handling - Handle API errors

