document_finalize
Complete a document upload once the bytes have landed — size and type are read from the stored file, not from what you declared.
Completes a document upload after you’ve PUT the bytes to the URL from document_create_upload. Until you call this, the file is invisible — reserved, but not attached to anything.
Input
| Field | Type | Required | Description |
|---|---|---|---|
document_id |
string |
yes | The id returned when you reserved the upload. |
Output
The finished document: { id, name, filename, mimeType, sizeBytes, url }.
What actually gets checked
Size and content type are read from the stored file, never from what you declared when reserving. An upload URL carries no policy — nothing could have stopped you sending something else, or more of it — so this is the only point where what landed is really known.
That means finalize can reject a file the upload itself accepted:
- wrong type — what arrived isn’t a PDF or an accepted image, whatever you declared when reserving. The file is discarded, not kept.
- too large — over 25 MB. Also discarded.
- nothing there — the bytes haven’t arrived yet. Finish the
PUTand retry.
Safe to retry
Finalizing an already-finalized document just returns it again. If you’re unsure whether a call landed, call it again rather than re-uploading.
Requires the brand:write scope.