POST/pet

Create a new pet in the store

Creates a new pet in the store. Supply name and photoUrls at minimum — category, tags, and status are optional. status must be one of available, pending, or sold if provided. Returns the created pet object with its generated identifier.

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

6 body fields

Pet object to create. name and photoUrls are required.

idintegeroptional

The unique identifier for the pet. Generated by the store if omitted.

namestringrequired

The name of the pet.

categoryobjectoptional

A category object containing an id and name for the pet's category.

photoUrlsarray<string>required

An array of URLs pointing to images of the pet. At least one URL is

tagsarray<object>optional

An array of tag objects, each with an id and name, for categorising the pet.

statusstringoptional

pet status in the store

Allowed:availablependingsold

4 status codes
200Returns the created pet object with its unique identifier, name, category, photo URLs, tags, and status.
idintegeroptional
namestringrequired
categoryobjectoptional
photoUrlsarray<string>required
tagsarray<object>optional
statusstringoptional

pet status in the store

Allowed:availablependingsold
400Returned when a required field is missing or the request body is malformed.
422Returned when the request body fails validation, such as an invalid enum value for status.
defaultUnexpected error

Error handling

Omitting name or photoUrls returns a 400. A 422 is returned when the request body fails validation — ensure all required fields are present and properly formatted.