Clients
REST API endpoints for managing clients within your organization.
Endpoints
All endpoints require a valid API key in the Authorization header. See Authentication for details.
Base URL: /api/v1List Clients
GET /api/v1/clientsQuery parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 50 | Number of results (1-100) |
offset | number | 0 | Pagination offset |
query | string | — | Search by name or phone |
sortBy | string | "createdAt" | Sort field: name, phone, status, createdAt |
sortOrder | string | "asc" | Sort direction: asc or desc |
status | string | — | Comma-separated status filter (e.g., active,inactive) |
Status values: active, inactive
Get Client
GET /api/v1/clients/:idCreate Client
POST /api/v1/clients
Content-Type: application/json| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Client name |
phone | string | No | Phone number |
status | string | No | Client status (default: active) |
notes | string | No | Free-text notes |
Update Client
PATCH /api/v1/clients/:id
Content-Type: application/jsonBody: same fields as Create (all optional).
Delete Client
DELETE /api/v1/clients/:idReturns { "success": true } on success.
Examples
cURL
# List clients
curl https://your-app.com/api/v1/clients \
-H "Authorization: Bearer ba_a1b2c3d4e5f6..."
# List with filters
curl "https://your-app.com/api/v1/clients?status=active&sortBy=name&sortOrder=asc&limit=10" \
-H "Authorization: Bearer ba_a1b2c3d4e5f6..."
# Get a single client
curl https://your-app.com/api/v1/clients/UUID_HERE \
-H "Authorization: Bearer ba_a1b2c3d4e5f6..."
# Create a client
curl -X POST https://your-app.com/api/v1/clients \
-H "Authorization: Bearer ba_a1b2c3d4e5f6..." \
-H "Content-Type: application/json" \
-d '{"name":"John Doe","phone":"+1 555-1234"}'
# Update a client
curl -X PATCH https://your-app.com/api/v1/clients/UUID_HERE \
-H "Authorization: Bearer ba_a1b2c3d4e5f6..." \
-H "Content-Type: application/json" \
-d '{"status":"inactive","notes":"No longer active"}'
# Delete a client
curl -X DELETE https://your-app.com/api/v1/clients/UUID_HERE \
-H "Authorization: Bearer ba_a1b2c3d4e5f6..."JavaScript / TypeScript
const API_KEY = "ba_a1b2c3d4e5f6...";
const BASE_URL = "https://your-app.com/api/v1";
// List clients
const response = await fetch(`${BASE_URL}/clients?limit=10&sortOrder=desc`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const { data, total } = await response.json();
// Create a client
const createRes = await fetch(`${BASE_URL}/clients`, {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "John Doe",
phone: "+1 555-1234",
}),
});
const { data: newClient } = await createRes.json();Python
import requests
API_KEY = "ba_a1b2c3d4e5f6..."
BASE_URL = "https://your-app.com/api/v1"
# List clients
response = requests.get(
f"{BASE_URL}/clients",
headers={"Authorization": f"Bearer {API_KEY}"},
params={"limit": 10, "sortOrder": "desc"},
)
data = response.json()
# Create a client
response = requests.post(
f"{BASE_URL}/clients",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"name": "John Doe", "phone": "+1 555-1234"},
)
new_client = response.json()