# API : companies

7 opérations REST du groupe companies.

Base : `/api/v1`. [Conventions](/documentation/api-conventions/) · [Toutes les ressources](/documentation/api-reference/)

- GET /companies : Lister les sociétés (hors corbeille)
- POST /companies : Créer une société (règles UI : dédup, champs custom, hiérarchie)
- GET /companies/{id} : Détail d'une société
- PATCH /companies/{id} : Modifier une société (patch partiel - champs omis intacts)
- DELETE /companies/{id} : Mettre à la corbeille (soft delete T-261 - jamais de hard delete)
- PUT /companies/{id}/external-refs/{source} : Poser l'identifiant d'une source sur une société (idempotent)
- DELETE /companies/{id}/external-refs/{source} : Retirer l'identifiant d'une source sur une société
## GET /companies

```json
{
  "summary": "Lister les sociétés (hors corbeille)",
  "tags": [
    "Sociétés"
  ],
  "parameters": [
    {
      "name": "cursor",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "description": "Curseur opaque de la page précédente",
        "type": "string"
      }
    },
    {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "description": "Taille de page - défaut 50, max 200 (clampé)",
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      }
    },
    {
      "name": "updatedSince",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "description": "ISO 8601 - objets modifiés depuis (inclusif), le filtre des syncs incrémentales",
        "type": "string"
      }
    },
    {
      "name": "since",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "description": "Jours (1 à 365) - objets dans leur statut courant depuis plus de N jours (status_changed_at), combinable avec status (T-1407)",
        "type": "integer",
        "minimum": 1,
        "maximum": 365
      }
    },
    {
      "name": "ids",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "description": "Répétable - restriction à une liste d'ids (max 200)",
        "type": "string"
      }
    },
    {
      "name": "q",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "description": "Recherche sur le nom (même logique que l'UI)",
        "type": "string"
      }
    },
    {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "string",
        "enum": [
          "prospect",
          "active",
          "inactive"
        ]
      }
    },
    {
      "name": "sector",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "description": "Secteur exact (référentiel /sectors)",
        "type": "string"
      }
    },
    {
      "name": "relation",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "description": "#494 : porte cette nature de relation (clé du référentiel /company-relations)",
        "type": "string"
      }
    },
    {
      "name": "externalId",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "description": "Objets qui portent cet identifiant externe (exact) - avec `externalSource` pour une source précise",
        "type": "string"
      }
    },
    {
      "name": "externalSource",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "description": "Source de l'identifiant externe (`tacto`…)",
        "type": "string"
      }
    }
  ],
  "security": [
    {
      "oauth2": [
        "companies:read"
      ]
    },
    {
      "userSession": []
    }
  ],
  "responses": {
    "200": {
      "description": "Page de sociétés",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "sector": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "prospect",
                        "active",
                        "inactive"
                      ]
                    },
                    "logo": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "logoFromReference": {
                      "type": "boolean"
                    },
                    "ownerId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "parentCompanyId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "siret": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "vatNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "vatStatus": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "valid",
                            "invalid",
                            "unavailable"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "T-1401 : verdict VIES du numéro de TVA, null = jamais vérifié ; lecture seule"
                    },
                    "vatCheckedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "T-1401 : dernière vérification VIES, null = jamais"
                    },
                    "website": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "websiteFromReference": {
                      "type": "boolean"
                    },
                    "linkedin": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "x": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "instagram": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "billingAddress": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paymentTerms": {
                      "description": "Note de règlement, texte libre (#998)",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "salesAlert": {
                      "description": "#971 : alerte commerciale interne, jamais montrée au client",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "creditLimitCents": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "#978 : plafond d'encours TTC en centimes, null = sans plafond ; l'encours n'est jamais exposé"
                    },
                    "paymentCondition": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "days",
                                "days_end_of_month",
                                "end_of_month_then_day"
                              ]
                            },
                            "days": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 365
                            },
                            "dayOfNextMonth": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 31
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "type",
                            "days",
                            "dayOfNextMonth"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "#998 : condition de paiement propre { type, days, dayOfNextMonth }, null = celle de l'organisation"
                    },
                    "externalCodes": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "customFields": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": [
                          "string",
                          "number",
                          "boolean"
                        ]
                      }
                    },
                    "relations": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "#494 (ADR-203 D3) : natures de relation déclarées (partenaire, concurrent…), indépendantes du statut calculé"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "Entrée dans le statut courant (T-1407)"
                    },
                    "engagedUntil": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Fin d'engagement : max ends_on des contrats vivants (T-1410), null sans contrat"
                    },
                    "externalRefs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "source": {
                            "type": "string",
                            "description": "Système source (minuscules) - `tacto`, `erp`…"
                          },
                          "externalId": {
                            "type": "string"
                          },
                          "sourceUpdatedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Dernière modification connue dans la source (curseur du delta), null si inconnue"
                          }
                        },
                        "required": [
                          "source",
                          "externalId",
                          "sourceUpdatedAt"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Identifiants de cet objet dans les systèmes tiers (external_ref, ADR-138 D1, ADR-156 D6)"
                    },
                    "displayStatus": {
                      "type": "string",
                      "enum": [
                        "prospect",
                        "active",
                        "inactive",
                        "supplier"
                      ],
                      "description": "#921 : statut affiché. `supplier` = société sans fait client qui porte un profil fournisseur actif (module Achats) ; `status` reste le statut calculé d'ADR-193"
                    },
                    "supplier": {
                      "description": "#921 : profil fournisseur ; absent module Achats éteint ou sans droit de lecture sur `supplier`",
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "active": {
                              "type": "boolean"
                            },
                            "paymentDays": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "currency": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "leadTimeDays": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "ourReference": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "auxCodes": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "format": "uuid",
                                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                              },
                              "additionalProperties": {
                                "type": "string"
                              },
                              "description": "Compte auxiliaire fournisseur (401) par entité"
                            },
                            "notes": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "active",
                            "paymentDays",
                            "currency",
                            "leadTimeDays",
                            "ourReference",
                            "auxCodes",
                            "notes",
                            "createdAt"
                          ],
                          "additionalProperties": false,
                          "description": "#921 : profil fournisseur de la société (module Achats), null si elle n'en porte pas"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "sector",
                    "status",
                    "logo",
                    "logoFromReference",
                    "parentCompanyId",
                    "siret",
                    "vatNumber",
                    "vatStatus",
                    "vatCheckedAt",
                    "website",
                    "websiteFromReference",
                    "linkedin",
                    "x",
                    "instagram",
                    "billingAddress",
                    "paymentTerms",
                    "salesAlert",
                    "creditLimitCents",
                    "paymentCondition",
                    "externalCodes",
                    "customFields",
                    "relations",
                    "createdAt",
                    "updatedAt",
                    "statusChangedAt",
                    "engagedUntil",
                    "displayStatus"
                  ],
                  "additionalProperties": false
                }
              },
              "nextCursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "data",
              "nextCursor"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "default": {
      "description": "Erreur - enveloppe problem+json (RFC 9457)",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      }
    }
  }
}
```

