Sample - Swagger Petstore OpenAPI 3
PUT/pet

Replace an existing pet

Replaces an existing pet in the store. Supply the pet's name and photoUrls together with any updated category, tags, or store status values. Returns the updated pet object.

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

6 body fields

Complete pet details for replacement. name and photoUrls are required.

idintegeroptional
The unique integer identifier of the pet to replace.
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

5 status codes
200Returns the updated 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 supplied pet identifier is invalid.
404Returned when no pet exists for the supplied identifier.
422Returned when the replacement pet payload fails validation.
defaultReturned when an unexpected error occurs.

Error handling

Omitting either name or photoUrls returns a 422. A 400 is returned when the pet identifier is invalid, and a 404 is returned when the pet cannot be found. status must be available, pending, or sold.