Upload a file (step 1 of 3, or the only step for text)
Also available in Swagger.
Text files (.txt, .md, .mmd, .mermaid): send {name, text} and the file is checked and stored at once (status: ready). Images, PDF and audio: send {name, size}; the answer holds a signed upload.url. PUT the raw bytes there (no API key, only upload.headers), then call complete within 15 minutes. Until complete has checked the real bytes the file is in quarantine: it cannot be attached or downloaded. Then attach it with the add_attachment operation in a batch.
Walkthrough: see x-examples.attach_a_file in this spec.
Accepted files (the same list as attachments.accepted in GET /v1/capabilities):
| Extension | Kind | Content-Type | Max size |
|---|---|---|---|
| .txt | text | text/plain | 500.0 KB |
| .md | markdown | text/markdown | 500.0 KB |
| .mmd | mermaid | text/plain | 500.0 KB |
| .mermaid | mermaid | text/plain | 500.0 KB |
| .png | image | image/png | 5.0 MB |
| .jpg | image | image/jpeg | 5.0 MB |
| .jpeg | image | image/jpeg | 5.0 MB |
| application/pdf | 10.0 MB | ||
| .mp3 | audio | audio/mpeg | 25.0 MB |
| .m4a | audio | audio/mp4 | 25.0 MB |
| .wav | audio | audio/wav | 25.0 MB |
| .ogg | audio | audio/ogg | 25.0 MB |
| .webm | audio | audio/webm | 25.0 MB |
A project holds at most 200 files and 100.0 MB of attachments; your plan's account storage counts too. The type comes from the extension and is checked against the real bytes: a renamed file is refused. Text files must be UTF-8 and pass the content rules (no hidden characters, no instructions to an AI, no scripts). Credits: 5.
bearerAuthorizationBearer <token>An API key: amk_live__. A key can have an expiry date chosen when it is created (1 hour to 90 days, or none). After that moment the API answers 401 unauthorized, as for a revoked key. Create a new key or rotate the expired one (rotation keeps the same lifetime). A key can also be limited to one folder (with its subfolders) or one project: anything else answers 404 not_found, and a project key cannot create projects or use folders (403 insufficient_scope). A folder key creates projects and folders inside its folder. If that folder or project is deleted for good, the key answers 403 target_gone.
id*stringuuidapplication/json- body
name*stringFile name with its real extension, e.g. "call.mp3".
length <= 100size?integerExact size in bytes (images, PDF, audio). Omit when sending text.
1 <= valuetext?stringThe whole content of a text file (max 500 KB, UTF-8). Omit for images, PDF and audio.
curl -X POST 'https://pltlaavsvbpebaopfbsp.supabase.co/functions/v1/api/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/attachments' \ -H 'Content-Type: application/json' \ -d '{ "name": "interview-notes.md", "text": "# Interview\n- Budget approved in Q3\n- Decision maker: CFO"}'