Finalize a document upload
Completes a reserved document after you send the bytes, and is the third of the three steps of an upload. 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: a file over 25 MB, or of a type this API does not accept, is refused here and discarded. Until it succeeds, the Document is in no listing and in no read.
/context/brands/{slug}/documents/{documentId}/finalizeAuthorizationBearer token · headerrequiredSend Authorization: Bearer <credential>.
Use an API key (acr_…), from the AdCrunch console under Settings → API keys.
The credential names the organization, and no operation takes an organization parameter.
See https://docs.adcrunch.dev/api/authentication.
documentIdstringrequiredslugstringrequiredThe Document, now readable. sizeBytes and mimeType are read off the stored object rather than taken from your declaration. name is the display name, and it falls back to the filename. url is public: anybody holding it can read the file.
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.
urlstringrequiredThe request does not match the schema of this operation: a field is missing or has the wrong type, or the body is not valid JSON. error is invalid_request, and issues names each field. Nothing was changed.
issuesobject[]requiredOne entry for each field that does not match.
Show propertiesHide properties
objectinstringrequiredThe part of the request that holds the field.
bodycookieheadersparamsquerymessagestringrequiredA sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.
pathstringrequiredA JSON Pointer into that part of the request, such as /filename. An empty string is the whole part.
errorstringrequiredA stable code for the failure. This is the field to branch on. It does not change for a given failure.
invalid_requestmessagestringrequiredA 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 API key, or one that does not resolve. 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, the message names what the object turned out to be, and the object has been discarded. Reserve again to retry.
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.