Skip to content

Upload an attachment (base64 JSON)

POST
/attachments
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.

Attachment bytes

Media typeapplication/json
UploadAttachmentRequest
object
content_base64
required

Base64-encoded file bytes.

string
mime_type

Detected from path if omitted.

string
nullable
path
required
string
Example
{
"content_base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"mime_type": "image/png",
"path": "assets/diagram.png"
}

Uploaded

Media typeapplication/json
AttachmentResponse
object
attachment
required
AttachmentMeta
object
created_at
string format: date-time
nullable
id
string format: uuid
nullable
mime_type
string
nullable
mtime

Client mtime (epoch seconds)

number format: float
path
required
string
size_bytes
integer
updated_at
string format: date-time
nullable
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

Media typeapplication/json
LimitError
object
current
integer
nullable
error
required
string
limit
One of:
integer
limit_key
string
nullable
reason
required
string
tier
string
nullable
upgrade_url
string
nullable
Example
{
"error": "limit_exceeded",
"limit_key": "vaults_cap",
"reason": "vaults_cap_exceeded",
"tier": "free"
}

MIME or extension not allowed

Media typeapplication/json
MimeRejected
object
error
required
string
extension
string
nullable
mime_type
string
nullable
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"
}