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

# Upload an image

> Stores one PNG, JPEG, GIF or WebP image from exactly one of url (up to 10485760 bytes) or data, and returns its id and CDN URL. The type is read from the bytes. Limited to 30 uploads per shop per rolling minute.



## OpenAPI

````yaml /openapi.json post /dev/v1/media
openapi: 3.0.3
info:
  title: Shoppex Developer API
  description: Mintlify-compatible Developer API reference for Shoppex.
  version: 1.0.0
  contact:
    name: Shoppex Support
    email: support@shoppex.io
    url: https://shoppex.io
servers:
  - url: https://api.shoppex.io
security:
  - bearerAuth: []
paths:
  /dev/v1/media:
    post:
      tags:
        - Media
      summary: Upload an image
      description: >-
        Stores one PNG, JPEG, GIF or WebP image from exactly one of url (up to
        10485760 bytes) or data, and returns its id and CDN URL. The type is
        read from the bytes. Limited to 30 uploads per shop per rolling minute.
      operationId: postDevV1Media
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  description: >-
                    Public https URL of the image. Fetched once, server side;
                    private and local addresses are refused, also after a
                    redirect.
                  maxLength: 2048
                data:
                  type: string
                  description: >-
                    Base64 image bytes (no data: prefix), up to 1048576 bytes
                    decoded. Send larger images by url.
                  maxLength: 1398104
                filename:
                  type: string
                  description: Original file name, kept for the media library.
                  minLength: 1
                  maxLength: 255
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                url:
                  type: string
                  description: >-
                    Public https URL of the image. Fetched once, server side;
                    private and local addresses are refused, also after a
                    redirect.
                  maxLength: 2048
                data:
                  type: string
                  description: >-
                    Base64 image bytes (no data: prefix), up to 1048576 bytes
                    decoded. Send larger images by url.
                  maxLength: 1398104
                filename:
                  type: string
                  description: Original file name, kept for the media library.
                  minLength: 1
                  maxLength: 255
          multipart/form-data:
            schema:
              type: object
              properties:
                url:
                  type: string
                  description: >-
                    Public https URL of the image. Fetched once, server side;
                    private and local addresses are refused, also after a
                    redirect.
                  maxLength: 2048
                data:
                  type: string
                  description: >-
                    Base64 image bytes (no data: prefix), up to 1048576 bytes
                    decoded. Send larger images by url.
                  maxLength: 1398104
                filename:
                  type: string
                  description: Original file name, kept for the media library.
                  minLength: 1
                  maxLength: 255
      responses:
        '201':
          description: Response for status 201
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - id
                      - url
                      - mime_type
                      - size
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: >-
                          Image id; pass it in image_ids on a product create or
                          update.
                      url:
                        type: string
                        description: Public CDN URL of the image.
                      mime_type:
                        type: string
                        description: >-
                          Type read from the image bytes, not from a header or
                          file name.
                        enum:
                          - image/png
                          - image/jpeg
                          - image/gif
                          - image/webp
                      size:
                        type: integer
                        description: Stored size in bytes.
                        minimum: 1
                additionalProperties: true
        '401':
          description: Response for status 401
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
        '403':
          description: Response for status 403
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
        '409':
          description: Response for status 409
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
        '422':
          description: Response for status 422
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
        '429':
          description: Response for status 429
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
        '500':
          description: Response for status 500
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
        '503':
          description: Response for status 503
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - doc_url
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      doc_url:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          required:
                            - field
                            - message
                          properties:
                            field:
                              type: string
                            message:
                              type: string
                          additionalProperties: true
                      subcode:
                        type: string
                    additionalProperties: true
                additionalProperties: true
      deprecated: false
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Use your Shoppex API key in the Authorization header.

````

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