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

# Attach an input file

> Attaches one file to the agent's input files — the same files the app's agent form manages under "Files". Every run lists the agent's input files in its prompt and can download them, so this is how to hand an agent a mapping table, a prior statement, or any reference material. Send `multipart/form-data` with a single `file` part; call once per file. Limits match the app: 50 MB per file, 20 files per agent, any content type (JSON is fine as an input). A file whose name matches an existing input file is added as a second file, not a replacement — delete the old one first to replace it.



## OpenAPI

````yaml /openapi.json post /agents/{id}/files
openapi: 3.1.0
info:
  title: End Close API
  description: REST API is used to interact with the End Close platform.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.endclose.com/v1
security:
  - ApiKeyAuth: []
paths:
  /agents/{id}/files:
    post:
      summary: Attach an input file
      description: >-
        Attaches one file to the agent's input files — the same files the app's
        agent form manages under "Files". Every run lists the agent's input
        files in its prompt and can download them, so this is how to hand an
        agent a mapping table, a prior statement, or any reference material.
        Send `multipart/form-data` with a single `file` part; call once per
        file. Limits match the app: 50 MB per file, 20 files per agent, any
        content type (JSON is fine as an input). A file whose name matches an
        existing input file is added as a second file, not a replacement —
        delete the old one first to replace it.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: The unique identifier of the agent
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: The file to attach (at most 50 MB)
      responses:
        '201':
          description: File attached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentFile'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden — agent management requires a standard API key
        '404':
          description: Agent not found
        '422':
          description: >-
            No `file` part, file over 50 MB, or the agent already has 20 input
            files
components:
  schemas:
    AgentFile:
      type: object
      description: >-
        A file attached to an agent (input) or produced by a run (output). `url`
        is an absolute, signed download link on the API host; input files can
        also be fetched with `GET /agents/{id}/files/{file_id}`.
      properties:
        id:
          type: string
          format: uuid
        filename:
          type: string
        byte_size:
          type: integer
        content_type:
          type: string
        created_at:
          type: string
          format: date-time
        url:
          type: string
          description: >-
            Absolute signed download URL on the API host (e.g.
            `https://api.endclose.com/rails/active_storage/blobs/redirect/...`).
            Fetching it needs no credentials; it 302s to a short-lived
            object-storage URL.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````

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