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

# Add a cover, screenshot or clip, and get where to upload it

> Send its kind, type, SHA-256 and size. Upload the bytes to the returned URL with exactly its headers, then complete it. A cover replaces the project's cover once it's ready. Images (PNG, JPEG, WebP, GIF) are at most 10 MB; clips (MP4, WebM) at most 200 MB.



## OpenAPI

````yaml /api-reference/openapi.json post /projects/{owner}/{slug}/media
openapi: 3.1.0
info:
  title: Patch API
  version: 1.0.0
  description: >-
    The public API behind patch.gg, the desktop app and pch. Changes within v1
    are additive only. Errors are { error: { code, message, details } }; branch
    on code.
servers:
  - url: https://patch.gg/api/v1
security: []
paths:
  /projects/{owner}/{slug}/media:
    post:
      tags:
        - Media
      summary: Add a cover, screenshot or clip, and get where to upload it
      description: >-
        Send its kind, type, SHA-256 and size. Upload the bytes to the returned
        URL with exactly its headers, then complete it. A cover replaces the
        project's cover once it's ready. Images (PNG, JPEG, WebP, GIF) are at
        most 10 MB; clips (MP4, WebM) at most 200 MB.
      parameters:
        - schema:
            type: string
            example: patch
          required: true
          name: owner
          in: path
        - schema:
            type: string
            example: demo-mod
          required: true
          name: slug
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                kind:
                  type: string
                  enum:
                    - cover
                    - screenshot
                    - clip
                content_type:
                  type: string
                  example: image/png
                sha256:
                  type: string
                size:
                  type: integer
                alt:
                  type: string
                  maxLength: 300
                  description: What it shows
                width:
                  type: integer
                  minimum: 1
                  maximum: 16384
                height:
                  type: integer
                  minimum: 1
                  maximum: 16384
              required:
                - kind
                - content_type
                - sha256
                - size
      responses:
        '201':
          description: The media, and where to upload it
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MediaUpload'
        '308':
          description: Renamed; follow the Location header
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Not signed in
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Not allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearer: []
components:
  schemas:
    MediaUpload:
      type: object
      properties:
        media:
          $ref: '#/components/schemas/Media'
        upload:
          type:
            - object
            - 'null'
          properties:
            method:
              type: string
              enum:
                - PUT
            url:
              type: string
            headers:
              type: object
              additionalProperties:
                type: string
              description: Send exactly these headers
            expires_at:
              type: string
          required:
            - method
            - url
            - headers
            - expires_at
          description: 'Null when Patch already has these bytes: the media is ready'
      required:
        - media
        - upload
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: version_exists
            message:
              type: string
            details: {}
          required:
            - code
            - message
      required:
        - error
    Media:
      type: object
      properties:
        id:
          type: string
          format: uuid
        kind:
          type: string
          enum:
            - cover
            - screenshot
            - clip
        status:
          type: string
          enum:
            - pending
            - ready
          description: >-
            pending until the upload is completed; only the project's managers
            see it
        url:
          type: string
          description: Where it's served from, once it's ready
        content_type:
          type: string
        sha256:
          type: string
        size:
          type: integer
        width:
          type:
            - integer
            - 'null'
        height:
          type:
            - integer
            - 'null'
        alt:
          type:
            - string
            - 'null'
        position:
          type: integer
          description: Order among media of the same kind
        created_at:
          type: string
      required:
        - id
        - kind
        - status
        - url
        - content_type
        - sha256
        - size
        - width
        - height
        - alt
        - position
        - created_at
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: An API key (pch_...) or the token from pch login.

````

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