Finalize a document upload
Completes a reserved document after you send the bytes. AdCrunch reads the size and the content type from the stored file. It does not take them from you, because the upload URL applies no rules of its own. This call is the only point of validation.
/context/brands/{slug}/documents/{documentId}/finalizeAuthorizationBearer token · headerrequiredSend Authorization: Bearer <credential>. Two credentials work.
An API key (acr_…) is what a server integration uses. Create one in the AdCrunch console under Settings → API keys — see https://docs.adcrunch.dev/account/api-keys. A key is bound to the organization that was active when you created it, and it keeps acting on that organization whatever you do later. It carries the permissions of the member who created it.
A session issued by the AdCrunch sign-in flow also works, which is how the console calls this service from the browser.
Either way the organization comes from the credential. There is no organization parameter.
documentIdstringrequiredslugstringrequiredThe Document, now readable. sizeBytes and mimeType are read off the stored object rather than taken from your declaration.
createdAtnumberrequiredMilliseconds since the Unix epoch, UTC.
filenamestringrequiredidstringrequiredmimeTypestringrequirednamestringrequiredThe display name. Falls back to the filename.
sizeBytesnumberrequiredRead off the stored object at finalize, never from the client.
targetIdstringrequiredtargetTypestringrequiredWhat the Document is attached to. brand today.
urlstringrequiredNo credential, or one that does not resolve. Send an API key or a session. See the security scheme. error is unauthorized.
errorstringrequiredA stable code for the failure. This is the field to branch on. It does not change for a given failure.
unauthorizedmessagestringrequiredA sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.
The caller does not hold brand:write. error is forbidden.
errorstringrequiredA stable code for the failure. This is the field to branch on. It does not change for a given failure.
forbiddenmessagestringrequiredA sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.
No reservation with that id on this Brand. error is not_found.
errorstringrequiredA stable code for the failure. This is the field to branch on. It does not change for a given failure.
messagestringrequiredA sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.
The reservation exists but no bytes have arrived. error is no_object. PUT to the uploadUrl first.
errorstringrequiredA stable code for the failure. This is the field to branch on. It does not change for a given failure.
messagestringrequiredA sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.
The stored object is over the limit. error is too_large.
limitBytesnumberrequiredsizeBytesnumberrequiredWhat the stored object actually measured.
errorstringrequiredA stable code for the failure. This is the field to branch on. It does not change for a given failure.
too_largemessagestringrequiredA sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.
The stored object is not an accepted type, whatever was declared at reservation. error is unsupported_type, and the object has been discarded.
allowedstring[]requiredEvery media type this API accepts as a Document.
errorstringrequiredA stable code for the failure. This is the field to branch on. It does not change for a given failure.
unsupported_typemessagestringrequiredA sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.