Documents

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.

post/context/brands/{slug}/documents/{documentId}/finalize

Request

  • Base URL: https://api.adcrunch.dev
  • URL: https://api.adcrunch.dev/context/brands/{slug}/documents/{documentId}/finalize
  • Auth: HTTP bearer

Path parameters

documentIdstring required
slugstring required

Response

The 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.

createdAtnumber required

Milliseconds since the Unix epoch, UTC.

filenamestring required
idstring required
mimeTypestring required
namestring required

The display name. Falls back to the filename.

sizeBytesnumber required

Read off the stored object at finalize, never from the client.

targetIdstring required
targetTypestring required

What the Document is attached to. brand today.

urlstring required

Example response

{
  "createdAt": 1790000000000,
  "filename": "acme-brand-guidelines.pdf",
  "id": "doc_5e2b41",
  "mimeType": "application/pdf",
  "name": "acme-brand-guidelines.pdf",
  "sizeBytes": 1482064,
  "targetId": "brd_6a9c33",
  "targetType": "brand",
  "url": "https://documents.adcrunch.dev/org_3a7f10/doc_5e2b41"
}

Changes

No recorded changes to this operation across all 1 revision of this API.