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

Add a Creative to a Campaign Plan

Puts a Creative of the Library into the pool of a Campaign Plan. A Campaign Plan holds a pool of Creatives of the Library, at most 50. Each Line Item of the plan picks its Creatives from the pool, at most 20. The ads of a Line Item are built from the Creatives of that Line Item only. A Creative of the pool that no Line Item uses is not assigned yet.

Adding a Creative that is in the pool already changes nothing. A Creative with no Variation is valid. The Creative is not on a Line Item after this call: add it to a Line Item with POST /campaign-plans/{slug}/line-items/{lineItemId}/creatives. The call does not change the revision or the status of the Campaign Plan or of a Line Item. A validated Line Item stays validated.

POST/context/campaign-plans/{slug}/creatives
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
slugstringrequired
Request body
requiredapplication/json
creativeIdstringrequired

The id of a Creative in the Library of your organization, crv_…. List the Creatives with GET /library/creatives.

matches ^crv_[\s\S]{0,}$
Responses
200

The Creatives of the pool after the call, oldest first, each with the Line Items that use it.

creativesobject[]required

The Creatives of the pool after the call, oldest first, at most 50. A Creative that the Library deleted is not listed.

Show properties
Array of object
idstringrequired

The id of the Creative in the Library, crv_….

namestring | nullrequired

The name of the Creative, or null when nobody named it.

variationCountnumberrequired

The number of Variations of the Creative. Read them with GET /library/creatives/{creativeId}.

firstVariationsobject[]required

The first three live Variations of the Creative, newest first, as the Creative list of the Library gives them, each with its Asset and the thumbnailUrl of the Asset. Fewer when the Creative holds fewer, and empty when it holds none. variationCount tells how many exist. Read them all with GET /library/creatives/{creativeId}.

Show properties
Array of object
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
thumbnailUrlstring | nullrequired

A small picture of the Asset, at most 400 pixels on its longest side: the image made smaller, or the first frame of a video. Cloudflare makes it from the stored bytes when a client reads the URL. The URL does not expire. It holds key, and key is the public address of the original file. null for a video over 100 MB, for an image over 12,000 pixels on one side or over 100 megapixels, and for an Asset that is not ready. Show the kind of the Asset when it is null, or when the picture does not load.

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.

brokenRulesobject[]required

The rules of the Placement that the Asset breaks, as the Placement stores them. They are advice: AdCrunch wrote the Variation anyway. Empty when placement is null. AdCrunch computes this list at each read, so a change of the rules of the Placement changes the next read.

Show properties
Array of object
One of:
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:ne
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:in
valueinteger[]required
min items 1 · max items 50
typestringrequired
Allowed:width
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:ne
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:in
valueinteger[]required
min items 1 · max items 50
typestringrequired
Allowed:height
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:ne
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:in
valueinteger[]required
min items 1 · max items 50
typestringrequired
Allowed:size
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:ne
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:lt
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:lte
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:gt
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:gte
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:in
valueinteger[][]required
min items 1 · max items 50
typestringrequired
Allowed:ratio
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valuestringrequired
min length 1 · max length 255
object
conditionstringrequired
Allowed:ne
valuestringrequired
min length 1 · max length 255
object
conditionstringrequired
Allowed:in
valuestring[]required
min items 1 · max items 50
typestringrequired
Allowed:mime
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:ne
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:in
valueinteger[]required
min items 1 · max items 50
typestringrequired
Allowed:duration
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.

placementobject | nullrequired

The Placement that the Variation names, or null. null also when the Placement was deleted after the Variation named it.

Show properties
channelstringrequired

The channel of a Line Item that the Placement belongs to.

Allowed:metatiktoksnapchatgoogle_searchgoogle_pmaxgoogle_displayyoutubeprogrammatic_displaylinkedinx
idstringrequired

The id of the Placement, plm_….

namestringrequired

The name of the Placement.

typestringrequired

The kind of Asset that the Placement takes.

Allowed:imagevideo
placementIdstring | nullrequired

The id of the Placement that the Variation names, plm_…, or null when it names none.

unknownRulesobject[]required

The rules of the Placement that need a fact that the Asset does not have: a width, a height, a duration or a ratio of an Asset that AdCrunch could not read. They are neither held nor broken. Empty when placement is null. AdCrunch computes this list at each read.

