Pets
Add a pet
Create a pet from a JSON Pet payload.
Creates a pet and returns the resulting Pet object. This example uses JSON; the contract also accepts XML and form-encoded bodies.
Add a new pet to the store.
POST
/petOAuth 2.0 bearer token with `write:pets` and `read:pets` scopes.
Pet identifier.
Pet name.
Optional `Category` object.
Photo URLs.
Optional array of `Tag` objects.
One of `available`, `pending`, or `sold`.
Response
{200}Successful operation
{400}Invalid input
{422}Validation exception
cURL
curl --request POST \
--url https://petstore3.swagger.io/api/v3/pet \
--header 'Authorization: Bearer example_access_token' \
--header 'Content-Type: application/json' \
--data '{
"id": 10,
"name": "doggie",
"category": {
"id": 1,
"name": "Dogs"
},
"photoUrls": [
"https://example.com/images/doggie.jpg"
],
"tags": [
{
"id": 1,
"name": "friendly"
}
],
"status": "available"
}'{
"id": 10,
"name": "doggie",
"category": { "id": 1, "name": "Dogs" },
"photoUrls": ["https://example.com/images/doggie.jpg"],
"tags": [{ "id": 1, "name": "friendly" }],
"status": "available"
}The contract also defines a default Unexpected error response without a fixed status or body schema. See the Pet model before constructing the body.