# API : business-units

3 opérations REST du groupe business-units.

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

- GET /business-units : Entités de vente (référentiel)
- GET /business-units/{id} : Détail d'une entité
- PATCH /business-units/{id} : Identité légale & bancaire d'une entité (T-302)
## GET /business-units

```json
{
  "summary": "Entités de vente (référentiel)",
  "tags": [
    "Référentiels"
  ],
  "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"
      }
    }
  ],
  "security": [
    {
      "oauth2": [
        "referentials:read"
      ]
    },
    {
      "userSession": []
    }
  ],
  "responses": {
    "200": {
      "description": "Page d'entité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"
                    },
                    "shortName": {
                      "type": "string"
                    },
                    "color": {
                      "type": "string"
                    },
                    "address": {
                      "type": "string"
                    },
                    "legalName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "siret": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "vatNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "iban": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "bic": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "legalMentions": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "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))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "shortName",
                    "color",
                    "address",
                    "legalName",
                    "siret",
                    "vatNumber",
                    "iban",
                    "bic",
                    "legalMentions",
                    "updatedAt"
                  ],
                  "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"
          }
        }
      }
    }
  }
}
```

## GET /business-units/{id}

```json
{
  "summary": "Détail d'une entité",
  "tags": [
    "Référentiels"
  ],
  "security": [
    {
      "oauth2": [
        "referentials:read"
      ]
    },
    {
      "userSession": []
    }
  ],
  "responses": {
    "200": {
      "description": "Entité",
      "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"
              },
              "shortName": {
                "type": "string"
              },
              "color": {
                "type": "string"
              },
              "address": {
                "type": "string"
              },
              "legalName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "siret": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vatNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "iban": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "bic": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "legalMentions": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "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))$"
              }
            },
            "required": [
              "id",
              "name",
              "shortName",
              "color",
              "address",
              "legalName",
              "siret",
              "vatNumber",
              "iban",
              "bic",
              "legalMentions",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "default": {
      "description": "Erreur - enveloppe problem+json (RFC 9457)",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      }
    }
  }
}
```

## PATCH /business-units/{id}

```json
{
  "summary": "Identité légale & bancaire d'une entité (T-302)",
  "tags": [
    "Référentiels"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "properties": {
            "legalName": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 120
                }
              ]
            },
            "siret": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 60
                }
              ]
            },
            "vatNumber": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 60
                }
              ]
            },
            "iban": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 60
                }
              ]
            },
            "bic": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 60
                }
              ]
            },
            "legalMentions": {
              "anyOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string",
                  "maxLength": 2000
                }
              ]
            }
          },
          "additionalProperties": false
        }
      }
    }
  },
  "security": [
    {
      "oauth2": [
        "referentials:write"
      ]
    },
    {
      "userSession": []
    }
  ],
  "responses": {
    "200": {
      "description": "Entité 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"
              },
              "shortName": {
                "type": "string"
              },
              "color": {
                "type": "string"
              },
              "address": {
                "type": "string"
              },
              "legalName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "siret": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vatNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "iban": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "bic": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "legalMentions": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "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))$"
              }
            },
            "required": [
              "id",
              "name",
              "shortName",
              "color",
              "address",
              "legalName",
              "siret",
              "vatNumber",
              "iban",
              "bic",
              "legalMentions",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "default": {
      "description": "Erreur - enveloppe problem+json (RFC 9457)",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      }
    }
  }
}
```