## POST /companies

```json
{
  "summary": "Créer une société (règles UI : dédup, champs custom, hiérarchie)",
  "description": "Naît en statut prospect. Dédup T-257 : en mode warn, la création aboutit avec `duplicateWarning` ; en mode block, un doublon fort (même SIREN) répond 409.",
  "tags": [
    "Sociétés"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 2,
              "maxLength": 200
            },
            "ownerId": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "sector": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 80
                }
              ]
            },
            "parentCompanyId": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "siret": {
              "type": [
                "null",
                "string"
              ]
            },
            "vatNumber": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 40
                },
                {
                  "type": "null"
                }
              ]
            },
            "website": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 200
                }
              ]
            },
            "linkedin": {
              "type": [
                "null",
                "string"
              ]
            },
            "x": {
              "type": [
                "null",
                "string"
              ]
            },
            "instagram": {
              "type": [
                "null",
                "string"
              ]
            },
            "billingAddress": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 300
                }
              ]
            },
            "customFields": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "maxLength": 80
              },
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 2000
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "externalCodes": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "pattern": "^[A-Za-z0-9._-]+$"
                  }
                ]
              }
            },
            "relations": {
              "description": "#494 : natures de relation (clés de la liste d'organisation, GET /company-relations) ; remplace la liste, [] retire tout",
              "maxItems": 30,
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-]{0,39}$"
              }
            }
          },
          "required": [
            "name"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "security": [
    {
      "oauth2": [
        "companies:write"
      ]
    },
    {
      "userSession": []
    }
  ],
  "responses": {
    "201": {
      "description": "Société créée",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string"
              },
              "sector": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "prospect",
                  "active",
                  "inactive"
                ]
              },
              "logo": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "logoFromReference": {
                "type": "boolean"
              },
              "ownerId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "parentCompanyId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "siret": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vatNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vatStatus": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "valid",
                      "invalid",
                      "unavailable"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "T-1401 : verdict VIES du numéro de TVA, null = jamais vérifié ; lecture seule"
              },
              "vatCheckedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "T-1401 : dernière vérification VIES, null = jamais"
              },
              "website": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "websiteFromReference": {
                "type": "boolean"
              },
              "linkedin": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "x": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "instagram": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "billingAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "paymentTerms": {
                "description": "Note de règlement, texte libre (#998)",
                "type": [
                  "string",
                  "null"
                ]
              },
              "salesAlert": {
                "description": "#971 : alerte commerciale interne, jamais montrée au client",
                "type": [
                  "string",
                  "null"
                ]
              },
              "creditLimitCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "#978 : plafond d'encours TTC en centimes, null = sans plafond ; l'encours n'est jamais exposé"
              },
              "paymentCondition": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "days",
                          "days_end_of_month",
                          "end_of_month_then_day"
                        ]
                      },
                      "days": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 365
                      },
                      "dayOfNextMonth": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 31
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "days",
                      "dayOfNextMonth"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "#998 : condition de paiement propre { type, days, dayOfNextMonth }, null = celle de l'organisation"
              },
              "externalCodes": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "customFields": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": [
                    "string",
                    "number",
                    "boolean"
                  ]
                }
              },
              "relations": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "#494 (ADR-203 D3) : natures de relation déclarées (partenaire, concurrent…), indépendantes du statut calculé"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "statusChangedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "Entrée dans le statut courant (T-1407)"
              },
              "engagedUntil": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Fin d'engagement : max ends_on des contrats vivants (T-1410), null sans contrat"
              },
              "externalRefs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "description": "Système source (minuscules) - `tacto`, `erp`…"
                    },
                    "externalId": {
                      "type": "string"
                    },
                    "sourceUpdatedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Dernière modification connue dans la source (curseur du delta), null si inconnue"
                    }
                  },
                  "required": [
                    "source",
                    "externalId",
                    "sourceUpdatedAt"
                  ],
                  "additionalProperties": false
                },
                "description": "Identifiants de cet objet dans les systèmes tiers (external_ref, ADR-138 D1, ADR-156 D6)"
              },
              "displayStatus": {
                "type": "string",
                "enum": [
                  "prospect",
                  "active",
                  "inactive",
                  "supplier"
                ],
                "description": "#921 : statut affiché. `supplier` = société sans fait client qui porte un profil fournisseur actif (module Achats) ; `status` reste le statut calculé d'ADR-193"
              },
              "supplier": {
                "description": "#921 : profil fournisseur ; absent module Achats éteint ou sans droit de lecture sur `supplier`",
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "active": {
                        "type": "boolean"
                      },
                      "paymentDays": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "currency": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "leadTimeDays": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "ourReference": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "auxCodes": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "additionalProperties": {
                          "type": "string"
                        },
                        "description": "Compte auxiliaire fournisseur (401) par entité"
                      },
                      "notes": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                      }
                    },
                    "required": [
                      "active",
                      "paymentDays",
                      "currency",
                      "leadTimeDays",
                      "ourReference",
                      "auxCodes",
                      "notes",
                      "createdAt"
                    ],
                    "additionalProperties": false,
                    "description": "#921 : profil fournisseur de la société (module Achats), null si elle n'en porte pas"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "duplicateWarning": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "name": {
                    "type": "string"
                  },
                  "severity": {
                    "type": "string",
                    "enum": [
                      "strong",
                      "medium"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name",
                  "severity"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "name",
              "sector",
              "status",
              "logo",
              "logoFromReference",
              "parentCompanyId",
              "siret",
              "vatNumber",
              "vatStatus",
              "vatCheckedAt",
              "website",
              "websiteFromReference",
              "linkedin",
              "x",
              "instagram",
              "billingAddress",
              "paymentTerms",
              "salesAlert",
              "creditLimitCents",
              "paymentCondition",
              "externalCodes",
              "customFields",
              "relations",
              "createdAt",
              "updatedAt",
              "statusChangedAt",
              "engagedUntil",
              "displayStatus"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "default": {
      "description": "Erreur - enveloppe problem+json (RFC 9457)",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      }
    }
  }
}
```

