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

# Generate a presigned upload URL

> Returns a presigned S3 POST policy that lets you upload a single file directly to kelviq's storage bucket (max 5 GB, expires in 1 hour). Use the returned `fileKey` as the value of `imageKeys` / `fileKeys` on the catalog product/plan endpoints.

Upload flow:
1. `POST /media/` with `fileName` and `fileType`.
2. Build a `multipart/form-data` request and send every key/value from `fields` as a form field, plus a final `file` field containing the binary.
3. `POST` that form to the returned `url`. A `204 No Content` response means the upload succeeded.
4. Pass `fileKey` to the relevant catalog endpoint (e.g. `POST /catalog/products/` with `imageKeys: [fileKey]`).



## OpenAPI

````yaml /api-reference/openapi.json post /media/
openapi: 3.0.0
info:
  title: kelviq API
  version: 1.0.0
  description: >-
    API for interacting with kelviq services, derived from Python SDK
    documentation.
servers:
  - url: https://api.kelviq.com/api/v1
    description: kelviq API Server (General - specific operations might override)
security:
  - bearerAuth: []
tags:
  - name: Products
    description: Catalog products.
  - name: Product Settings
    description: Per-product settings (currency, VPN/Tor/proxy, product URL).
  - name: Product Files
    description: Product images and downloadable assets.
  - name: Features
    description: Catalog features that can be granted as plan entitlements.
  - name: Plans
    description: Catalog plans (CRUD, publish, versions, prices).
  - name: Plan Entitlements
    description: Feature entitlements attached to a plan.
  - name: Plan Files
    description: Files attached to plans, and signed download links.
  - name: Media
    description: Generate presigned S3 upload URLs for product/plan images and files.
  - name: Partner
    description: Partner integration APIs (organization provisioning, lookup).
  - name: Charges
    description: >-
      One-time payments charged immediately against a customer's default payment
      method.
paths:
  /media/:
    post:
      tags:
        - Media
      summary: Generate a presigned upload URL
      description: >-
        Returns a presigned S3 POST policy that lets you upload a single file
        directly to kelviq's storage bucket (max 5 GB, expires in 1 hour). Use
        the returned `fileKey` as the value of `imageKeys` / `fileKeys` on the
        catalog product/plan endpoints.


        Upload flow:

        1. `POST /media/` with `fileName` and `fileType`.

        2. Build a `multipart/form-data` request and send every key/value from
        `fields` as a form field, plus a final `file` field containing the
        binary.

        3. `POST` that form to the returned `url`. A `204 No Content` response
        means the upload succeeded.

        4. Pass `fileKey` to the relevant catalog endpoint (e.g. `POST
        /catalog/products/` with `imageKeys: [fileKey]`).
      operationId: createPresignedUploadUrl
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PresignedUploadRequest'
      responses:
        '200':
          description: Presigned upload URL generated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PresignedUploadResponse'
              example:
                url: https://kelviq-uploads.s3.amazonaws.com/
                fields:
                  Content-Type: image/png
                  key: >-
                    tmp/108713b0-1f81-42cf-a16c-c83b1d4d4148/web-app-manifest-512x512.png
                  AWSAccessKeyId: AKIA...
                  policy: >-
                    eyJleHBpcmF0aW9uIjogIjIwMjYtMDUtMjFUMTI6MDA6MDBaIiwgImNvbmRpdGlvbnMiOiBbXX0=
                  signature: bWFkZS11cC1zaWduYXR1cmU=
                fileKey: >-
                  tmp/108713b0-1f81-42cf-a16c-c83b1d4d4148/web-app-manifest-512x512.png
        '400':
          description: Missing `fileName` or `fileType` in the request body.
        '401':
          description: Unauthorized — missing or invalid API key
        '500':
          description: Could not generate upload URL.
      security:
        - bearerAuth: []
components:
  schemas:
    PresignedUploadRequest:
      type: object
      required:
        - fileName
        - fileType
      description: >-
        Request a presigned S3 POST policy for uploading a single file (max 5
        GB). The returned `fileKey` is a temporary `tmp/<uuid>/<fileName>` path
        that can be passed to product/plan endpoints via `imageKeys` /
        `fileKeys`.
      properties:
        fileName:
          type: string
          description: >-
            Name of the file being uploaded. Used as the suffix of the generated
            S3 object key.
          example: web-app-manifest-512x512.png
        fileType:
          type: string
          description: MIME type of the file. Enforced by the presigned policy on upload.
          example: image/png
      example:
        fileName: web-app-manifest-512x512.png
        fileType: image/png
    PresignedUploadResponse:
      type: object
      description: >-
        S3 presigned POST policy. Upload the file by sending a
        `multipart/form-data` POST to `url` with every key in `fields` as a form
        field, plus a final `file` field containing the binary. The returned
        `fileKey` is what you pass back to kelviq.
      properties:
        url:
          type: string
          format: uri
          description: S3 endpoint to POST the upload to.
          example: https://kelviq-uploads.s3.amazonaws.com/
        fields:
          type: object
          description: >-
            Form fields to include in the `multipart/form-data` POST (policy,
            signature, content-type, etc.). Send every field exactly as
            provided.
          additionalProperties:
            type: string
          example:
            Content-Type: image/png
            key: >-
              tmp/108713b0-1f81-42cf-a16c-c83b1d4d4148/web-app-manifest-512x512.png
            AWSAccessKeyId: AKIA...
            policy: >-
              eyJleHBpcmF0aW9uIjogIjIwMjYtMDUtMjFUMTI6MDA6MDBaIiwgImNvbmRpdGlvbnMiOiBbXX0=
            signature: bWFkZS11cC1zaWduYXR1cmU=
        fileKey:
          type: string
          description: >-
            Temporary S3 key for the uploaded object. Pass this back to kelviq
            via `imageKeys` / `fileKeys` on the relevant catalog endpoint.
          example: >-
            tmp/108713b0-1f81-42cf-a16c-c83b1d4d4148/web-app-manifest-512x512.png
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        The Server API Key obtained from the kelviq application. Pass as a
        Bearer token in the Authorization header. Example: 'Authorization:
        Bearer __YOUR_API_KEY__'

````