Sample - Swagger Petstore OpenAPI 3
POST/pet

Create a new pet

Creates a new pet in the store. Supply name and photoUrls, and optionally provide category, tags, and a store status of available, pending, or sold. Returns the created pet object.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

6 body fields

Pet details to add to the store. name and photoUrls are required.

idintegeroptional
The unique integer identifier for the pet.
namestringrequired
The pet's name.
categoryobjectoptional
The pet's category, identified by an integer ID and category name.
photoUrlsarray<string>required
Array of URLs for images of the pet.
tagsarray<object>optional
Array of tags, each identified by an integer ID and tag name.
statusstringoptional
pet status in the store
Allowed:availablependingsold

4 status codes
200Returns the created pet object, including its identifier, name, category, image 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 pet input is invalid.
422Returned when the pet payload fails validation.
defaultReturned when an unexpected error occurs.

Error handling

Omitting either name or photoUrls returns a 400. A 422 is returned when the pet payload fails validation, including when status is not one of available, pending, or sold. Provide photoUrls as an array of image URL strings.