## GET /companies/{id}

```json
{
  "summary": "Détail d'une société",
  "description": "`include` (répétable - T-687, fiche mobile) : contacts, quotes, activity, notes. Chaque bloc embarqué respecte la visibilité du principal ; absent = réponse historique inchangée.",
  "tags": [
    "Sociétés"
  ],
  "parameters": [
    {
      "name": "include",
      "in": "query",
      "required": false,
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "description": "Bloc à embarquer (répétable) - fiche en un appel",
        "type": "string",
        "enum": [
          "contacts",
          "quotes",
          "activity",
          "notes"
        ]
      }
    }
  ],
  "security": [
    {
      "oauth2": [
        "companies:read"
      ]
    },
    {
      "userSession": []
    }
  ],
  "responses": {
    "200": {
      "description": "Société (+ blocs demandés)",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string"
              },
              "sector": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "prospect",
                  "active",
                  "inactive"
                ]
              },
              "logo": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "logoFromReference": {
                "type": "boolean"
              },
              "ownerId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "parentCompanyId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "siret": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vatNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vatStatus": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "valid",
                      "invalid",
                      "unavailable"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "T-1401 : verdict VIES du numéro de TVA, null = jamais vérifié ; lecture seule"
              },
              "vatCheckedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "T-1401 : dernière vérification VIES, null = jamais"
              },
              "website": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "websiteFromReference": {
                "type": "boolean"
              },
              "linkedin": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "x": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "instagram": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "billingAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "paymentTerms": {
                "description": "Note de règlement, texte libre (#998)",
                "type": [
                  "string",
                  "null"
                ]
              },
              "salesAlert": {
                "description": "#971 : alerte commerciale interne, jamais montrée au client",
                "type": [
                  "string",
                  "null"
                ]
              },
              "creditLimitCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "#978 : plafond d'encours TTC en centimes, null = sans plafond ; l'encours n'est jamais exposé"
              },
              "paymentCondition": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "days",
                          "days_end_of_month",
                          "end_of_month_then_day"
                        ]
                      },
                      "days": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 365
                      },
                      "dayOfNextMonth": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 31
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "days",
                      "dayOfNextMonth"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "#998 : condition de paiement propre { type, days, dayOfNextMonth }, null = celle de l'organisation"
              },
              "externalCodes": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "customFields": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": [
                    "string",
                    "number",
                    "boolean"
                  ]
                }
              },
              "relations": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "#494 (ADR-203 D3) : natures de relation déclarées (partenaire, concurrent…), indépendantes du statut calculé"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "statusChangedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "Entrée dans le statut courant (T-1407)"
              },
              "engagedUntil": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Fin d'engagement : max ends_on des contrats vivants (T-1410), null sans contrat"
              },
              "externalRefs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "description": "Système source (minuscules) - `tacto`, `erp`…"
                    },
                    "externalId": {
                      "type": "string"
                    },
                    "sourceUpdatedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Dernière modification connue dans la source (curseur du delta), null si inconnue"
                    }
                  },
                  "required": [
                    "source",
                    "externalId",
                    "sourceUpdatedAt"
                  ],
                  "additionalProperties": false
                },
                "description": "Identifiants de cet objet dans les systèmes tiers (external_ref, ADR-138 D1, ADR-156 D6)"
              },
              "displayStatus": {
                "type": "string",
                "enum": [
                  "prospect",
                  "active",
                  "inactive",
                  "supplier"
                ],
                "description": "#921 : statut affiché. `supplier` = société sans fait client qui porte un profil fournisseur actif (module Achats) ; `status` reste le statut calculé d'ADR-193"
              },
              "supplier": {
                "description": "#921 : profil fournisseur ; absent module Achats éteint ou sans droit de lecture sur `supplier`",
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "active": {
                        "type": "boolean"
                      },
                      "paymentDays": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "currency": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "leadTimeDays": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "ourReference": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "auxCodes": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "additionalProperties": {
                          "type": "string"
                        },
                        "description": "Compte auxiliaire fournisseur (401) par entité"
                      },
                      "notes": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                      }
                    },
                    "required": [
                      "active",
                      "paymentDays",
                      "currency",
                      "leadTimeDays",
                      "ourReference",
                      "auxCodes",
                      "notes",
                      "createdAt"
                    ],
                    "additionalProperties": false,
                    "description": "#921 : profil fournisseur de la société (module Achats), null si elle n'en porte pas"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "contacts": {
                "description": "Bloc `include=contacts` - contacts affiliés actifs",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "affiliationId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "contactId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "firstName": {
                      "type": "string"
                    },
                    "lastName": {
                      "type": "string"
                    },
                    "email": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "phone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "principal",
                        "operational",
                        "billing",
                        "other"
                      ]
                    },
                    "startsOn": {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                    }
                  },
                  "required": [
                    "affiliationId",
                    "contactId",
                    "firstName",
                    "lastName",
                    "email",
                    "phone",
                    "title",
                    "role",
                    "startsOn"
                  ],
                  "additionalProperties": false
                }
              },
              "quotes": {
                "description": "Bloc `include=quotes` - devis de la société, visibilité devis appliquée",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "name": {
                            "type": "string"
                          },
                          "color": {
                            "type": "string",
                            "enum": [
                              "brand",
                              "comp",
                              "blend",
                              "muted",
                              "deep"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "color"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "number": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "sent",
                        "negotiation",
                        "signed",
                        "refused"
                      ]
                    },
                    "targetType": {
                      "type": "string",
                      "enum": [
                        "company",
                        "contact"
                      ]
                    },
                    "targetId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "ownerId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "lostToCompanyId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "expectedSignOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "forecastConfidence": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "possible",
                            "probable",
                            "quasi_certain"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "forecastComment": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "subject": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "commitment": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Engagement pluriannuel - nombre de cycles couverts"
                    },
                    "priced": {
                      "type": "boolean",
                      "description": "#747 : faux = « Non chiffré », aucune ligne chiffrée (hors lignes de texte) ; les montants valent alors 0 et ne sont pas un vrai zéro"
                    },
                    "serviceOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Date de prestation d'un devis ponctuel (T-1412) - null : devis par cycle"
                    },
                    "totalExclTax": {
                      "type": "string"
                    },
                    "totalInclTax": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 3,
                      "description": "Devise du document, ISO 4217 (T-1404, ADR-184) - EUR par défaut"
                    },
                    "fxRate": {
                      "description": "Taux BCE figé, « 1 EUR = fxRate devise » - null en euros",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "fxRateDate": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Jour de publication du taux figé - null en euros"
                    },
                    "totalExclTaxEur": {
                      "type": "string",
                      "description": "Contre-valeur en euros du HT au taux figé"
                    },
                    "totalInclTaxEur": {
                      "type": "string",
                      "description": "Contre-valeur en euros du TTC au taux figé"
                    },
                    "createdOn": {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                    },
                    "sentOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "signedOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "validUntil": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Date de validité de l'offre (E183 #511) - null : sans échéance"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                      "description": "Entrée dans le statut courant (T-1407)"
                    },
                    "portalViewedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "#758 : première consultation au portail par un contact du client ; null : jamais ouvert"
                    },
                    "portalLastViewedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "#758 : dernière consultation au portail"
                    },
                    "portalViewCount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "#758 : nombre de consultations au portail (fiche et PDF)"
                    },
                    "alternativeGroupId": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "#753 : groupe d'alternatives (propositions simultanées pour une même vente) ; null : vente seule"
                    },
                    "alternativeReference": {
                      "type": "boolean",
                      "description": "#753 : proposition qui compte au pipeline dans son groupe (une par groupe, choisie par le commercial)"
                    },
                    "externalRefs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "source": {
                            "type": "string",
                            "description": "Système source (minuscules) - `tacto`, `erp`…"
                          },
                          "externalId": {
                            "type": "string"
                          },
                          "sourceUpdatedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Dernière modification connue dans la source (curseur du delta), null si inconnue"
                          }
                        },
                        "required": [
                          "source",
                          "externalId",
                          "sourceUpdatedAt"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Identifiants de cet objet dans les systèmes tiers (external_ref, ADR-138 D1, ADR-156 D6)"
                    }
                  },
                  "required": [
                    "tags",
                    "id",
                    "number",
                    "version",
                    "status",
                    "targetType",
                    "targetId",
                    "ownerId",
                    "lostToCompanyId",
                    "expectedSignOn",
                    "forecastConfidence",
                    "forecastComment",
                    "subject",
                    "commitment",
                    "priced",
                    "serviceOn",
                    "totalExclTax",
                    "totalInclTax",
                    "currency",
                    "fxRate",
                    "fxRateDate",
                    "totalExclTaxEur",
                    "totalInclTaxEur",
                    "createdOn",
                    "sentOn",
                    "signedOn",
                    "validUntil",
                    "updatedAt",
                    "statusChangedAt",
                    "portalViewedAt",
                    "portalLastViewedAt",
                    "portalViewCount",
                    "alternativeGroupId",
                    "alternativeReference"
                  ],
                  "additionalProperties": false
                }
              },
              "activity": {
                "description": "Bloc `include=activity` - fil d'activité, 20 derniers",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "quote_created",
                        "quote_sent",
                        "quote_signed",
                        "invoice_issued",
                        "invoice_paid",
                        "invoice_late",
                        "mail_in",
                        "mail_out",
                        "note",
                        "record_updated",
                        "call_logged",
                        "meeting_held",
                        "task"
                      ]
                    },
                    "occurredAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "ref": {
                      "description": "N° du devis ou de la facture concerné",
                      "type": "string"
                    },
                    "quoteId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "amount": {
                      "type": "number"
                    },
                    "note": {
                      "type": "string"
                    },
                    "title": {
                      "description": "Titre de l'activité commerciale",
                      "type": "string"
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "done",
                        "cancelled"
                      ]
                    },
                    "author": {
                      "type": "string"
                    },
                    "mail": {
                      "type": "object",
                      "properties": {
                        "subject": {
                          "type": "string"
                        },
                        "from": {
                          "type": "string"
                        },
                        "to": {
                          "type": "string"
                        },
                        "preview": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "subject",
                        "from",
                        "to",
                        "preview"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "kind",
                    "occurredAt"
                  ],
                  "additionalProperties": false
                }
              },
              "notes": {
                "description": "Bloc `include=notes` - notes de la fiche, même forme que /comments",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "authorId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "authorName": {
                      "type": "string"
                    },
                    "authorAvatar": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "body": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "authorId",
                    "authorName",
                    "authorAvatar",
                    "body",
                    "createdAt"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "id",
              "name",
              "sector",
              "status",
              "logo",
              "logoFromReference",
              "parentCompanyId",
              "siret",
              "vatNumber",
              "vatStatus",
              "vatCheckedAt",
              "website",
              "websiteFromReference",
              "linkedin",
              "x",
              "instagram",
              "billingAddress",
              "paymentTerms",
              "salesAlert",
              "creditLimitCents",
              "paymentCondition",
              "externalCodes",
              "customFields",
              "relations",
              "createdAt",
              "updatedAt",
              "statusChangedAt",
              "engagedUntil",
              "displayStatus"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "default": {
      "description": "Erreur - enveloppe problem+json (RFC 9457)",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      }
    }
  }
}
```

