Skip to main content
GitHub
6 min read

API Reference

Pet

API endpoints for Pet

Content-Typeapplication/json
Version1.0.0
POST/pet

Add a new pet to the store

Creates a new pet resource in the store.

Request Body

application/json
idoptionalinteger
Pet ID (auto-generated on creation)
namerequiredstring
Pet name
photoUrlsrequiredstring
Photo URL (comma-separated for multiple)
statusoptional”available” | “pending” | “sold”
Pet status in the store
Values: available pending sold

Responses

200Pet created
Example Response
{
  "id": 10,
  "name": "string",
  "photoUrls": "string",
  "status": "available"
}
405Invalid input
Request Example
curl -X POST 'https://petstore.swagger.io/v2/pet' \
  -H 'Content-Type: application/json' \
  -d '{"id":10,"name":"string","photoUrls":"string","status":"available"}'
POSThttps://petstore.swagger.io/v2/pet
curl -X POST 'https://petstore.swagger.io/v2/pet' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": 10,
  "name": "string",
  "photoUrls": "string",
  "status": "available"
}'

Updates a pet in the store with form data.

Request Body

application/json
idoptionalinteger
Pet ID (auto-generated on creation)
namerequiredstring
Pet name
photoUrlsrequiredstring
Photo URL (comma-separated for multiple)
statusoptional”available” | “pending” | “sold”
Pet status in the store
Values: available pending sold

Responses

200Pet updated
Example Response
{
  "id": 10,
  "name": "string",
  "photoUrls": "string",
  "status": "available"
}
400Invalid ID supplied
404Pet not found
405Validation exception
Request Example
curl -X PUT 'https://petstore.swagger.io/v2/pet' \
  -H 'Content-Type: application/json' \
  -d '{"id":10,"name":"string","photoUrls":"string","status":"available"}'
PUThttps://petstore.swagger.io/v2/pet
curl -X PUT 'https://petstore.swagger.io/v2/pet' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": 10,
  "name": "string",
  "photoUrls": "string",
  "status": "available"
}'

Multiple status values can be provided with comma separated strings.

Parameters

statusrequired”available” | “pending” | “sold”
Status values that need to be considered for filter
Values: available pending sold

Responses

200Successful operation
Example Response
[
  {
    "id": 10,
    "name": "string",
    "photoUrls": "string",
    "status": "available"
  }
]
400Invalid status value
Request Example
curl -X GET 'https://petstore.swagger.io/v2/pet/findByStatus'
GEThttps://petstore.swagger.io/v2/pet/findByStatus
curl -X GET 'https://petstore.swagger.io/v2/pet/findByStatus'

Multiple tags can be provided with comma separated strings.

Parameters

tagsrequiredstring
Tags to filter by

Responses

200Successful operation
Example Response
[
  {
    "id": 10,
    "name": "string",
    "photoUrls": "string",
    "status": "available"
  }
]
400Invalid tag value
Request Example
curl -X GET 'https://petstore.swagger.io/v2/pet/findByTags'
GEThttps://petstore.swagger.io/v2/pet/findByTags
curl -X GET 'https://petstore.swagger.io/v2/pet/findByTags'

Returns a single pet by its numeric ID.

Parameters

petIdrequiredinteger
ID of pet to return

Responses

200Successful operation
Example Response
{
  "id": 10,
  "name": "string",
  "photoUrls": "string",
  "status": "available"
}
400Invalid ID supplied
404Pet not found
Request Example
curl -X GET 'https://petstore.swagger.io/v2/pet/{petId}'
GEThttps://petstore.swagger.io/v2/pet/{petId}
curl -X GET 'https://petstore.swagger.io/v2/pet/{petId}'

Deletes a pet by its numeric ID. Optionally pass an api_key header.

Parameters

petIdrequiredinteger
Pet id to delete
api_keyoptionalstring
API key for authorization

Responses

200Pet deleted
400Invalid ID supplied
404Pet not found
Request Example
curl -X DELETE 'https://petstore.swagger.io/v2/pet/{petId}'
DELETEhttps://petstore.swagger.io/v2/pet/{petId}
curl -X DELETE 'https://petstore.swagger.io/v2/pet/{petId}'