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

# Create an inbound file upload

> Classifies one source-delivered file from its declared metadata and leading bytes, then returns the message block and, when the object is absent, a short-lived conditional PUT grant. A readable image the agent's model accepts becomes an image block; every other file becomes a file block. Send exactly the declared size and every returned header unchanged. The URL is a bearer and must not be logged, persisted, or shared. Repeating the request for an already stored object returns the same block without an upload grant.



## OpenAPI

````yaml /openapi/platform.v1.json post /v1/agents/{agentId}/files
openapi: 3.0.3
info:
  description: Public platform API for catalog and proxied data-plane routes.
  title: Matrices Platform API
  version: v1
servers:
  - url: https://api.matrices.com
security: []
tags:
  - description: Authenticated bearer credential context.
    name: auth
    x-group: Auth
  - description: Write-only provider credentials with safe connection metadata.
    name: connections
    x-group: Connections
  - description: Materialized workspace principals and active agent counts.
    name: identities
    x-group: Identities
  - description: Remote MCP server registrations.
    name: toolsets
    x-group: Toolsets
  - description: Named allow-only agent tool permissions.
    name: roles
    x-group: Roles
  - description: Client-executed tool calls.
    name: tools
    x-group: Tools
  - description: Reusable agent behavior profiles.
    name: profiles
    x-group: Profiles
  - description: Workspace-owned agent identities.
    name: agents
    x-group: Agents
  - description: Durable inbound file uploads.
    name: files
    x-group: Files
  - description: Immutable private image inputs.
    name: images
    x-group: Images
  - description: Public model catalog.
    name: models
    x-group: Models
  - description: Running agent threads.
    name: threads
    x-group: Threads
  - description: Agent schedules.
    name: schedules
    x-group: Schedules
  - description: Workspace append-only feeds.
    name: feeds
    x-group: Feeds
  - description: Agent subscriptions over workspace feeds.
    name: subscriptions
    x-group: Subscriptions
  - description: Workspace and identity-scoped skill bundles.
    name: plugins
    x-group: Plugins
  - description: Agent-private and workspace-shared durable memory notes.
    name: memory
    x-group: Memory
  - description: Thread messages.
    name: messages
    x-group: Messages
  - description: Thread event log data.
    name: events
    x-group: Events
  - description: Runtime hook audit and wait resolution.
    name: hooks
    x-group: Hooks
paths:
  /v1/agents/{agentId}/files:
    post:
      tags:
        - files
      summary: Create an inbound file upload
      description: >-
        Classifies one source-delivered file from its declared metadata and
        leading bytes, then returns the message block and, when the object is
        absent, a short-lived conditional PUT grant. A readable image the
        agent's model accepts becomes an image block; every other file becomes a
        file block. Send exactly the declared size and every returned header
        unchanged. The URL is a bearer and must not be logged, persisted, or
        shared. Repeating the request for an already stored object returns the
        same block without an upload grant.
      operationId: CreateFileUpload
      parameters:
        - $ref: '#/components/parameters/AgentID'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileUploadRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadResponse'
          description: File block resolved and direct upload grant created when needed.
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '502':
          $ref: '#/components/responses/RuntimeUpstreamError'
        '503':
          $ref: '#/components/responses/RuntimeUnavailable'
      security:
        - APIKeyBearer: []
components:
  parameters:
    AgentID:
      in: path
      name: agentId
      required: true
      schema:
        type: string
  schemas:
    FileUploadRequest:
      additionalProperties: false
      properties:
        contentType:
          minLength: 3
          type: string
        head:
          description: Base64 of exactly the first min(size, 512) bytes.
          format: byte
          maxLength: 684
          type: string
        id:
          maxLength: 128
          minLength: 1
          type: string
        name:
          description: >-
            Source file name. The runtime derives the stored name from it, so it
            may be empty.
          type: string
        size:
          format: int64
          maximum: 26214400
          minimum: 1
          type: integer
        source:
          $ref: '#/components/schemas/FileSource'
      required:
        - source
        - id
        - contentType
        - size
        - head
      type: object
    FileUploadResponse:
      additionalProperties: false
      properties:
        block:
          $ref: '#/components/schemas/MessageContentBlock'
        upload:
          $ref: '#/components/schemas/FileUploadGrant'
      required:
        - block
      type: object
    FileSource:
      enum:
        - slack
        - gmail
        - drive
        - api
      type: string
    MessageContentBlock:
      discriminator:
        mapping:
          file: '#/components/schemas/MessageFileContentBlock'
          image: '#/components/schemas/MessageImageContentBlock'
          text: '#/components/schemas/MessageTextContentBlock'
        propertyName: type
      oneOf:
        - $ref: '#/components/schemas/MessageTextContentBlock'
        - $ref: '#/components/schemas/MessageImageContentBlock'
        - $ref: '#/components/schemas/MessageFileContentBlock'
    FileUploadGrant:
      additionalProperties: false
      properties:
        expiresAt:
          format: date-time
          type: string
        headers:
          $ref: '#/components/schemas/FileUploadHeaders'
        url:
          description: Short-lived upload bearer. Do not log, persist, or share it.
          format: uri
          type: string
      required:
        - url
        - headers
        - expiresAt
      type: object
    ErrorResponse:
      properties:
        attemptsRemaining:
          type: integer
        code:
          type: string
        error:
          type: string
        message:
          type: string
        retryAfterSeconds:
          type: integer
      required:
        - error
        - message
      type: object
    MessageFileContentBlock:
      additionalProperties: false
      properties:
        file:
          $ref: '#/components/schemas/FileRef'
        type:
          enum:
            - file
          type: string
      required:
        - type
        - file
      type: object
    MessageImageContentBlock:
      additionalProperties: false
      properties:
        imageId:
          $ref: '#/components/schemas/ImageID'
        type:
          enum:
            - image
          type: string
      required:
        - type
        - imageId
      type: object
    MessageTextContentBlock:
      additionalProperties: false
      properties:
        text:
          description: >-
            Non-blank UTF-8 text. User messages permit at most 8 KiB total text;
            assistant messages permit 64 KiB.
          minLength: 1
          pattern: \S
          type: string
        type:
          enum:
            - text
          type: string
      required:
        - type
        - text
      type: object
    FileUploadHeaders:
      additionalProperties: false
      properties:
        contentType:
          type: string
        ifNoneMatch:
          enum:
            - '*'
          type: string
      required:
        - contentType
        - ifNoneMatch
      type: object
    FileRef:
      additionalProperties: false
      properties:
        contentType:
          minLength: 3
          type: string
        key:
          maxLength: 512
          minLength: 1
          pattern: ^[A-Za-z0-9._/-]+$
          type: string
        name:
          maxLength: 255
          minLength: 1
          type: string
        namespace:
          enum:
            - agent
            - workspace
          type: string
        size:
          format: int64
          maximum: 26214400
          minimum: 1
          type: integer
      required:
        - namespace
        - key
        - name
        - contentType
        - size
      type: object
    ImageID:
      description: Opaque identifier for one immutable private image.
      maxLength: 68
      minLength: 68
      pattern: ^img_[0-9a-f]{64}$
      type: string
  responses:
    BadRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: Invalid request.
    NotFound:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: Resource not found.
    PayloadTooLarge:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: Request payload is too large.
    RuntimeUpstreamError:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: Runtime environment returned an upstream error.
    RuntimeUnavailable:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: Runtime environment is unavailable or cannot be selected.
  securitySchemes:
    APIKeyBearer:
      scheme: bearer
      type: http

````

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