## PATCH /companies/{id}

```json
{
  "summary": "Modifier une société (patch partiel - champs omis intacts)",
  "tags": [
    "Sociétés"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 2,
              "maxLength": 200
            },
            "ownerId": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "sector": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 80
                }
              ]
            },
            "parentCompanyId": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "siret": {
              "type": [
                "null",
                "string"
              ]
            },
            "vatNumber": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 40
                },
                {
                  "type": "null"
                }
              ]
            },
            "website": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 200
                }
              ]
            },
            "linkedin": {
              "type": [
                "null",
                "string"
              ]
            },
            "x": {
              "type": [
                "null",
                "string"
              ]
            },
            "instagram": {
              "type": [
                "null",
                "string"
              ]
            },
            "billingAddress": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 300
                }
              ]
            },
            "customFields": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "maxLength": 80
              },
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 2000
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "externalCodes": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "pattern": "^[A-Za-z0-9._-]+$"
                  }
                ]
              }
            },
            "relations": {
              "description": "#494 : natures de relation (clés de la liste d'organisation, GET /company-relations) ; remplace la liste, [] retire tout",
              "maxItems": 30,
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-]{0,39}$"
              }
            },
            "paymentTerms": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 120
                }
              ]
            },
            "salesAlert": {
              "description": "#971 : alerte commerciale interne, dite en tête des devis de la société ; null l'efface",
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 300
                }
              ]
            },
            "creditLimitCents": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 2000000000,
                  "description": "Plafond d'encours TTC en centimes ; null = sans plafond (#978)"
                },
                {
                  "type": "null"
                }
              ]
            },
            "paymentCondition": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "days",
                        "days_end_of_month",
                        "end_of_month_then_day"
                      ]
                    },
                    "days": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 365
                    },
                    "dayOfNextMonth": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 31
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "days",
                    "dayOfNextMonth"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "supplier": {
              "description": "#921 : profil fournisseur, écriture partielle ; refusé module Achats éteint (422)",
              "type": "object",
              "properties": {
                "active": {
                  "type": "boolean"
                },
                "paymentDays": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 365
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "currency": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "EUR",
                        "USD",
                        "GBP",
                        "CHF"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "leadTimeDays": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 365
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ourReference": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 60
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "auxCodes": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "additionalProperties": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "pattern": "^[A-Za-z0-9._-]+$"
                  }
                },
                "notes": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 2000
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        }
      }
    }
  },
  "security": [
    {
      "oauth2": [
        "companies:write"
      ]
    },
    {
      "userSession": []
    }
  ],
  "responses": {
    "200": {
      "description": "Société modifiée",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string"
              },
              "sector": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "prospect",
                  "active",
                  "inactive"
                ]
              },
              "logo": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "logoFromReference": {
                "type": "boolean"
              },
              "ownerId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "parentCompanyId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "siret": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vatNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vatStatus": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "valid",
                      "invalid",
                      "unavailable"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "T-1401 : verdict VIES du numéro de TVA, null = jamais vérifié ; lecture seule"
              },
              "vatCheckedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "T-1401 : dernière vérification VIES, null = jamais"
              },
              "website": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "websiteFromReference": {
                "type": "boolean"
              },
              "linkedin": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "x": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "instagram": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "billingAddress": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "paymentTerms": {
                "description": "Note de règlement, texte libre (#998)",
                "type": [
                  "string",
                  "null"
                ]
              },
              "salesAlert": {
                "description": "#971 : alerte commerciale interne, jamais montrée au client",
                "type": [
                  "string",
                  "null"
                ]
              },
              "creditLimitCents": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "#978 : plafond d'encours TTC en centimes, null = sans plafond ; l'encours n'est jamais exposé"
              },
              "paymentCondition": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "days",
                          "days_end_of_month",
                          "end_of_month_then_day"
                        ]
                      },
                      "days": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 365
                      },
                      "dayOfNextMonth": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 31
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "days",
                      "dayOfNextMonth"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "#998 : condition de paiement propre { type, days, dayOfNextMonth }, null = celle de l'organisation"
              },
              "externalCodes": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "customFields": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": [
                    "string",
                    "number",
                    "boolean"
                  ]
                }
              },
              "relations": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "#494 (ADR-203 D3) : natures de relation déclarées (partenaire, concurrent…), indépendantes du statut calculé"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "statusChangedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                "description": "Entrée dans le statut courant (T-1407)"
              },
              "engagedUntil": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Fin d'engagement : max ends_on des contrats vivants (T-1410), null sans contrat"
              },
              "externalRefs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "description": "Système source (minuscules) - `tacto`, `erp`…"
                    },
                    "externalId": {
                      "type": "string"
                    },
                    "sourceUpdatedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Dernière modification connue dans la source (curseur du delta), null si inconnue"
                    }
                  },
                  "required": [
                    "source",
                    "externalId",
                    "sourceUpdatedAt"
                  ],
                  "additionalProperties": false
                },
                "description": "Identifiants de cet objet dans les systèmes tiers (external_ref, ADR-138 D1, ADR-156 D6)"
              },
              "displayStatus": {
                "type": "string",
                "enum": [
                  "prospect",
                  "active",
                  "inactive",
                  "supplier"
                ],
                "description": "#921 : statut affiché. `supplier` = société sans fait client qui porte un profil fournisseur actif (module Achats) ; `status` reste le statut calculé d'ADR-193"
              },
              "supplier": {
                "description": "#921 : profil fournisseur ; absent module Achats éteint ou sans droit de lecture sur `supplier`",
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "active": {
                        "type": "boolean"
                      },
                      "paymentDays": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "currency": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "leadTimeDays": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "ourReference": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "auxCodes": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "additionalProperties": {
                          "type": "string"
                        },
                        "description": "Compte auxiliaire fournisseur (401) par entité"
                      },
                      "notes": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                      }
                    },
                    "required": [
                      "active",
                      "paymentDays",
                      "currency",
                      "leadTimeDays",
                      "ourReference",
                      "auxCodes",
                      "notes",
                      "createdAt"
                    ],
                    "additionalProperties": false,
                    "description": "#921 : profil fournisseur de la société (module Achats), null si elle n'en porte pas"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "duplicateWarning": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "name": {
                    "type": "string"
                  },
                  "severity": {
                    "type": "string",
                    "enum": [
                      "strong",
                      "medium"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name",
                  "severity"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "name",
              "sector",
              "status",
              "logo",
              "logoFromReference",
              "parentCompanyId",
              "siret",
              "vatNumber",
              "vatStatus",
              "vatCheckedAt",
              "website",
              "websiteFromReference",
              "linkedin",
              "x",
              "instagram",
              "billingAddress",
              "paymentTerms",
              "salesAlert",
              "creditLimitCents",
              "paymentCondition",
              "externalCodes",
              "customFields",
              "relations",
              "createdAt",
              "updatedAt",
              "statusChangedAt",
              "engagedUntil",
              "displayStatus"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "default": {
      "description": "Erreur - enveloppe problem+json (RFC 9457)",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      }
    }
  }
}
```

