Swagger Petstore

Single example of Petstore API, with both endpoints and webhooks. Operations and webhooks are grouped by path.

This is the documentation for version 1.0.0 of the API. Last update on Feb 24, 2021.

This API is provided under license MIT.

Base URL
http://petstore.swagger.io/v1

Pets

All pets

Query parameters
  • limit integer(int32)

    How many items to return at one time (max 100)

Responses
  • 200 array[object]

    A paged array of pets

    • x-next string

      A link to the next page of responses

    • id Required / integer(int64)
    • name Required / string
    • tag string
  • default object

    unexpected error

    • code Required / integer(int32)
    • message Required / string
GET /pets
$ curl \
 -X GET http://petstore.swagger.io/v1/pets
Response example (200)
# Headers
x-next: string

# Payload
[
  {
    "id": 42,
    "name": "string",
    "tag": "string"
  }
]
Response example (default)
{
  "code": 42,
  "message": "string"
}

Create a pet

Responses
  • 201

    Null response

  • default object

    unexpected error

    • code Required / integer(int32)
    • message Required / string
POST /pets
$ curl \
 -X POST http://petstore.swagger.io/v1/pets
Response example (default)
{
  "code": 42,
  "message": "string"
}

Info for a specific pet

Path parameters
  • petId Required / string

    The id of the pet to retrieve

Responses
  • 200 object

    Expected response to a valid request

    • id Required / integer(int64)
    • name Required / string
    • tag string
  • default object

    unexpected error

    • code Required / integer(int32)
    • message Required / string
GET /pets/{petId}
$ curl \
 -X GET http://petstore.swagger.io/v1/pets/{petId}
Response example (200)
{
  "id": 42,
  "name": "string",
  "tag": "string"
}
Response example (default)
{
  "code": 42,
  "message": "string"
}

New pet

A new pet arrived

A new pet arrived, let's come and discover it IRL.

Body
  • id Required / integer(int64)
  • name Required / string
  • tag string
Responses
  • 200

    Return a 200 status to indicate that the data was received successfully

POST newPet
$ curl \
 -X POST https://webhook.example.com \
 -d '{"id":42,"name":"string","tag":"string"}'
Request example
{
  "id": 42,
  "name": "string",
  "tag": "string"
}