Skip to content
AdCrunch
Esc
navigateopen⌘Jpreview

Start a document upload

Reserves a document on a Brand. The answer gives a URL with a short life. Send the bytes to that URL, then call finalize. The bytes do not go through this API.

POST/context/brands/{slug}/documents/
Authorization
AuthorizationBearer token · headerrequired

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

Path parameters
slugstringrequired
Request body
requiredapplication/json
content_typestringrequired

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

filenamestringrequired
min length 1 · max length 255
Responses
201

A reserved destination. PUT the bytes to uploadUrl, then call finalize with documentId. The Document does not exist for any reader until finalize succeeds.

documentIdstringrequired

Pass this to the finalize call.

expiresInSecondsnumberrequired

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

uploadUrlstringrequired

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

401

No credential, or one that does not resolve. Send an API key or a session. See the security scheme. error is unauthorized.

errorstringrequired

A stable code for the failure. This is the field to branch on. It does not change for a given failure.

Allowed:unauthorized
messagestringrequired

A sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.

403

The caller does not hold brand:write. error is forbidden.

errorstringrequired

A stable code for the failure. This is the field to branch on. It does not change for a given failure.

Allowed:forbidden
messagestringrequired

A sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.

404

No Brand with that slug. error is not_found.

errorstringrequired

A stable code for the failure. This is the field to branch on. It does not change for a given failure.

messagestringrequired

A sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.

415

That media type is not accepted. error is unsupported_type, and allowed names every type that is. This is the declared type; the stored object is checked again at finalize.

allowedstring[]required

Every media type this API accepts as a Document.

errorstringrequired

A stable code for the failure. This is the field to branch on. It does not change for a given failure.

Allowed:unsupported_type
messagestringrequired

A sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.

Request
curl -X POST "https://api.adcrunch.dev/context/brands/string/documents/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "content_type": "string",
  "filename": "string"
}'
Response
{
  "documentId": "string",
  "expiresInSeconds": 0,
  "uploadUrl": "string"
}