> ## 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 une adresse

> Créer une nouvelle adresse liée à un client

## Autorisation

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

## Corps de la requête

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

<ParamField body="type" type="string" required>
  Type d'adresse. Valeurs autorisées : `"billing"`, `"shipping"`
</ParamField>

<ParamField body="address_line1" type="string" required>
  Adresse postale
</ParamField>

<ParamField body="city" type="string" required>
  Ville
</ParamField>

<ParamField body="postal_code" type="string" required>
  Code postal
</ParamField>

<ParamField body="country" type="string" required>
  Code pays (ISO 3166-1 alpha-2, ex. : `"FR"`, `"US"`, `"DE"`)
</ParamField>

<ParamField body="name" type="string">
  Libellé de cette adresse (ex. : `"Siège social"`, `"Entrepôt"`)
</ParamField>

<ParamField body="address_line2" type="string">
  Complément d'adresse (appartement, étage, etc.)
</ParamField>

<ParamField body="state" type="string">
  État ou région
</ParamField>

<ParamField body="contact_id" type="string">
  UUID du contact associé à cette adresse
</ParamField>

<ParamField body="comment" type="string">
  Commentaire interne
</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/addresses \
    -H "Authorization: Bearer qwoty_your_token" \
    -H "Content-Type: application/json" \
    -d '{
      "customer_id": "550e8400-e29b-41d4-a716-446655440000",
      "type": "billing",
      "name": "Siège social",
      "address_line1": "12 Rue de la Paix",
      "city": "Paris",
      "postal_code": "75001",
      "country": "FR"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://qwoty.app/api/addresses', {
    method: 'POST',
    headers: {
      Authorization: 'Bearer qwoty_your_token',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      customer_id: '550e8400-e29b-41d4-a716-446655440000',
      type: 'billing',
      name: 'Siège social',
      address_line1: '12 Rue de la Paix',
      city: 'Paris',
      postal_code: '75001',
      country: 'FR',
    }),
  })
  const data = await response.json()
  ```

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

  response = requests.post(
      'https://qwoty.app/api/addresses',
      headers={
          'Authorization': 'Bearer qwoty_your_token',
          'Content-Type': 'application/json',
      },
      json={
          'customer_id': '550e8400-e29b-41d4-a716-446655440000',
          'type': 'billing',
          'name': 'Siège social',
          'address_line1': '12 Rue de la Paix',
          'city': 'Paris',
          'postal_code': '75001',
          'country': 'FR',
      },
  )
  data = response.json()
  ```
</CodeGroup>

## Réponse

<ResponseField name="success" type="boolean">
  `true` si l'adresse a été créée
</ResponseField>

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

<ResponseExample>
  ```json Réponse en cas de succès theme={null}
  {
    "success": true,
    "data": {
      "id": "770e8400-e29b-41d4-a716-446655440002",
      "workspace_id": "706eb564-6c4a-4e18-841c-bdd79be6bca7",
      "customer_id": "550e8400-e29b-41d4-a716-446655440000",
      "type": "billing",
      "name": "Siège social",
      "address_line1": "12 Rue de la Paix",
      "address_line2": null,
      "city": "Paris",
      "state": null,
      "postal_code": "75001",
      "country": "FR",
      "contact_id": null,
      "comment": null,
      "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": "customer_id", "message": "customer_id doit être un UUID valide" },
      { "path": "type", "message": "Le type doit être \"billing\" ou \"shipping\"" }
    ]
  }
  ```
</ResponseExample>
