Skip to content
AdCrunch
Esc
↑↓navigate↵open⌘Jpreview

Add a Variation

Adds a Variation to a Creative: one rendition of the idea, which holds exactly one Asset. The Asset must be ready. One Asset can be in many Creatives, but in one live Variation of each Creative only.

A Variation has no name, no placement and no format. The width, height and durationMs of its Asset give its dimensions.

POST/library/creatives/{creativeId}/variations
Authorization
AuthorizationBearer token · headerrequired

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

Path parameters
creativeIdstringrequired

The Creative id.

matches ^(crv_)[\s\S]{0,}$
Request body
requiredapplication/json
assetIdstringrequired

The Asset that the Variation holds. It must be ready, and of your organization.

matches ^(ast_)[\s\S]{0,}$
Responses
201

The new Variation, with its Asset.

assetobjectrequired
Show properties
contentHashstringrequired

AdCrunch’s own hash of the stored bytes. A hint for de-duplication, never an identity, and never a provider’s hash. Empty when the store reports none.

createdAtnumberrequired

Milliseconds since the Unix epoch, UTC.

createdBystringrequired

The user who reserved the upload.

deletedAtnumber | nullrequired

Always null here. A deleted Asset is not answered.

durationMsnumber | nullrequired

How long the video runs, in milliseconds, read from the header of the file at finalize. null for an image. For a video, null when the file does not state it, or for an Asset uploaded before AdCrunch read it.

failureCodestring | nullrequired

Why AdCrunch refused the file, as a code. Branch on this field, never on failureReason. unsupported_type: the bytes are not an accepted image or video. too_large: the file is over the size limit. unreadable: AdCrunch could not read the header of the file. source_unreachable: an import could not fetch the file from its source URL. source_length_unknown: the source of an import sent no Content-Length. null unless status is failed.

failureReasonstring | nullrequired

Why AdCrunch refused the file, as a sentence. null unless status is failed.

filenamestringrequired

The name the file was uploaded under. Never a lookup key.

heightnumber | nullrequired

The height in pixels as the file is displayed, with its rotation applied, read from the header of the file at finalize. null when the file does not state it, or for an Asset uploaded before AdCrunch read it.

idstringrequired

The id of the Asset, ast_….

keystringrequired

Where the bytes are held. Read-only, and never sent by you.

kindstringrequired

Follows from mimeType. It selects how a provider takes the file.

Allowed:imagevideo
mimeTypestringrequired

The type that finalize identified from the stored bytes. The Content-Type of the upload does not set it.

namestring | nullrequired

The name a person gave this Asset, and what a provider receives at a future registration. null until somebody renames it, and the filename is the fallback.

organizationIdstringrequired

The organization that owns the Asset.

sizeBytesnumberrequired

Read from the stored object at finalize.

statusstringrequired

ready once AdCrunch has inspected the bytes. Only a ready Asset can be registered. pending: the bytes have not been inspected yet. failed: AdCrunch refused the file and deleted it. failureCode and failureReason say why. A read answers an Asset in every status. A list answers ready Assets only.

Allowed:pendingreadyfailed
updatedAtnumber | nullrequired

When the Asset last changed, in milliseconds since the Unix epoch, UTC: at finalize, or at the last rename.

widthnumber | nullrequired

The width in pixels as the file is displayed, with its rotation applied, read from the header of the file at finalize. null when the file does not state it, or for an Asset uploaded before AdCrunch read it.

assetIdstringrequired

The id of the Asset that the Variation holds, ast_…. asset is that Asset. Its width, height and durationMs give the dimensions of the Variation.

createdAtnumberrequired

Milliseconds since the Unix epoch, UTC.

createdBystringrequired

The user who added the Variation.

creativeIdstringrequired

The Creative that the Variation belongs to, crv_….

deletedAtnumber | nullrequired

Always null here. A removed Variation is not answered.

idstringrequired

The id of the Variation, var_….

organizationIdstringrequired

The organization that owns the Creative.

updatedAtnumber | nullrequired

Always null here. A Variation has no update: to use another Asset, remove the Variation and add a new one.

400

The 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[]required

One entry for each field that does not match.

Show properties
Array of object
instringrequired

The part of the request that holds the field.

Allowed:bodycookieheadersparamsquery
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.

pathstringrequired

A JSON Pointer into that part of the request, such as /filename. An empty string is the whole part.

errorstringrequired

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

Allowed:invalid_request
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.

401

No API key, or one that does not resolve. 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.

402

The organization has no active subscription. An owner subscribes at paywallUrl. error is organization_unentitled.

paywallUrlstring<uri>required

The page where an owner of the organization subscribes. Show it to the person.

errorstringrequired

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

Allowed:organization_unentitled
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 library: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 Creative with that id, or no stored Asset with that assetId, in this organization. A deleted Asset answers this too. 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.

409

The Asset cannot go in this Creative now. error says why. asset_not_ready: the Asset is still pending. asset_failed: AdCrunch refused the file. variation_exists: a Variation of this Creative already holds this Asset.

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.

Request
curl -X POST 'https://api.pr-1317.adcrunch.dev/library/creatives/string/variations' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "assetId": "ast_7c1e9a"
}'
Response
{
  "asset": {
    "contentHash": "9d2f41b7c6e8a35014f7b2d9c3e6a810",
    "createdAt": 1790000000000,
    "createdBy": "usr_2e5b84",
    "deletedAt": null,
    "durationMs": 15000,
    "failureCode": null,
    "failureReason": null,
    "filename": "spring-sale.mp4",
    "height": 1920,
    "id": "ast_7c1e9a",
    "key": "org_3a7f10/ast_7c1e9a",
    "kind": "video",
    "mimeType": "video/mp4",
    "name": "Spring sale 9:16",
    "organizationId": "org_3a7f10",
    "sizeBytes": 24117248,
    "status": "ready",
    "updatedAt": 1790000120000,
    "width": 1080
  },
  "assetId": "ast_7c1e9a",
  "createdAt": 1790000360000,
  "createdBy": "usr_2e5b84",
  "creativeId": "crv_5e2a19",
  "deletedAt": null,
  "id": "var_8c3f60",
  "organizationId": "org_3a7f10",
  "updatedAt": null
}

Was this page helpful?