Aller au contenu

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.

PATCH /customers/:externalId

Comportement upsert : crée le client s’il n’existe pas, met à jour sinon.

ChampTypeRequis à la créationDescription
emailstringEmail du client — unique par app
namestringNom affiché
phonestringTéléphone
avatarUrlstring (URL)URL de l’avatar
metadataobjectDonné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.

curl
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" }
}'
Node.js
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' },
}),
});
Python (requests)
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'},
},
)
PHP (curl)
$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.

Seuls les champs envoyés sont modifiés :

curl
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 HTTPCode métierCause
400VALIDATION_ERRORemail ou name manquant à la création
409CUSTOMER_EMAIL_EXISTSUn autre client a déjà cet email dans votre app

Voir Erreurs pour le format complet.