> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwoty.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Créer un contact

> Créer un nouveau contact lié à un client

## Autorisation

<ParamField header="Authorization" type="string" required>
  Token Bearer. Format : `Bearer qwoty_your_token`
</ParamField>

## Corps de la requête

<ParamField body="customer_id" type="string" required>
  UUID du client auquel ce contact appartient
</ParamField>

<ParamField body="first_name" type="string" required>
  Prénom du contact
</ParamField>

<ParamField body="last_name" type="string" required>
  Nom de famille du contact
</ParamField>

<ParamField body="email" type="string" required>
  Adresse e-mail du contact
</ParamField>

<ParamField body="phone" type="string">
  Numéro de téléphone
</ParamField>

<ParamField body="role" type="array" default="[]">
  Rôles attribués. Valeurs autorisées : `"buyer"`, `"signer"`, `"billing"`,
  `"shipping"`, `"legal"`, `"admin"`
</ParamField>

<ParamField body="id_crm" type="string">
  Identifiant CRM externe
</ParamField>

<ParamField body="id_erp" type="string">
  Identifiant ERP externe
</ParamField>

<ParamField body="id_accounting" type="string">
  Identifiant comptable externe
</ParamField>

## Exemples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://qwoty.app/api/contacts \
    -H "Authorization: Bearer qwoty_your_token" \
    -H "Content-Type: application/json" \
    -d '{
      "customer_id": "550e8400-e29b-41d4-a716-446655440000",
      "first_name": "Jean",
      "last_name": "Dupont",
      "email": "jean.dupont@acme.com",
      "phone": "+33 6 12 34 56 78",
      "role": ["buyer", "signer"]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://qwoty.app/api/contacts', {
    method: 'POST',
    headers: {
      Authorization: 'Bearer qwoty_your_token',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      customer_id: '550e8400-e29b-41d4-a716-446655440000',
      first_name: 'Jean',
      last_name: 'Dupont',
      email: 'jean.dupont@acme.com',
      phone: '+33 6 12 34 56 78',
      role: ['buyer', 'signer'],
    }),
  })
  const data = await response.json()
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://qwoty.app/api/contacts',
      headers={
          'Authorization': 'Bearer qwoty_your_token',
          'Content-Type': 'application/json',
      },
      json={
          'customer_id': '550e8400-e29b-41d4-a716-446655440000',
          'first_name': 'Jean',
          'last_name': 'Dupont',
          'email': 'jean.dupont@acme.com',
          'phone': '+33 6 12 34 56 78',
          'role': ['buyer', 'signer'],
      },
  )
  data = response.json()
  ```
</CodeGroup>

## Réponse

<ResponseField name="success" type="boolean">
  `true` si le contact a été créé
</ResponseField>

<ResponseField name="data" type="object">
  L'objet contact créé (même structure que [Obtenir un
  contact](/api-reference/contacts/get))
</ResponseField>

<ResponseExample>
  ```json Réponse en cas de succès theme={null}
  {
    "success": true,
    "data": {
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "workspace_id": "706eb564-6c4a-4e18-841c-bdd79be6bca7",
      "customer_id": "550e8400-e29b-41d4-a716-446655440000",
      "first_name": "Jean",
      "last_name": "Dupont",
      "email": "jean.dupont@acme.com",
      "phone": "+33 6 12 34 56 78",
      "role": ["buyer", "signer"],
      "id_crm": null,
      "id_erp": null,
      "id_accounting": null,
      "created_at": "2026-01-15T10:30:00Z",
      "updated_at": "2026-01-15T10:30:00Z"
    }
  }
  ```

  ```json Erreur de validation theme={null}
  {
    "error": "Erreur de validation",
    "details": [
      { "path": "email", "message": "Adresse e-mail invalide" },
      { "path": "customer_id", "message": "customer_id doit être un UUID valide" }
    ]
  }
  ```
</ResponseExample>
