Skip to main content

API Clients

Client management via the API.

Endpoints

List Clients

Retrieves the list of all clients.

GET /api/clients

Query Parameters:

ParameterTypeDescription
pagenumberPage number (default: 1)
limitnumberNumber of results (default: 20)
typestringFilter 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

CodeMessageDescription
400Bad RequestInvalid data
401UnauthorizedMissing or invalid token
404Not FoundClient not found
409ConflictEmail already in use