kb_attachments_upload
Upload a small file you already hold as text or bytes, up to 64 KiB. Supply exactly one of content_text or content_base64. Never invent file bytes or write out base64 for a photo or a file shown in chat. Use kb_attachments_import for a real downloadable file reference, or kb_attachments_begin_upload for a client that can transfer local bytes directly. When neither is available, give the user the document permalink, ask them to open it and use Attach, then call kb_attachments_list. The web file limit is deployment-configured; an inline refusal states the live limit. Returns attachment_uuid: embed as or label. Unreferenced inline uploads are eventually swept; active downloadable uploads remain until explicitly archived.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | Original filename including extension | |
| mime_type | Yes | MIME type (server-side sniffed and validated) | |
| document_id | Yes | Document to attach the file to | |
| tenant_slug | No | Tenant slug to target. Required when your token grants several workspaces; omit when it grants one. If you omit it with several, the refusal names your default workspace; call kb_tenants_list to see every workspace the token grants. | |
| content_text | No | UTF-8 text you already hold, at most 64 KiB encoded (CSV, Markdown, JSON, plain text). | |
| content_base64 | No | Base64 of a small binary you already hold as bytes, at most 64 KiB decoded. For photos or user files use import or a direct upload session. | |
| include_download_url | No | Mint a short-lived Brainattic download capability for the original uploaded bytes (default false). The capability is unauthenticated and valid for about 5 minutes — anyone who obtains it can fetch the file — so ask for it only when you will download the bytes. To embed the attachment in a document, use attachment_uuid instead. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attachment | Yes |