Upload an attachment (base64 JSON)
POST
/attachments
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 supplied as base64 JSON to the vault’s storage backend. 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), and a storage backend failure returns 502.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Attachment bytes
Media typeapplication/json
UploadAttachmentRequest
object
content_base64
required
Base64-encoded file bytes.
string
mime_type
Detected from path if omitted.
string
path
required
string
Example
{ "content_base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==", "mime_type": "image/png", "path": "assets/diagram.png"}Responses
Section titled “Responses”Uploaded
Media typeapplication/json
AttachmentResponse
object
attachment
required
AttachmentMeta
object
created_at
string format: date-time
id
string format: uuid
mime_type
string
mtime
Client mtime (epoch seconds)
number format: float
path
required
string
size_bytes
integer
updated_at
string format: date-time
Example
{ "attachment": { "path": "assets/diagram.png" }}Invalid base64
Media typeapplication/json
MessageError
object
error
required
string
Example
{ "error": "not found"}Attachments require a paid plan / quota
MIME or extension not allowed
Media typeapplication/json
MimeRejected
object
error
required
string
extension
string
mime_type
string
Example
{ "error": "mime_not_allowed"}Missing/invalid content
Media typeapplication/json
MessageError
object
error
required
string
Example
{ "error": "not found"}Storage backend failure
Media typeapplication/json
MessageError
object
error
required
string
Example
{ "error": "not found"}