Swagger Petstore - OpenAPI 3.0
POST/pet

Create a new pet

Creates a new pet in the store. Supply name and photoUrls, and use status to set the pet's store state when needed. The response contains the created pet record.

  • 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 integer identifier of the pet.
namestringrequired
The pet's name.
categoryobjectoptional
The category object assigned to the pet, including its identifier and name.
photoUrlsarray<string>required
Array of URLs for images of the pet.
tagsarray<object>optional
Array of tag objects assigned to the pet, including each tag's identifier and name.
statusstringoptional
pet status in the store
Allowed:availablependingsold

4 status codes
200Returns the created pet object with 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 pet input is invalid, including when a required field is missing.
422Returned when the pet data fails validation.
defaultUnexpected error

Error handling

Omitting name or photoUrls returns a 400. status must be one of: available, pending, or sold; invalid pet data returns a 422.