Upload an attachment
const url = 'https://api.engram.page/attachments';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"content_base64":"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==","mime_type":"image/png","path":"assets/diagram.png"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.engram.page/attachments \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "content_base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==", "mime_type": "image/png", "path": "assets/diagram.png" }'Uploads an attachment to the vault’s storage backend. Send the raw bytes as application/octet-stream with path, mtime and optional mime_type in the query string, or (legacy) base64 JSON. Attachments are a paid-tier feature (402 on Free, which is also limited to text MIME types), the MIME type and extension must pass the whitelist (415), the file must be within the per-plan size and total-quota limits (402), a raw body over the request ceiling returns 413, a raw body that stalls returns 408, a non-numeric mtime or mime_type returns 422, and a storage backend failure returns 502.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Vault-relative path. Required for an octet-stream body.
File mtime in seconds (octet-stream body).
MIME override; detected from the extension when absent (octet-stream body).
Request Bodyrequired
Section titled “Request Bodyrequired”Attachment bytes
object
Base64-encoded file bytes.
Detected from path if omitted.
Example
{ "content_base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==", "mime_type": "image/png", "path": "assets/diagram.png"}Responses
Section titled “Responses”Uploaded
object
object
Opaque content fingerprint. Stable for identical bytes and scoped to the owning account. Compare against a local copy to decide whether an upload is needed; re-uploading matching bytes is accepted but does no work.
Client mtime (epoch seconds)
Example
{ "attachment": { "path": "assets/diagram.png" }}Invalid base64
object
Example
{ "error": "not found"}Attachments require a paid plan / quota
Raw body stalled before it finished
object
Example
{ "error": "not found"}Raw body over the request ceiling
object
Example
{ "error": "not found"}MIME or extension not allowed
object
Example
{ "error": "mime_not_allowed"}Missing/invalid content
object
Example
{ "error": "not found"}Storage backend failure
object
Example
{ "error": "not found"}