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

# Create a size-limited TOS upload grant

> Upload with multipart/form-data POST, include every returned upload_fields entry, and put the file field last. TOS enforces the signed size limit: 10 MiB for image content types, 100 MiB otherwise. The grant expires after six hours. Finish uploading before referencing file_id or upload_fields.key in generation input. Upload success does not guarantee model compatibility; generation validates media type, dimensions, duration and model-specific limits.



## OpenAPI

````yaml /api-reference/openapi.json post /files
openapi: 3.1.0
info:
  title: CreatOK API
  version: 1.1.0
  description: >-
    Asynchronous media generation API. Authenticate with a Bearer organization
    API key (cok_). Personal CLI/MCP keys are not accepted. Resource responses
    are returned directly, without a code/data envelope. Each response includes
    X-Request-Id.
servers:
  - url: https://api.creatok.ai/v1
security: []
paths:
  /files:
    post:
      summary: Create a size-limited TOS upload grant
      description: >-
        Upload with multipart/form-data POST, include every returned
        upload_fields entry, and put the file field last. TOS enforces the
        signed size limit: 10 MiB for image content types, 100 MiB otherwise.
        The grant expires after six hours. Finish uploading before referencing
        file_id or upload_fields.key in generation input. Upload success does
        not guarantee model compatibility; generation validates media type,
        dimensions, duration and model-specific limits.
      operationId: createFileUpload
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileUploadRequest'
      responses:
        '200':
          description: A signed TOS POST upload form and its object identifier.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUpload'
        '400':
          description: Request failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Request failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Request failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKey: []
components:
  schemas:
    FileUploadRequest:
      $schema: https://json-schema.org/draft/2020-12/schema
      type: object
      properties:
        content_type:
          type: string
          maxLength: 128
          pattern: ^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$
        size:
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        filename:
          type: string
          minLength: 1
          maxLength: 255
      required:
        - content_type
        - size
        - filename
      additionalProperties: false
    FileUpload:
      $schema: https://json-schema.org/draft/2020-12/schema
      type: object
      properties:
        object:
          type: string
          const: file_upload
        file_id:
          type: string
        upload_url:
          type: string
          format: uri
        upload_fields:
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: string
        expires_at:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
      required:
        - object
        - file_id
        - upload_url
        - upload_fields
        - expires_at
      additionalProperties: false
    Error:
      $schema: https://json-schema.org/draft/2020-12/schema
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
            code:
              type: string
            message:
              type: string
            param:
              type: string
            request_id:
              type: string
          required:
            - type
            - code
            - message
            - request_id
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: CreatOK organization API key

````

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