Documents

Start a document upload

Reserves a document on a Brand, and is the first of the three steps of an upload. The answer gives a URL with a short life. PUT the bytes to that URL with their Content-Type, then call finalize. The bytes do not go through this API. AdCrunch accepts PDF, GIF, JPEG, PNG and WebP. It refuses SVG, because a stored document is served from an adcrunch.dev host and an SVG carries script.

post/context/brands/{slug}/documents

Request

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

Path parameters

slugstring required

Request body

content_typestring required

The type you are about to upload. Re-checked against the stored object at finalize — this is only a declaration.

filenamestring required

Example request

{
  "content_type": "application/pdf",
  "filename": "acme-brand-guidelines.pdf"
}

Response

A reserved destination, valid for expiresInSeconds. PUT the bytes to uploadUrl, then call finalize with documentId. The URL itself gives write access: anybody holding it can write that one object until it lapses. The Document does not exist for any reader until finalize succeeds.

documentIdstring required

Pass this to the finalize call.

expiresInSecondsnumber required

How long uploadUrl stays valid. Reserve again if it lapses.

uploadUrlstring required

A short-lived presigned URL. PUT the bytes here.

Example response

{
  "documentId": "doc_5e2b41",
  "expiresInSeconds": 900,
  "uploadUrl": "https://a1b2c3d4e5f6.r2.cloudflarestorage.com/documents/org_3a7f10/doc_5e2b41?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900&X-Amz-Signature=8f1c…"
}

Changes

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