# Upload Image

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /openapi/v2/image/upload:
    post:
      summary: Upload Image
      deprecated: false
      description: >-
        Upload an image using multipart/form-data. Supported formats: JPEG, PNG,
        and WebP; the file must be smaller than 20 MB, with neither dimension
        exceeding 10,000 pixels.


        Provide either a local image file or an image URL, not both. Replace the
        example URL with a publicly accessible image URL before sending the
        request.
      operationId: image_upload
      tags:
        - API /Preparation
        - Preparation
      parameters:
        - name: API-KEY
          in: header
          description: Your PixVerse API key.
          required: true
          example: your-api-key
          schema:
            type: string
        - name: Ai-trace-id
          in: header
          description: A unique UUID for this request.
          required: true
          example: 550e8400-e29b-41d4-a716-446655440000
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  description: >-
                    Local image file. Provide either image or image_url, not
                    both.
                  format: binary
                  examples:
                    - ''
                  example: ''
                image_url:
                  type: string
                  description: >-
                    Public image URL. Provide either image_url or image, not
                    both. The URL must return image/jpeg, image/jpg, image/png,
                    or image/webp; application/octet-stream is not supported.
                  format: uri
                  examples:
                    - https://example.com/media.mp4
                  example: https://example.com/image.png
            examples: {}
      responses:
        '200':
          x-apidog-name: OK
          x-apidog-ordering: 0
          description: Successful response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ErrCode:
                    type: integer
                  ErrMsg:
                    type: string
                  Resp:
                    type: object
                    properties:
                      img_id:
                        type: integer
                        description: Uploaded image ID used by generation APIs.
                        format: int64
                        minimum: 1
                        examples:
                          - 123456789
                      img_url:
                        type: string
                        description: Uploaded image URL.
                        format: uri
                        examples:
                          - https://example.com/image.png
                    required:
                      - img_id
                      - img_url
                    x-apidog-orders:
                      - img_id
                      - img_url
                    nullable: true
                required:
                  - ErrCode
                  - ErrMsg
                x-apidog-orders:
                  - ErrCode
                  - ErrMsg
                  - Resp
              examples:
                success:
                  summary: Image upload response
                  value:
                    ErrCode: 0
                    ErrMsg: Success
                    Resp:
                      img_id: 123456789
                      img_url: https://example.com/image.png
          headers: {}
        '400':
          x-apidog-name: Bad Request
          x-apidog-ordering: 1
          description: >-
            Invalid request. Preserve the response and trace ID for
            troubleshooting.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ErrCode:
                    type: integer
                  ErrMsg:
                    type: string
                required:
                  - ErrCode
                  - ErrMsg
                x-apidog-orders:
                  - ErrCode
                  - ErrMsg
          headers: {}
        '401':
          x-apidog-ordering: 2
          description: Authentication failure. Use a key from the global environment.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ErrCode:
                    type: integer
                  ErrMsg:
                    type: string
                required:
                  - ErrCode
                  - ErrMsg
                x-apidog-orders:
                  - ErrCode
                  - ErrMsg
          headers: {}
          x-apidog-name: ''
      security: []
      x-apidog-folder: API /Preparation
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/772214/apis/api-13016631-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://app-api.pixverse.ai
    description: Prod Env
security: []

```
