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

# Upload File

> Upload a file once and get back a `file_*` reference id you can reuse across generations.

The same reference can be passed to realtime `set_image` as `image_ref`, avoiding a re-upload of the underlying bytes on every call.



## OpenAPI

````yaml /openapi.json post /v1/files
openapi: 3.1.0
info:
  title: Decart API
  version: 1.0.0
servers: []
security: []
paths:
  /v1/files:
    post:
      summary: Upload File
      description: >-
        Upload a file once and get back a `file_*` reference id you can reuse
        across generations.


        The same reference can be passed to realtime `set_image` as `image_ref`,
        avoiding a re-upload of the underlying bytes on every call.
      operationId: upload_file_v1_files_post
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
            description: API key for authentication
            title: X-Api-Key
          description: API key for authentication
        - name: User-Agent
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: User-Agent
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_file_v1_files_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileReferenceResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_upload_file_v1_files_post:
      properties:
        file:
          type: string
          contentMediaType: application/octet-stream
          format: binary
          title: File
          description: File to upload
        ttl_seconds:
          anyOf:
            - type: string
            - type: 'null'
          title: Ttl Seconds
          description: >-
            TTL in seconds (60..2_592_000), or "persistent" for no expiry. Omit
            for the platform default (24h).
      type: object
      required:
        - file
      title: Body_upload_file_v1_files_post
    FileReferenceResponse:
      properties:
        id:
          type: string
          title: Id
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
        mime_type:
          type: string
          title: Mime Type
        size_bytes:
          type: integer
          title: Size Bytes
        created_at:
          type: string
          format: date-time
          title: Created At
        expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Expires At
      type: object
      required:
        - id
        - filename
        - mime_type
        - size_bytes
        - created_at
        - expires_at
      title: FileReferenceResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````