Complete a chunked upload
const url = 'https://api.engram.page/attachment-uploads/example/complete';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"base_hash":"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"}'};
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/example/complete \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "base_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" }'Assembles the parts into a live attachment and answers like POST /api/attachments. Returns 409 missing_parts (with the part numbers) while any part is missing, the session staying resumable, and 402 attachments_quota_exceeded when the file no longer fits the quota, the session then being dropped. Safe to retry: once committed, a repeat complete returns the same attachment (404 if it was since deleted or overwritten). An optional base_hash makes the commit compare-and-swap, as on POST /api/attachments: a stale one returns 409 version_conflict, the session staying open so a complete with the current hash commits it without re-uploading.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Upload id
Request Body
Section titled “Request Body”Optional compare-and-swap guard
object
The content_hash you last read for this attachment. If it changed since, the write returns 409 version_conflict instead of overwriting.
Example
{ "base_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"}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" }}Quota exceeded
No such upload
missing_parts, or version_conflict on a stale base_hash
object
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
{ "error": "missing_parts"}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"}