> ## Documentation Index
> Fetch the complete documentation index at: https://docs2.petstoreapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Pet

> Add a new pet to the store catalog, making it available for adoption.

## Pet Lifecycle Workflow

When a new pet enters the system:

1. **Intake**: Staff creates a pet record with this endpoint (status: `available`)
2. **Profile**: Pet details include species, breed, age, medical info, photos, and adoption fee
3. **Discovery**: Pet appears in search results and listings
4. **Adoption Application**: Potential adopters can apply through the adoption endpoints
5. **Adoption**: Once approved, pet status changes to `adopted`
6. **Post-Adoption**: Pet record is retained for historical purposes

**Access**: This operation requires staff permissions (`write:pets` scope or valid Bearer token). Only authenticated staff members can add pets to the system.



## OpenAPI

````yaml api-reference/modern-petstore-3.1.openapi.json post /pets
openapi: 3.1.0
info:
  title: Modern Petstore API
  summary: A modern, realistic pet store API demonstrating current best practices
  description: >-
    This is a modern Pet Store API based on the OpenAPI 3.2 specification. It
    demonstrates contemporary API design patterns and best practices including
    RESTful compliance, proper HTTP methods, structured error responses (RFC
    9457), and modern authentication flows.


    Key features include pet catalog browsing, adoption workflow, order
    management, user accounts, AI-powered chat advisor, and real-time event
    notifications via webhooks. The API showcases OpenAPI 3.2 capabilities like
    hierarchical tags, QUERY HTTP method, OAuth device flow, and server-sent
    events.


    Some useful links:

    - [API Documentation](https://docs.petstoreapi.com)

    - [Source Code Repository](https://github.com/petstoreapi/PetstoreAPI)

    - [OpenAPI
    Specification](https://petstoreapi.com/v1/specs/modern-petstore-3.2.openapi.yaml)
  version: 1.0.0
  contact:
    name: Petstore API Support
    url: https://petstoreapi.com/support
    email: support@petstoreapi.com
  license:
    name: MIT
    identifier: MIT
servers:
  - url: https://api.petstoreapi.com/v1
    description: Production server
security:
  - bearerAuth: []
  - oauth2: []
tags:
  - name: Store
    description: Store operations including orders and inventory
  - name: Pet
    description: Pet catalog and management operations
  - name: Payments
    description: Payment processing with polymorphic payment sources
  - name: User
    description: User account management
  - name: Chat
    description: >-
      AI-powered chat completions with streaming support using Server-Sent
      Events (SSE)
    externalDocs:
      description: Learn more about Chat API
      url: https://petstoreapi.com/docs/chat
  - name: Webhooks
    description: Event-driven webhook notifications (OpenAPI 3.2)
    externalDocs:
      description: Learn more about webhooks
      url: https://petstoreapi.com/docs/webhooks
paths:
  /pets:
    parameters:
      - $ref: '#/components/parameters/TenantID'
    post:
      tags:
        - Pet
      summary: Create Pet
      description: >-
        Add a new pet to the store catalog, making it available for adoption.


        ## Pet Lifecycle Workflow


        When a new pet enters the system:


        1. **Intake**: Staff creates a pet record with this endpoint (status:
        `available`)

        2. **Profile**: Pet details include species, breed, age, medical info,
        photos, and adoption fee

        3. **Discovery**: Pet appears in search results and listings

        4. **Adoption Application**: Potential adopters can apply through the
        adoption endpoints

        5. **Adoption**: Once approved, pet status changes to `adopted`

        6. **Post-Adoption**: Pet record is retained for historical purposes


        **Access**: This operation requires staff permissions (`write:pets`
        scope or valid Bearer token). Only authenticated staff members can add
        pets to the system.
      operationId: createPet
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Pet'
            example:
              name: Max
              species: DOG
              breed: Golden Retriever
              ageMonths: 24
              size: LARGE
              color: Golden
              gender: MALE
              goodWithKids: true
              price: '250.00'
              currency: USD
              status: AVAILABLE
              description: Friendly golden retriever looking for an active family
              medicalInfo:
                vaccinated: true
                spayedNeutered: true
                microchipped: true
                specialNeeds: false
                healthNotes: Up to date on all vaccinations
      responses:
        '201':
          description: Pet created successfully
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      deprecated: false
      security:
        - bearerAuth: []
        - oauth2:
            - write:pets
      x-codeSamples:
        - lang: TypeScript
          label: TypeScript SDK
          source: |-
            import { PetStoreAPI } from '@petstoreapi/sdk';

            const client = new PetStoreAPI({
              accessToken: process.env.OAUTH_ACCESS_TOKEN
            });

            const newPet = await client.pets.create({
              species: 'dog',
              name: 'Buddy',
              breed: 'Golden Retriever',
              ageMonths: 24,
              size: 'large',
              color: 'Golden',
              gender: 'male',
              goodWithKids: true,

              price: '150.00',
              description: 'Friendly golden retriever looking for an active family'
            });

            console.log(`Created pet with ID: ${newPet.id}`);
        - lang: Python
          label: Python
          source: |-
            from petstore import PetStoreAPI

            client = PetStoreAPI(access_token=os.environ['OAUTH_ACCESS_TOKEN'])

            new_pet = client.pets.create(
                species='dog',
                name='Buddy',
                breed='Golden Retriever',
                ageMonths=24,
                size='large',
                color='Golden',
                gender='male',
                goodWithKids=True,

                price='150.00',
                description='Friendly golden retriever looking for an active family'
            )

            print(f"Created pet with ID: {new_pet.id}")
        - lang: JavaScript
          label: JavaScript (Fetch)
          source: |-
            const response = await fetch(
              'https://api.petstoreapi.com/v1/pets',
              {
                method: 'POST',
                headers: {
                  'Authorization': `Bearer ${accessToken}`,
                  'Content-Type': 'application/json'
                },
                body: JSON.stringify({
                  species: 'dog',
                  name: 'Buddy',
                  breed: 'Golden Retriever',
                  ageMonths: 24,
                  size: 'large',
                  color: 'Golden',
                  gender: 'male',
                  goodWithKids: true,

                  price: '150.00',
                  description: 'Friendly golden retriever looking for an active family'
                })
              }
            );

            const newPet = await response.json();
            console.log(`Created pet with ID: ${newPet.id}`);
        - lang: Shell
          label: cURL
          source: |-
            curl -X POST 'https://api.petstoreapi.com/v1/pets' \
              -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
              -H 'Content-Type: application/json' \
              -d '{
                "species": "dog",
                "name": "Buddy",
                "breed": "Golden Retriever",
                "ageMonths": 24,
                "size": "large",
                "color": "Golden",
                "gender": "male",
                "goodWithKids": true,

                "price": "150.00",
                "description": "Friendly golden retriever looking for an active family"
              }'
components:
  parameters:
    TenantID:
      name: X-Tenant-ID
      in: header
      description: >-
        Optional tenant identifier for data isolation. When provided, all
        operations will be scoped to this tenant, ensuring data separation
        between different organizations or users. If omitted, operations will
        access the shared/public data pool where data may be visible to and
        modified by other users.
      required: false
      schema:
        type: string
        format: uuid
      examples:
        organization:
          value: 550e8400-e29b-41d4-a716-446655440000
          summary: Organization tenant ID
        development:
          value: 7c9e6679-7425-40de-944b-e07fc1f90ae7
          summary: Development environment
        production:
          value: 9b5e4f89-3c12-4a5e-9f8e-2d3c5a7e6b1a
          summary: Production environment
  schemas:
    Pet:
      type: object
      description: Animal information in the pet store available for adoption.
      required:
        - id
        - name
        - species
        - ageMonths
        - price
        - currency
        - status
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
          description: Unique identifier for the pet (UUID v7)
          examples:
            - 019b4132-70aa-764f-b315-e2803d882a24
            - 019b4127-54d5-76d9-b626-0d4c7bfce5b6
        species:
          type: string
          enum:
            - DOG
            - CAT
            - RABBIT
            - BIRD
            - REPTILE
            - OTHER
          description: The species of the pet
        name:
          type: string
          minLength: 1
          maxLength: 50
          description: The pet's name
          examples:
            - Whiskers
            - Max
            - Luna
        breed:
          type: string
          description: The breed of the pet
          examples:
            - Domestic Shorthair
            - Labrador Retriever
            - Holland Lop
        ageMonths:
          type: integer
          minimum: 0
          description: Age of the pet in months
          examples:
            - 18
            - 36
            - 6
        size:
          type: string
          enum:
            - SMALL
            - MEDIUM
            - LARGE
          description: Size category of the pet
        color:
          type: string
          description: Primary color or coloring pattern
          examples:
            - Orange Tabby
            - Black
            - Brown and White
        gender:
          type: string
          enum:
            - MALE
            - FEMALE
            - UNKNOWN
          description: The pet's gender
        goodWithKids:
          type: boolean
          description: Whether the pet is good with children
        price:
          type: string
          description: Adoption fee amount
          examples:
            - '75.00'
            - '150.00'
            - '50.00'
        currency:
          type: string
          description: Currency code for the adoption fee (ISO 4217)
          default: USD
          pattern: ^[A-Z]{3}$
          examples:
            - USD
            - EUR
            - GBP
        description:
          type: string
          description: Detailed description of the pet's personality and traits
        status:
          type: string
          enum:
            - AVAILABLE
            - PENDING
            - ADOPTED
            - NOT_AVAILABLE
          description: Current adoption status
        createdAt:
          type: string
          format: date-time
          readOnly: true
          description: Timestamp when the pet record was created (RFC 3339)
          examples:
            - '2025-12-21T13:56:23Z'
            - '2025-11-15T08:30:00Z'
        updatedAt:
          type: string
          format: date-time
          readOnly: true
          description: Timestamp when the pet record was last updated (RFC 3339)
          examples:
            - '2025-12-21T13:56:23Z'
            - '2025-12-21T15:30:45Z'
        tenantId:
          type: string
          format: uuid
          readOnly: true
          description: >-
            Optional tenant identifier for data isolation. When present,
            indicates this pet belongs to a specific tenant. Null or omitted
            means the pet is in the shared/public data pool.
          examples:
            - 550e8400-e29b-41d4-a716-446655440000
            - 7c9e6679-7425-40de-944b-e07fc1f90ae7
          nullable: true
        photos:
          type: array
          items:
            type: string
            format: uri
          description: URLs of pet photos
          minItems: 0
        medicalInfo:
          type: object
          properties:
            spayedNeutered:
              type: boolean
              description: Whether the pet has been spayed or neutered
            vaccinated:
              type: boolean
              description: Whether the pet is up to date on vaccinations
            microchipped:
              type: boolean
              description: Whether the pet has a microchip
            specialNeeds:
              type: boolean
              description: Whether the pet has special medical needs
            healthNotes:
              type: string
              description: Additional medical notes
          unevaluatedProperties: false
      unevaluatedProperties: false
    Error:
      type: object
      description: RFC 9457 Problem Details for HTTP APIs
      required:
        - type
        - title
        - status
      properties:
        type:
          type: string
          format: uri
          description: A URI reference that identifies the problem type
          examples:
            - https://petstoreapi.com/errors/not-found
            - https://petstoreapi.com/errors/validation-error
        title:
          type: string
          description: A short, human-readable summary of the problem
          examples:
            - Resource Not Found
            - Validation Error
        status:
          type: integer
          description: The HTTP status code
          examples:
            - 404
            - 400
            - 422
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence
          examples:
            - The requested pet with ID '123' was not found
        instance:
          type: string
          format: uri
          description: A URI reference that identifies the specific occurrence
          examples:
            - /v1/pets/123
        errors:
          type: array
          description: Detailed validation errors (for 422 responses)
          items:
            type: object
            required:
              - field
              - message
            properties:
              field:
                type: string
                description: The field that failed validation
              message:
                type: string
                description: Description of the validation error
              code:
                type: string
                description: Machine-readable error code
            unevaluatedProperties: false
      unevaluatedProperties: false
  headers:
    RateLimit-Limit:
      description: The maximum number of requests allowed in the current time window
      schema:
        type: integer
      example: 100
    RateLimit-Remaining:
      description: The number of requests remaining in the current time window
      schema:
        type: integer
      example: 95
    RateLimit-Reset:
      description: The time at which the current rate limit window resets (Unix timestamp)
      schema:
        type: integer
      example: 1702648800
  responses:
    BadRequest:
      description: Bad request - Invalid parameters
      headers:
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            invalid-parameter:
              summary: Invalid query parameter
              value:
                type: https://petstoreapi.com/errors/bad-request
                title: Bad Request
                status: 400
                detail: >-
                  Invalid value for parameter 'status'. Must be one of:
                  available, pending, sold.
                instance: /pets
    Unauthorized:
      description: Unauthorized - Authentication required
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missing-token:
              summary: Missing authentication token
              value:
                type: https://petstoreapi.com/errors/unauthorized
                title: Unauthorized
                status: 401
                detail: >-
                  Authentication is required to access this resource. Please
                  provide a valid OAuth 2.0 token.
    UnprocessableEntity:
      description: Unprocessable entity - Validation errors
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            validation-errors:
              summary: Validation errors
              value:
                type: https://petstoreapi.com/errors/validation-error
                title: Validation Error
                status: 422
                detail: The request body contains validation errors.
                instance: /pets
                errors:
                  - field: name
                    message: Pet name is required
                    code: required_field
                  - field: status
                    message: Invalid status value
                    code: invalid_format
    TooManyRequests:
      description: Too many requests - Rate limit exceeded
      headers:
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          schema:
            type: integer
          example: 0
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        Retry-After:
          description: Number of seconds to wait before retrying
          schema:
            type: integer
          example: 60
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            rate-limit-exceeded:
              summary: Rate limit exceeded
              value:
                type: https://petstoreapi.com/errors/rate-limit-exceeded
                title: Too Many Requests
                status: 429
                detail: >-
                  Rate limit exceeded. Please wait 60 seconds before making
                  another request.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer token authentication using JWT (JSON Web Token). Include the
        token in the Authorization header as: `Authorization: Bearer <token>`
    oauth2:
      type: oauth2
      description: >-
        OAuth 2.0 authorization with multiple flows including device
        authorization for IoT devices and smart TVs
      flows:
        authorizationCode:
          authorizationUrl: https://auth.petstoreapi.com/authorize
          tokenUrl: https://auth.petstoreapi.com/token
          refreshUrl: https://auth.petstoreapi.com/refresh
          scopes:
            read:pets: Read pet information
            write:pets: Create and update pets
            read:orders: Read order information
            write:orders: Create and manage orders
            read:user: Read user profile
            write:user: Update user profile
            chat:write: Access AI chat completions

````