> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/fr/api-references/openapi/add-an-openapi-specification.md).

# Ajouter une spécification OpenAPI

Si vous avez une spécification OpenAPI, vous pouvez l’ajouter à votre organisation en téléversant le fichier directement, en le reliant à une URL hébergée, ou en utilisant le [CLI GitBook](https://gitbook.com/docs/developers/integrations/reference).

GitBook accepte [Swagger 2.0](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md), [OpenAPI 3.0](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md), et [OpenAPI 3.1](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md) les spécifications pour les téléversements de fichiers, les URL hébergées et la publication via la CLI. Pour le récapitulatif actuel de compatibilité, voir [Compatibilité OpenAPI](/docs/documentation/fr/api-references/openapi.md#openapi-compatibility).

<figure><img src="/files/0fca8ea2eb3334ee913245c383017739f735f5cd" alt="A GitBook screenshot showing the modal for generating API docs automatically"><figcaption></figcaption></figure>

### Comment ajouter une spécification

1. Ouvrez la **OpenAPI** section dans la barre latérale
2. Cliquez sur **Ajouter une spécification**
3. Donnez un nom à votre spécification. Cela aide à l’identifier, surtout si vous gérez plusieurs spécifications
4. Choisissez l’une des options suivantes :
   * Téléversez un fichier (par ex. *openapi.yaml*)
   * Saisissez une URL vers une spécification hébergée
   * Utilisez la CLI pour publier la spécification

<figure><img src="/files/bf77749eaadadf8901e6bde1ec71150656f7af5e" alt="A GitBook screenshot showing the Add an OpenAPI specification modal"><figcaption><p>Modale d’ajout d’une spécification OpenAPI.</p></figcaption></figure>

### Mettre à jour votre spécification

Vous pouvez mettre à jour votre spécification OpenAPI à tout moment à l’aide de l’interface GitBook ou de la CLI, quelle que soit la manière dont elle a été ajoutée initialement.

#### Dans l’application GitBook

Dans le panneau OpenAPI :

* Si votre spécification est liée à une URL :
  * GitBook vérifie automatiquement les mises à jour **toutes les 6 heures**.
  * Pour récupérer immédiatement les mises à jour, cliquez sur **Vérifier les mises à jour**.
* Si votre spécification a été téléversée en tant que fichier :
  * Cliquez sur **Mettre à jour** pour téléverser une nouvelle version.
* Vous pouvez passer d’une source Fichier à une source URL en cliquant sur **Modifier** dans le menu des actions du fil d’Ariane.

#### En utilisant la CLI

Utilisez la même commande pour mettre à jour votre spécification :

```bash
gitbook openapi publish --spec api-spec-name --organization organization_id <path-or-url>
```

Vous pouvez également utiliser la CLI pour **Vérifier les mises à jour** en exécutant la commande de publication sur la même URL.

Lisez notre [Intégrer avec CI/CD](/docs/documentation/fr/api-references/guides/support-for-ci-cd-with-api-blocks.md) guide pour apprendre à automatiser la mise à jour de votre spécification.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/documentation/fr/api-references/openapi/add-an-openapi-specification.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
