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 set the pet's store state when needed.

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

6 body fields

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

idintegeroptional
The unique numeric identifier of the pet.
namestringrequired
The pet's name.
categoryobjectoptional
The category assigned to the pet, including its identifier and name.
photoUrlsarray<string>required
The URLs of images for the pet.
tagsarray<object>optional
Tags associated with the pet, each containing an identifier and name.
statusstringoptional
pet status in the store
Allowed:availablependingsold

4 status codes
200Returns the created pet object with 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 data fails schema validation.
defaultReturned when an unexpected error occurs.

Error handling

name and photoUrls are required and must be included in the request. status must be one of available, pending, or sold; invalid input returns a 400, and schema validation failures return a 422.