# Créer des clients et des mandats

Ce guide vous accompagne dans l'enregistrement d'un client et la création de mandats couvrant les quatre types d'entrées d'annuaire supportés.

## Prérequis

- Un token API valide (en-tête `Authorization: <token>`)
- URL de base : `https://pdp.seqino.dev/api`


## Étape 1 : Créer un client

Un **client** représente une entreprise pour laquelle vous gérez la facturation. Chaque client reçoit un `client_id` unique à transmettre via l'en-tête `X-PDP-Client-Id` dans les appels suivants.


```bash cURL
curl -X POST https://pdp.seqino.dev/api/clients \
  -H "Authorization: <votre-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_name": "Dupont & Fils SAS",
    "contact_email": "facturation@dupont-fils.fr",
    "external_ref": "CLIENT-001"
  }'
```


```python Python
import httpx

client = httpx.Client(base_url="https://pdp.seqino.dev/api", headers={"Authorization": "<votre-token>"})

response = client.post("/clients", json={
    "organization_name": "Dupont & Fils SAS",
    "contact_email": "facturation@dupont-fils.fr",
    "external_ref": "CLIENT-001",
})
response.raise_for_status()
client_id = response.json()["id"]
print(f"Client ID : {client_id}")
```


```typescript TypeScript
const response = await fetch("https://pdp.seqino.dev/api/clients", {
  method: "POST",
  headers: {
    "Authorization": "<votre-token>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    organization_name: "Dupont & Fils SAS",
    contact_email: "facturation@dupont-fils.fr",
    external_ref: "CLIENT-001",
  }),
});
const { id: clientId } = await response.json();
console.log("Client ID :", clientId);
```

La réponse retourne l'objet client créé avec son `id`. Conservez cette valeur — elle sera utilisée comme `X-PDP-Client-Id` pour toutes les opérations de mandat ci-dessous.

## Étape 2 : Créer des mandats

Un **mandat** autorise votre client à envoyer ou recevoir des factures pour le compte d'une entrée d'annuaire spécifique. La portée du mandat est déterminée par les champs identifiants renseignés.

Toutes les requêtes de mandat nécessitent l'en-tête `X-PDP-Client-Id` avec le client ID obtenu à l'étape 1.

### Mandat SIREN

Couvre tous les établissements d'une entreprise. À utiliser lorsque le destinataire n'a pas spécifié de routage plus granulaire.


```bash cURL
curl -X POST https://pdp.seqino.dev/api/mandates \
  -H "Authorization: <votre-token>" \
  -H "X-PDP-Client-Id: <client-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "start_date": "2026-01-01T00:00:00Z",
    "directory_entry": {
      "siren": "123456789",
      "name": "Dupont & Fils SAS"
    }
  }'
```


```python Python
response = client.post("/mandates",
    headers={"X-PDP-Client-Id": client_id},
    json={
        "start_date": "2026-01-01T00:00:00Z",
        "directory_entry": {
            "siren": "123456789",
            "name": "Dupont & Fils SAS",
        },
    },
)
response.raise_for_status()
```


```typescript TypeScript
await fetch("https://pdp.seqino.dev/api/mandates", {
  method: "POST",
  headers: {
    "Authorization": "<votre-token>",
    "X-PDP-Client-Id": clientId,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    start_date: "2026-01-01T00:00:00Z",
    directory_entry: {
      siren: "123456789",
      name: "Dupont & Fils SAS",
    },
  }),
});
```

### Mandat SIREN + suffixe

Cible un service ou département spécifique au sein d'une entreprise, identifié par un suffixe libre. À utiliser lorsque le destinataire route ses factures par département (ex. `Achats`, `DAF`).


```bash cURL
curl -X POST https://pdp.seqino.dev/api/mandates \
  -H "Authorization: <votre-token>" \
  -H "X-PDP-Client-Id: <client-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "start_date": "2026-01-01T00:00:00Z",
    "directory_entry": {
      "siren": "123456789",
      "name": "Dupont & Fils SAS",
      "suffix": "Achats"
    }
  }'
```


```python Python
response = client.post("/mandates",
    headers={"X-PDP-Client-Id": client_id},
    json={
        "start_date": "2026-01-01T00:00:00Z",
        "directory_entry": {
            "siren": "123456789",
            "name": "Dupont & Fils SAS",
            "suffix": "Achats",
        },
    },
)
response.raise_for_status()
```


