kb_attachments_import
Save the actual bytes of a user-provided file reference as a downloadable document attachment. Pass the host-provided file object; the server downloads its public HTTPS URL with a bounded transfer and validates the bytes. Never invent a URL or substitute a description for the file. If the chat host cannot provide a downloadable reference, say so; a client holding local bytes can use kb_attachments_begin_upload. Optional expected_sha256 checks integrity without returning a hash. Returns attachment_uuid; embed for an image or label for a file. Active downloadable attachments remain until explicitly archived. Temporary source URLs and provider file IDs are not retained.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | Actual host-provided file reference, not file contents or a local path. MIME is advisory; the server sniffs the bytes. | |
| filename | No | Override the stored filename; required if the host omits file_name. | |
| 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. | |
| expected_sha256 | No | Optional independently computed checksum. A mismatch is refused before storage; no checksum is returned. | |
| include_download_url | No | Default false. Mint a short-lived (~5 minutes) Brainattic download capability only when needed to fetch the original bytes. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attachment | Yes |