Skip to content

Powered by Grav

Add Pet

Add Pet

POST /pet
Creates a new pet in the store inventory. The pet will be assigned a unique ID automatically.

Parameters

Name Type Description
id optional integer
name required string
category optional object
photoUrls required array
tags optional array
status optional string pet status in the store
JSON
{
    "name": "doggie",
    "category": {
        "name": "Dogs"
    },
    "photoUrls": [
        "string"
    ],
    "tags": [
        {
            "name": "string"
        }
    ],
    "status": "available"
}
JSON
{
    "id": 10,
    "name": "doggie",
    "category": {
        "id": 1,
        "name": "Dogs"
    },
    "photoUrls": [
        "string"
    ],
    "tags": [
        {
            "id": 1,
            "name": "string"
        }
    ],
    "status": "available"
}

Response Codes

200 Successful operation
400 Invalid input
422 Validation exception

Usage Notes

When creating a new pet, the id field is optional. If omitted, the system will automatically generate a unique identifier.

Status Values

The status field accepts one of the following values:

Status Description
available Pet is available for purchase
pending Pet has a pending order
sold Pet has been sold

Image Upload

After creating a pet, you can upload images using the Upload Image endpoint.

Example with cURL

BASH
curl -X POST "https://petstore3.swagger.io/api/v3/pet" \
  -H "Content-Type: application/json" \
  -H "api_key: YOUR_API_KEY" \
  -d '{
    "name": "Buddy",
    "category": {"name": "Dogs"},
    "photoUrls": ["https://example.com/buddy.jpg"],
    "status": "available"
  }'

Webhooks

When a pet is created, the following webhook event is triggered:

JSON
{
  "event": "pet.created",
  "data": {
    "id": 12345,
    "name": "Buddy",
    "status": "available"
  },
  "timestamp": "2024-01-15T10:30:00Z"
}

© 2025 Grav. All rights reserved.