API Clients
Client management via the API.
Endpoints
List Clients
Retrieves the list of all clients.
GET /api/clients
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
| page | number | Page number (default: 1) |
| limit | number | Number of results (default: 20) |
| type | string | Filter by type: individual or company |
Request Example:
curl -X GET "https://api.appswite.dev/api/clients?page=1&limit=20" \
-H "Authorization: Bearer YOUR_TOKEN"
Response (200 OK):
{
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Jean Dupont",
"type": "individual",
"email": "jean@example.com",
"phone": "+33612345678",
"created_at": "2024-01-15T10:30:00Z"
}
],
"meta": {
"page": 1,
"limit": 20,
"total": 150
}
}
Create a Client
POST /api/clients
Body:
{
"name": "Marie Curie",
"type": "company",
"email": "marie@example.com",
"phone": "+33698765432",
"address": "12 Rue de Paris, 75001 Paris",
"country": "France"
}
Response (201 Created):
{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440001",
"name": "Marie Curie",
"type": "company",
"email": "marie@example.com"
}
}
Error Codes
| Code | Message | Description |
|---|---|---|
| 400 | Bad Request | Invalid data |
| 401 | Unauthorized | Missing or invalid token |
| 404 | Not Found | Client not found |
| 409 | Conflict | Email already in use |