## DELETE /companies/{id}

```json
{
  "summary": "Mettre à la corbeille (soft delete T-261 - jamais de hard delete)",
  "description": "Refusé (409) si des devis ou factures ciblent la société. Restauration dans Paramètres > Corbeille.",
  "tags": [
    "Sociétés"
  ],
  "security": [
    {
      "oauth2": [
        "companies:write"
      ]
    },
    {
      "userSession": []
    }
  ],
  "responses": {
    "200": {
      "description": "Société mise à la corbeille",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "deleted": {
                "type": "boolean",
                "const": true
              }
            },
            "required": [
              "id",
              "deleted"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "default": {
      "description": "Erreur - enveloppe problem+json (RFC 9457)",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      }
    }
  }
}
```

## PUT /companies/{id}/external-refs/{source}

```json
{
  "summary": "Poser l'identifiant d'une source sur une société (idempotent)",
  "description": "Une source, un identifiant par objet : la même écriture deux fois ne crée qu'une ligne ; un identifiant déjà porté par un AUTRE objet de la même source répond 409 avec l'objet porteur (jamais déplacé en silence). La source `salesforce` est réservée aux scripts de reprise (403). Même garde que le PATCH de l'objet : hors visibilité 404, hors périmètre d'écriture 403.",
  "tags": [
    "Sociétés"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "sourceUpdatedAt": {
              "description": "Dernière modification dans la source - curseur du delta",
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                {
                  "type": "string",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                }
              ]
            }
          },
          "required": [
            "externalId"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "security": [
    {
      "oauth2": [
        "companies:write"
      ]
    },
    {
      "userSession": []
    }
  ],
  "responses": {
    "200": {
      "description": "Identifiants de l'objet après écriture",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                "description": "Objet porteur"
              },
              "externalRefs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "description": "Système source (minuscules) - `tacto`, `erp`…"
                    },
                    "externalId": {
                      "type": "string"
                    },
                    "sourceUpdatedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Dernière modification connue dans la source (curseur du delta), null si inconnue"
                    }
                  },
                  "required": [
                    "source",
                    "externalId",
                    "sourceUpdatedAt"
                  ],
                  "additionalProperties": false
                },
                "description": "Identifiants de cet objet dans les systèmes tiers (external_ref, ADR-138 D1, ADR-156 D6)"
              }
            },
            "required": [
              "id",
              "externalRefs"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "default": {
      "description": "Erreur - enveloppe problem+json (RFC 9457)",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      }
    }
  }
}
```

