Start a chunked attachment upload
const url = 'https://api.engram.page/attachment-uploads';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"mime_type":"video/mp4","mtime":1709234567,"path":"videos/clip.mp4","size_bytes":52428800}'};
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/attachment-uploads \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "mime_type": "video/mp4", "mtime": 1709234567, "path": "videos/clip.mp4", "size_bytes": 52428800 }'Opens a resumable upload for a file of size_bytes, refused up front with the same responses as POST /api/attachments (402 plan, size or quota, 415 executable extension, 422 invalid mime_type). The user’s other open sessions count against the quota at their declared sizes, at most 4 may be open (429 too_many_uploads), and a file over 10,000 parts is 402 file_too_large on every plan. Then PUT each part and complete. A storage backend without multipart support (self-host database storage) returns 501.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”File to upload
object
Detected from path if omitted.
Example
videos/clip.mp4Total file size.
Example
{ "mime_type": "video/mp4", "mtime": 1709234567, "path": "videos/clip.mp4", "size_bytes": 52428800}Responses
Section titled “Responses”Session opened
object
Example
{ "part_size": 8388608}Attachments require a paid plan / quota
Executable extension not allowed
object
Example
{ "error": "extension_not_allowed", "extension": ".exe"}Missing size or path, or invalid mime_type
too_many_uploads: the user already holds the maximum open sessions (4); retry after retry-after seconds, once one completes or is aborted
Storage backend has no multipart support
object
Stable machine-readable reason, where one is defined.
Example
{ "code": "blob_missing", "error": "not found"}Storage backend failure
object
Stable machine-readable reason, where one is defined.
Example
{ "code": "blob_missing", "error": "not found"}rotation_in_progress: an encryption key rotation holds the account; retry after retry-after seconds.
object
Stable machine-readable reason, where one is defined.
Example
{ "code": "blob_missing", "error": "not found"}