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

# UploadFile

> Upload an existing file to Macro from base64-encoded bytes, up to 25 MiB decoded.

# UploadFile

Upload an existing file to Macro from base64-encoded bytes, up to 25 MiB decoded. Use for PDFs, images, Office files, and other files; use CreateDocument for generated text or native Macro spreadsheets. Encode actual file bytes programmatically; never invent or transcribe binary content. Returns a document ID after the bytes are uploaded; preview and indexing may finish asynchronously. Does not read local paths or fetch URLs.

## Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `fileName` | string | Yes | Filename including its extension, for example report.pdf. Do not include a directory path. |
| `contentBase64` | string | Yes | Standard padded base64 of the exact file bytes (maximum 25 MiB decoded). No data URL prefix or whitespace. Prefer constructing this argument programmatically from the file. |
| `projectId` | string | No | Optional destination project (folder) ID. Requires edit access. Omit to upload to the user's top-level files. |


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