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

# Upload File in Chunks

> Send a file inline as small base64 chunks, assembled server-side. This exists for clients that can reach neither the S3 host nor the relay — prefer Initiate Upload everywhere else.

Omit `upload_id` on the first chunk; the response mints one to thread through the rest. Set `is_last_part` on the final chunk. Chunks may arrive out of order; the upload completes when every index from 0 to the last is present, and the response then carries `file_url`. Limits: 1 MiB decoded per chunk, 50 MiB per upload, 10,000 parts, and abandoned parts are discarded after an hour.

`expected_decoded_bytes` is the truncation guard: a mismatch rejects that chunk alone, so resend only that `part_index`.



## OpenAPI

````yaml /platform-openapi.json post /storage/upload/chunk
openapi: 3.1.0
info:
  title: ModelRunner Platform API
  version: 1.0.0
  description: >-
    Platform APIs: model catalog, search and collections; model pricing rate
    cards; the Serverless GPU catalog and deployment templates; file uploads and
    your asset library; account balance and usage; and webhook delivery
    management. Catalog reads are public; account-scoped routes authenticate
    with your API key (`Authorization: Key <MODELRUNNER_KEY>`). Request
    lifecycle endpoints (submit/status/result and the request list) live on the
    queue host — see the Queue API reference.
servers:
  - url: https://api.modelrunner.run
security: []
paths:
  /storage/upload/chunk:
    post:
      summary: Upload File in Chunks
      description: >-
        Send a file inline as small base64 chunks, assembled server-side. This
        exists for clients that can reach neither the S3 host nor the relay —
        prefer Initiate Upload everywhere else.


        Omit `upload_id` on the first chunk; the response mints one to thread
        through the rest. Set `is_last_part` on the final chunk. Chunks may
        arrive out of order; the upload completes when every index from 0 to the
        last is present, and the response then carries `file_url`. Limits: 1 MiB
        decoded per chunk, 50 MiB per upload, 10,000 parts, and abandoned parts
        are discarded after an hour.


        `expected_decoded_bytes` is the truncation guard: a mismatch rejects
        that chunk alone, so resend only that `part_index`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - part_index
                - is_last_part
                - base64
                - file_name
                - expected_decoded_bytes
              properties:
                upload_id:
                  type: string
                  description: >-
                    Omit on the first chunk; echo the minted value on every
                    later chunk.
                part_index:
                  type: integer
                  minimum: 0
                is_last_part:
                  type: boolean
                  description: Exactly one chunk may set this.
                base64:
                  type: string
                  description: >-
                    This chunk's bytes, base64-encoded. ~32–48 KB per chunk
                    works well.
                file_name:
                  type: string
                content_type:
                  type: string
                  description: Defaults to `application/octet-stream`.
                expected_decoded_bytes:
                  type: integer
                  minimum: 1
                  description: Decoded byte length of this chunk.
                sha256:
                  type: string
                  description: Optional hex SHA-256 of this chunk's decoded bytes.
                file_sha256:
                  type: string
                  description: >-
                    Optional hex SHA-256 of the whole assembled file, checked at
                    completion.
      responses:
        '200':
          description: Chunk stored, or upload completed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  upload_id:
                    type: string
                  received_parts:
                    type: array
                    items:
                      type: integer
                    description: Indices held so far.
                  missing_parts:
                    type: array
                    items:
                      type: integer
                    description: Present once the final part has been seen and gaps remain.
                  file_url:
                    type: string
                    description: Present only on the chunk that completes the upload.
        '400':
          description: >-
            Chunk failed validation — length mismatch, hash mismatch, or a cap
            exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
        request_id:
          type: string
          description: Correlation id for support.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Use the format: Key modelrunner_key'

````