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

# Media upload reference

> Tenant-scoped upload sessions, source-rights declarations, completion, and ingestion handoff.

The chat attachment flow is implemented in `src/lib/chatAttachments.ts` and the routes below.

| Route                                      | Purpose                                              |
| ------------------------------------------ | ---------------------------------------------------- |
| `POST /api/chat/attachments/session`       | Create an authenticated tenant-scoped upload session |
| `GET /api/chat/attachments/{id}`           | Read attachment state within the tenant              |
| `POST /api/chat/attachments/{id}/complete` | Finalize uploaded metadata and storage identity      |

An attachment records its identity, filename, MIME type, storage URI, lifecycle state, and ownership scope. A content job may reference `mediaAttachmentId`, but ingestion proceeds only after completion and a valid source-rights authorization defined by `src/lib/sourceRights.ts`.

Uploaded bytes belong in the configured asset store. The browser does not mint workflow authority, and a filename or MIME declaration is not proof of rights or content integrity.
