OpenAPI

You can sync GitBook pages with an OpenAPI or Swagger file or a URL to include auto-generated API methods in your documentation.

OpenAPI block

GitBook's OpenAPI block is powered by Scalar, so you can test your APIs directly from your docs.

Add a new pet to the store

Add a new pet to the store

POST/api/v3/pet
Authorization
Body

Create a new pet in the store

idinteger (int64)
Example: 10
name*string
Example: "doggie"
categoryCategory (object)
photoUrls*array of string
tagsarray of Tag (object)
statusenum

pet status in the store

availablependingsold
Response

Successful operation

Body
idinteger (int64)
Example: 10
name*string
Example: "doggie"
categoryCategory (object)
photoUrls*array of string
tagsarray of Tag (object)
statusenum

pet status in the store

availablependingsold
Request
const response = await fetch('/api/v3/pet', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "name": "doggie",
      "photoUrls": [
        "text"
      ]
    }),
});
const data = await response.json();
Response
{
  "id": 10,
  "name": "doggie",
  "category": {
    "id": 1,
    "name": "Dogs"
  },
  "photoUrls": [
    "text"
  ],
  "tags": [
    {
      "id": 0,
      "name": "text"
    }
  ],
  "status": "available"
}