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

# Upload a file

> Request an upload for a file of any type up to 5 GB, with its SHA-256. Post the file to `upload_url` with `upload_fields` before `expires_at`, then confirm it with `POST /v1/files/{id}/confirm`. Storage refuses bytes that do not match `sha256`, files are private, and buyers always download them as attachments.



## OpenAPI

````yaml post /v1/files
openapi: 3.0.0
info:
  title: Creem API
  description: >-
    Creem is an all-in-one platform for managing subscriptions and recurring
    revenue, tailored specifically for today's SaaS companies. It enables you to
    boost revenue, enhance customer retention, and scale your operations
    seamlessly.
  version: v1
  contact:
    name: Creem Support
    url: https://creem.io
    email: support@creem.io
  license:
    name: Commercial
    url: https://creem.io/terms
  termsOfService: https://creem.io/terms
servers:
  - url: https://api.creem.io
    description: Production — live API for processing real transactions and data.
    x-speakeasy-server-id: prod
  - url: https://test-api.creem.io
    description: Test — sandbox API for development and testing with no real charges.
    x-speakeasy-server-id: test
security: []
tags: []
externalDocs:
  description: Creem Documentation
  url: https://docs.creem.io
paths:
  /v1/files:
    post:
      tags:
        - Files
      summary: Upload a file
      description: >-
        Request an upload for a file of any type up to 5 GB, with its SHA-256.
        Post the file to `upload_url` with `upload_fields` before `expires_at`,
        then confirm it with `POST /v1/files/{id}/confirm`. Storage refuses
        bytes that do not match `sha256`, files are private, and buyers always
        download them as attachments.
      operationId: createFileUpload
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFileUploadRequestEntity'
      responses:
        '200':
          description: Where and until when to upload the file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadEntity'
        '400':
          description: >-
            Invalid input, for example a file over 5 GB, or `dry_run` sent (code
            `dry_run_not_supported`)
        '401':
          description: Unauthorized - Invalid or missing API key
        '404':
          description: Not Found - Resource does not exist
      security:
        - ApiKey: []
components:
  schemas:
    CreateFileUploadRequestEntity:
      type: object
      properties:
        purpose:
          type: string
          description: >-
            What the file is for. `product_file`: a file a product delivers to
            its buyers.
          enum:
            - product_file
          example: product_file
        filename:
          type: string
          description: >-
            The name buyers download the file under. Path segments and control
            characters are removed, and it is cut to 255 bytes of UTF-8.
          example: ebook.epub
          maxLength: 1024
        content_type:
          type: string
          description: >-
            The media type of the file, without parameters. Any type is
            accepted; the file is not inspected, and it always downloads rather
            than opens in the browser. The upload must send the same
            `Content-Type`.
          example: application/epub+zip
          maxLength: 255
        size:
          type: integer
          description: >-
            The size of the file in bytes, at most 5 GB (5368709120 bytes). The
            upload must be exactly this size.
          example: 52000
          format: int64
          minimum: 1
          maximum: 5368709120
        sha256:
          type: string
          description: >-
            The SHA-256 of the file, base64-encoded (44 characters). Storage
            refuses bytes that hash to anything else, and the confirmed file
            returns it as `sha256`.
          example: n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=
      required:
        - purpose
        - filename
        - content_type
        - size
        - sha256
    FileUploadEntity:
      type: object
      properties:
        id:
          type: string
          description: >-
            The id of the upload. Confirm it with `POST /v1/files/{id}/confirm`;
            the file keeps this id once confirmed.
          example: file_4dGTkmBdnTnU9vV3KZ2Hcz
        upload_url:
          type: string
          description: >-
            Where to upload the file: a `multipart/form-data` POST with every
            `upload_fields` entry first and the file last, in a field named
            `file`.
          example: https://creem-files.s3.eu-west-1.amazonaws.com/
        upload_fields:
          type: object
          description: >-
            The form fields to send with the upload, unchanged and before the
            file.
          additionalProperties:
            type: string
          example:
            key: store/sto_1/0b6f2c1e-ebook.epub
            Content-Type: application/epub+zip
        expires_at:
          type: string
          description: >-
            When the upload expires (ISO 8601). Upload and confirm the file
            before then.
          example: '2026-11-17T11:00:00.000Z'
          format: date-time
      required:
        - id
        - upload_url
        - upload_fields
        - expires_at
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. You can find your API key in the Creem
        dashboard under Settings > API Keys.

````

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