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

# Upload a reference image

> Uploads a PNG, JPEG or WebP image (up to 20 MB) to use as a reference when generating images
or videos. Returns an `image_id` to pass in `reference_image_ids` (or as a video start/end frame).
Requires a valid `X-API-KEY` header.

Throws:
- 400 if the file is not a PNG, JPEG or WebP image, or its dimensions are too large
- 413 if the file is larger than 20 MB



## OpenAPI

````yaml POST /image/upload
openapi: 3.1.0
info:
  title: Wondercraft Public API
  version: 0.0.1
servers:
  - url: https://api.wondercraft.ai/v1
    description: Base Wondercraft API
security: []
paths:
  /image/upload:
    post:
      tags:
        - Images
      summary: Upload a reference image
      description: >-
        Uploads a PNG, JPEG or WebP image (up to 20 MB) to use as a reference
        when generating images

        or videos. Returns an `image_id` to pass in `reference_image_ids` (or as
        a video start/end frame).

        Requires a valid `X-API-KEY` header.


        Throws:

        - 400 if the file is not a PNG, JPEG or WebP image, or its dimensions
        are too large

        - 413 if the file is larger than 20 MB
      operationId: upload_image_image_upload_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_image_image_upload_post'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadImageResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    Body_upload_image_image_upload_post:
      properties:
        image:
          type: string
          format: binary
          title: Image
          description: PNG, JPEG or WebP image, up to 20 MB
      type: object
      required:
        - image
      title: Body_upload_image_image_upload_post
    UploadImageResponse:
      properties:
        image_id:
          type: string
          format: uuid
          title: Image Id
          description: Pass this ID in `reference_image_ids` when generating
        width:
          type: integer
          title: Width
          description: Image width in pixels
        height:
          type: integer
          title: Height
          description: Image height in pixels
      type: object
      required:
        - image_id
        - width
        - height
      title: UploadImageResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-KEY

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.