```typescript TypeScript
await fetch("https://pdp.seqino.dev/api/mandates", {
  method: "POST",
  headers: {
    "Authorization": "<votre-token>",
    "X-PDP-Client-Id": clientId,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    start_date: "2026-01-01T00:00:00Z",
    directory_entry: {
      siren: "123456789",
      name: "Dupont & Fils SAS",
      suffix: "Achats",
    },
  }),
});
```

### Mandat SIRET

Cible un établissement spécifique au sein d'une entreprise. À utiliser lorsque le destinataire route ses factures par établissement.


```bash cURL
curl -X POST https://pdp.seqino.dev/api/mandates \
  -H "Authorization: <votre-token>" \
  -H "X-PDP-Client-Id: <client-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "start_date": "2026-01-01T00:00:00Z",
    "directory_entry": {
      "siren": "123456789",
      "name": "Dupont & Fils SAS — Siège social",
      "siret": "12345678900012"
    }
  }'
```


```python Python
response = client.post("/mandates",
    headers={"X-PDP-Client-Id": client_id},
    json={
        "start_date": "2026-01-01T00:00:00Z",
        "directory_entry": {
            "siren": "123456789",
            "name": "Dupont & Fils SAS — Siège social",
            "siret": "12345678900012",
        },
    },
)
response.raise_for_status()
```


```typescript TypeScript
await fetch("https://pdp.seqino.dev/api/mandates", {
  method: "POST",
  headers: {
    "Authorization": "<votre-token>",
    "X-PDP-Client-Id": clientId,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    start_date: "2026-01-01T00:00:00Z",
    directory_entry: {
      siren: "123456789",
      name: "Dupont & Fils SAS — Siège social",
      siret: "12345678900012",
    },
  }),
});
```

### Mandat SIRET + code de routage

Cible un établissement spécifique avec un identifiant de routage supplémentaire (ex. GLN, ODETTE). À utiliser lorsque la PDP du destinataire requiert un routage structuré au-delà du SIRET.


```bash cURL
curl -X POST https://pdp.seqino.dev/api/mandates \
  -H "Authorization: <votre-token>" \
  -H "X-PDP-Client-Id: <client-id>" \
  -H "Content-Type: application/json" \
  -d '{
    "start_date": "2026-01-01T00:00:00Z",
    "directory_entry": {
      "siren": "123456789",
      "name": "Dupont & Fils SAS — Siège social",
      "siret": "12345678900012",
      "routing_identifier": "3012345678906",
      "routing_identifier_type": "0088"
    }
  }'
```


```python Python
response = client.post("/mandates",
    headers={"X-PDP-Client-Id": client_id},
    json={
        "start_date": "2026-01-01T00:00:00Z",
        "directory_entry": {
            "siren": "123456789",
            "name": "Dupont & Fils SAS — Siège social",
            "siret": "12345678900012",
            "routing_identifier": "3012345678906",
            "routing_identifier_type": "0088",
        },
    },
)
response.raise_for_status()
```


```typescript TypeScript
await fetch("https://pdp.seqino.dev/api/mandates", {
  method: "POST",
  headers: {
    "Authorization": "<votre-token>",
    "X-PDP-Client-Id": clientId,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    start_date: "2026-01-01T00:00:00Z",
    directory_entry: {
      siren: "123456789",
      name: "Dupont & Fils SAS — Siège social",
      siret: "12345678900012",
      routing_identifier: "3012345678906",
      routing_identifier_type: "0088",
    },
  }),
});
```

Les valeurs supportées pour `routing_identifier_type` sont :

| Valeur | Standard | Description |
|  --- | --- | --- |
| `0088` | GS1 | GLN (Global Location Number) |
| `0060` | DUNS | Numéro Dun & Bradstreet |
| `0224` | SIREN/SIRET | Identifiant national français |
| `Internal` | — | Code de routage interne défini par la PDP du destinataire |


## Prochaines étapes

Une fois vos mandats actifs, vous pouvez commencer à soumettre des factures. Consultez la [référence API](/openapi) pour les endpoints de facturation complets.