## DELETE /companies/{id}/external-refs/{source}

```json
{
  "summary": "Retirer l'identifiant d'une source sur une société",
  "tags": [
    "Sociétés"
  ],
  "security": [
    {
      "oauth2": [
        "companies:write"
      ]
    },
    {
      "userSession": []
    }
  ],
  "responses": {
    "200": {
      "description": "Identifiants restants",
      "content": {
        "application/json": {
          "schema": {
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                "description": "Objet porteur"
              },
              "externalRefs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "description": "Système source (minuscules) - `tacto`, `erp`…"
                    },
                    "externalId": {
                      "type": "string"
                    },
                    "sourceUpdatedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Dernière modification connue dans la source (curseur du delta), null si inconnue"
                    }
                  },
                  "required": [
                    "source",
                    "externalId",
                    "sourceUpdatedAt"
                  ],
                  "additionalProperties": false
                },
                "description": "Identifiants de cet objet dans les systèmes tiers (external_ref, ADR-138 D1, ADR-156 D6)"
              },
              "removed": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Références retirées (0 si la source n'en portait pas)"
              }
            },
            "required": [
              "id",
              "externalRefs",
              "removed"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "default": {
      "description": "Erreur - enveloppe problem+json (RFC 9457)",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      }
    }
  }
}
```
