Clients
Synchronisez votre base clients avec SupportDesk. Le client est identifié par son externalId — c’est votre identifiant (ID user dans votre DB, UUID, etc.), pas un ID SupportDesk.
Endpoint
Section intitulée « Endpoint »PATCH /customers/:externalIdComportement upsert : crée le client s’il n’existe pas, met à jour sinon.
| Champ | Type | Requis à la création | Description |
|---|---|---|---|
email | string | ✅ | Email du client — unique par app |
name | string | ✅ | Nom affiché |
phone | string | — | Téléphone |
avatarUrl | string (URL) | — | URL de l’avatar |
metadata | object | — | Données libres (plan, companyName, etc.) |
En création, email et name sont obligatoires. En update, tous les champs sont optionnels — seuls ceux fournis sont modifiés.
Exemple — création
Section intitulée « Exemple — création »curl -X PATCH https://supportdesk.innovartx.com/api/v1/customers/user_42 \ -H "X-API-Key: $SUPPORTDESK_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "email": "jean@acme.com", "name": "Jean Dupont", "phone": "+229 97 00 00 00", "metadata": { "plan": "premium", "companyName": "Acme" } }'await fetch('https://supportdesk.innovartx.com/api/v1/customers/user_42', { method: 'PATCH', headers: { 'X-API-Key': process.env.SUPPORTDESK_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ email: 'jean@acme.com', name: 'Jean Dupont', phone: '+229 97 00 00 00', metadata: { plan: 'premium', companyName: 'Acme' }, }),});import os, requests
requests.patch( 'https://supportdesk.innovartx.com/api/v1/customers/user_42', headers={'X-API-Key': os.environ['SUPPORTDESK_API_KEY']}, json={ 'email': 'jean@acme.com', 'name': 'Jean Dupont', 'phone': '+229 97 00 00 00', 'metadata': {'plan': 'premium', 'companyName': 'Acme'}, },)$ch = curl_init('https://supportdesk.innovartx.com/api/v1/customers/user_42');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'PATCH', CURLOPT_POSTFIELDS => json_encode([ 'email' => 'jean@acme.com', 'name' => 'Jean Dupont', 'phone' => '+229 97 00 00 00', 'metadata' => ['plan' => 'premium', 'companyName' => 'Acme'], ]), CURLOPT_HTTPHEADER => [ 'X-API-Key: ' . getenv('SUPPORTDESK_API_KEY'), 'Content-Type: application/json', ], CURLOPT_RETURNTRANSFER => true,]);$response = curl_exec($ch);curl_close($ch);{ "success": true, "data": { "customer": { "id": "clxxxxxx", "externalId": "user_42", "email": "jean@acme.com", "name": "Jean Dupont", "phone": "+229 97 00 00 00", "metadata": { "plan": "premium", "companyName": "Acme" }, "createdAt": "2026-04-18T10:00:00Z", "updatedAt": "2026-04-18T10:00:00Z" }, "wasCreated": true }, "timestamp": "2026-04-18T10:00:00Z"}Le champ wasCreated vaut true à la première requête pour un externalId donné, false aux suivantes.
Exemple — update partiel
Section intitulée « Exemple — update partiel »Seuls les champs envoyés sont modifiés :
curl -X PATCH https://supportdesk.innovartx.com/api/v1/customers/user_42 \ -H "X-API-Key: $SUPPORTDESK_API_KEY" \ -H "Content-Type: application/json" \ -d '{"phone": "+229 99 11 22 33"}'| Code HTTP | Code métier | Cause |
|---|---|---|
400 | VALIDATION_ERROR | email ou name manquant à la création |
409 | CUSTOMER_EMAIL_EXISTS | Un autre client a déjà cet email dans votre app |
Voir Erreurs pour le format complet.