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

# Upload Supporting Document

> Attach a supporting document (base64) to a business profile.

Attaches a supporting document (registration letter, EIN letter, etc.) to a business profile. Documents are uploaded base64-encoded and stored in private storage. Allowed types: **PDF, JPEG, PNG, WEBP**, up to **3 MB** each. Requires a **live** key.

## Path Parameters

<ParamField path="profile_id" type="string" required>
  The business profile's id.
</ParamField>

## Body Parameters

<ParamField body="data" type="string" required>
  The document, base64-encoded as a **single line** (strip any newlines your encoder adds — see the cURL example). The type is inferred from the file's magic bytes and must resolve to an allowed type.
</ParamField>

<ParamField body="filename" type="string">
  Optional display filename (max 255 chars).
</ParamField>

## Examples

<RequestExample>
  <CodeGroup>
    ```bash cURL theme={null}
    # Build the JSON body in a file (avoids the shell command-length limit a
    # multi-MB base64 string would hit, and guarantees single-line base64).
    python3 -c 'import base64,json; open("payload.json","w").write(json.dumps({"filename":"ein.pdf","data":base64.b64encode(open("ein.pdf","rb").read()).decode()}))'

    curl -X POST "https://api.tracklysms.com/api/v2/business-profiles/664a1b2c3d4e5f6071829300/documents" \
      -H "X-Api-Key: trk_your_api_key_here" \
      -H "Content-Type: application/json" \
      -d @payload.json
    ```

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

    with open("ein.pdf", "rb") as f:
        data = base64.b64encode(f.read()).decode()

    resp = requests.post(
        "https://api.tracklysms.com/api/v2/business-profiles/664a1b2c3d4e5f6071829300/documents",
        headers={"X-Api-Key": "trk_your_api_key_here"},
        json={"filename": "ein.pdf", "data": data},
    )
    print(resp.json()["document"]["id"])
    ```
  </CodeGroup>
</RequestExample>

<ResponseExample>
  ```json 201 — Uploaded theme={null}
  {
    "document": {
      "id": "9f2c4a1e7b8d4c3f",
      "filename": "ein.pdf",
      "contentType": "application/pdf",
      "size": 20481,
      "uploadedAt": "2026-07-26T12:10:00Z"
    }
  }
  ```
</ResponseExample>

## Error Codes

| HTTP Status | Error Code                  | Description                                |
| ----------- | --------------------------- | ------------------------------------------ |
| 400         | `missing_data`              | `data` (base64) is required.               |
| 400         | `invalid_base64`            | `data` is not valid base64.                |
| 400         | `empty_document`            | The decoded document is empty.             |
| 400         | `unsupported_document_type` | Not a PDF/JPEG/PNG/WEBP (by magic bytes).  |
| 403         | `sandbox_read_only`         | Sandbox keys cannot upload documents.      |
| 404         | `not_found`                 | No such profile on your account.           |
| 413         | `document_too_large`        | The document exceeds 3 MB.                 |
| 503         | `storage_unavailable`       | Storage is temporarily unavailable; retry. |

## Next Steps

<CardGroup cols={2}>
  <Card title="List documents" icon="list" href="/api-reference/v2/business-profiles/list-documents">
    See the profile's attached documents.
  </Card>

  <Card title="Lifecycle" icon="arrows-rotate" href="/api-reference/v2/business-profiles/lifecycle">
    How verification proceeds.
  </Card>
</CardGroup>
