Skip to Content
aiMermaid
APIReference

Upload a file (step 1 of 3, or the only step for text)

Also available in Swagger.

This calls the live API and changes your real projects.
POST
/v1/projects/{id}/attachments

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):

ExtensionKindContent-TypeMax size
.txttexttext/plain500.0 KB
.mdmarkdowntext/markdown500.0 KB
.mmdmermaidtext/plain500.0 KB
.mermaidmermaidtext/plain500.0 KB
.pngimageimage/png5.0 MB
.jpgimageimage/jpeg5.0 MB
.jpegimageimage/jpeg5.0 MB
.pdfpdfapplication/pdf10.0 MB
.mp3audioaudio/mpeg25.0 MB
.m4aaudioaudio/mp425.0 MB
.wavaudioaudio/wav25.0 MB
.oggaudioaudio/ogg25.0 MB
.webmaudioaudio/webm25.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.

Authorization

bearer
headerAuthorizationBearer <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.

Path Parameters

id*string
Formatuuid

Request Body

application/json
  1. body
name*string

File name with its real extension, e.g. "call.mp3".

Lengthlength <= 100
size?integer

Exact size in bytes (images, PDF, audio). Omit when sending text.

Range1 <= value
text?string

The whole content of a text file (max 500 KB, UTF-8). Omit for images, PDF and audio.

Response Body

OK

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"}'
Example Response
Empty