Show properties
Array of object
One of:
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:ne
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:in
valueinteger[]required
min items 1 · max items 50
typestringrequired
Allowed:width
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:ne
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:in
valueinteger[]required
min items 1 · max items 50
typestringrequired
Allowed:height
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:ne
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:in
valueinteger[]required
min items 1 · max items 50
typestringrequired
Allowed:size
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:ne
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:lt
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:lte
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:gt
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:gte
valueinteger[]required
min items 2 · max items 2
Show properties
Array of integer
Any of:
integer
integer
integer
integer
object
conditionstringrequired
Allowed:in
valueinteger[][]required
min items 1 · max items 50
typestringrequired
Allowed:ratio
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valuestringrequired
min length 1 · max length 255
object
conditionstringrequired
Allowed:ne
valuestringrequired
min length 1 · max length 255
object
conditionstringrequired
Allowed:in
valuestring[]required
min items 1 · max items 50
typestringrequired
Allowed:mime
object
operatorobjectrequired
Show properties
Any of:
object
conditionstringrequired
Allowed:eq
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:ne
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:lte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gt
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:gte
valueintegerrequired
min 0 · max 9007199254740991
object
conditionstringrequired
Allowed:in
valueinteger[]required
min items 1 · max items 50
typestringrequired
Allowed:duration
updatedAtnumber | nullrequired

When the Placement of the Variation last changed, or null when it never did. Only the Placement changes: the Asset of a Variation never changes.

lineItemIdsstring[]required

The ids of the live Line Items of the plan that use the Creative. Empty when the Creative is not assigned to a Line Item yet.

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 campaign_plan: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 Campaign Plan with that slug, or no Creative with that id in the Library of your organization. A deleted Creative and the Creative of another organization are not found. error is not_found, and message names which one.

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 pool has 50 Creatives already. error is creative_limit.

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-1433.adcrunch.dev/context/campaign-plans/string/creatives' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "creativeId": "crv_8c2e47"
}'
Response
{
  "creatives": [
    {
      "firstVariations": [
        {
          "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",
            "thumbnailUrl": "https://assets.adcrunch.dev/cdn-cgi/media/mode=frame,time=0s,width=400,height=400,fit=scale-down/org_3a7f10/ast_7c1e9a",
            "updatedAt": 1790000120000,
            "width": 1080
          },
          "assetId": "ast_7c1e9a",
          "brokenRules": [],
          "createdAt": 1790000360000,
          "createdBy": "usr_2e5b84",
          "creativeId": "crv_8c2e47",
          "deletedAt": null,
          "id": "var_8c3f60",
          "organizationId": "org_3a7f10",
          "placement": {
            "channel": "meta",
            "id": "plm_meta_stories_video",
            "name": "Meta Stories video",
            "type": "video"
          },
          "placementId": "plm_meta_stories_video",
          "unknownRules": [],
          "updatedAt": null
        },
        {
          "asset": {
            "contentHash": "4a7e1c9b0d3f26854b1e7a9c2d6f3081",
            "createdAt": 1789900000000,
            "createdBy": "usr_2e5b84",
            "deletedAt": null,
            "durationMs": null,
            "failureCode": null,
            "failureReason": null,
            "filename": "spring-sale-square.jpg",
            "height": 1080,
            "id": "ast_2d4f83",
            "key": "org_3a7f10/ast_2d4f83",
            "kind": "image",
            "mimeType": "image/jpeg",
            "name": null,
            "organizationId": "org_3a7f10",
            "sizeBytes": 486112,
            "status": "ready",
            "thumbnailUrl": "https://assets.adcrunch.dev/cdn-cgi/image/width=400,height=400,fit=scale-down,format=auto/org_3a7f10/ast_2d4f83",
            "updatedAt": 1789900090000,
            "width": 1080
          },
          "assetId": "ast_2d4f83",
          "brokenRules": [],
          "createdAt": 1790000350000,
          "createdBy": "usr_2e5b84",
          "creativeId": "crv_8c2e47",
          "deletedAt": null,
          "id": "var_1d7b42",
          "organizationId": "org_3a7f10",
          "placement": null,
          "placementId": null,
          "unknownRules": [],
          "updatedAt": null
        }
      ],
      "id": "crv_8c2e47",
      "lineItemIds": [],
      "name": "Spring sale",
      "variationCount": 2
    }
  ]
}