> ## 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.

# Upload Pet Image

> Upload an image for the specified pet. Requires authentication and write:pets permission.



## OpenAPI

````yaml api-reference/modern-petstore-3.1.openapi.json post /pets/{id}/images
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/{id}/images:
    post:
      tags:
        - Pet
      summary: Upload Pet Image
      description: >-
        Upload an image for the specified pet. Requires authentication and
        write:pets permission.
      operationId: uploadPetPhoto
      parameters:
        - name: id
          in: path
          description: Unique identifier for the pet
          required: true
          example: 01936c8f-1234-7000-8000-111111111111
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                additionalMetadata:
                  description: Additional data to pass to server
                  type: string
                  example: ''
                file:
                  description: File to upload
                  type: string
                  format: binary
                  example: ''
            examples: {}
      responses:
        '201':
          description: Operation successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
              example:
                code: 3
                type: ex dolor
                message: Pecus carcer cometes credo.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      deprecated: false
      security:
        - bearerAuth: []
        - oauth2:
            - write:pets
components:
  schemas:
    ApiResponse:
      type: object
      description: Generic API response
      properties:
        message:
          type: string
          description: Human-readable message
        success:
          type: boolean
          description: Whether the operation was successful
      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
  responses:
    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.
    NotFound:
      description: Resource not found
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            pet-not-found:
              summary: Pet not found
              value:
                type: https://petstoreapi.com/errors/not-found
                title: Not Found
                status: 404
                detail: The requested pet with ID '123' was not found.
                instance: /pets/123
  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

````