Swagger Petstore - OpenAPI 3.0
POST/pet

Create a new pet

Creates a new pet record in the store. Supply name and photoUrls, and use status to classify the pet as available, pending, or sold. The response contains the stored pet and its assigned or supplied identifiers.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

6 body fields

Pet details to create in the store; name and photoUrls are required.

idintegeroptional
The pet's numeric identifier.
namestringrequired
The pet's name.
categoryobjectoptional
The pet's category, including its numeric identifier and name.
photoUrlsarray<string>required
An array of URLs for images of the pet.
tagsarray<object>optional
An array of tags, each containing a numeric identifier and name.
statusstringoptional
pet status in the store
Allowed:availablependingsold

4 status codes
200Returns the created pet object, including its identifier, name, category, photo URLs, tags, and store status.
idintegeroptional
namestringrequired
categoryobjectoptional
photoUrlsarray<string>required
tagsarray<object>optional
statusstringoptional
pet status in the store
Allowed:availablependingsold
400Returned when the submitted pet input is invalid.
422Returned when the pet fails validation.
defaultReturned when an unexpected error occurs.

Error handling

Omitting name or photoUrls returns a 400. status must be one of: available, pending, or sold; invalid pet data returns a 422. Ensure the submitted pet representation is valid for the selected request format.