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

# Sending files

> Attach files to a run and reference them from the input.

## How it works

You send files inline as base64 in the create request. The API delivers them to the agent's
workspace **before** it processes `input_text`, so the input can reference them by filename
("Summarize report.pdf"). The API strips path components from filenames, so don't rely on
directories.

## Limits

Each request can include up to **10 files** with a combined decoded size of **10 MiB**. The
limit applies to the decoded bytes. Base64 inflates the JSON body by about a third, so the
request is larger than the files themselves.

## Encoding

Use standard base64 with padding. The API validates it strictly, so don't include MIME line
wrapping or newlines. In Python, `base64.b64encode(...)` produces the right output; in a
shell, use `base64 -w0`.

The samples below use the base URL `https://app.us.goclicks.ai/v1`.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://app.us.goclicks.ai/v1/agents \
    -H "Authorization: Bearer $CLICKS_API_KEY" \
    -H "Content-Type: application/json" \
    -d "{
      \"name\": \"Report summary\",
      \"template_id\": \"<your-agent-template-id>\",
      \"input_text\": \"Summarize report.pdf in three bullet points.\",
      \"files\": [{
        \"filename\": \"report.pdf\",
        \"content_base64\": \"$(base64 -w0 report.pdf)\"
      }]
    }"
  ```

  ```python Python theme={null}
  import base64, os, requests

  with open("report.pdf", "rb") as f:
      content = base64.b64encode(f.read()).decode("ascii")

  resp = requests.post(
      "https://app.us.goclicks.ai/v1/agents",
      headers={"Authorization": f"Bearer {os.environ['CLICKS_API_KEY']}"},
      json={
          "name": "Report summary",
          "template_id": "<your-agent-template-id>",
          "input_text": "Summarize report.pdf in three bullet points.",
          "files": [{"filename": "report.pdf", "content_base64": content}],
      },
  )
  resp.raise_for_status()
  ```
</CodeGroup>

<Warning>
  **When file uploads fail.** If the decoded size exceeds 10 MiB, the API returns `413`. If the base64 is invalid, it
  returns `422` and names the file. If you send more than 10 files or omit a required field,
  it returns `422` in FastAPI's validation format. Each status is covered in
  [Errors and retries](/api/errors).
</Warning>
