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

Approve a Campaign Plan

Approves a Campaign Plan and validates its draft Line Items. This opens the gate for execution: AdCrunch executes a line only after somebody validates it.

This call blocks on nothing. You can approve a Campaign Plan with no budget, with more allocated than the envelope, or with parts missing. Approval is the human act, and execution makes its own checks.

This call creates nothing and spends nothing. To execute a line, use the mutation tools with the mutation:write permission.

This call moves the revision of the Campaign Plan, and the revision of each Line Item it validates. Read the Campaign Plan again before your next guarded write.

A line that you add after the approval starts in draft, and it puts the Campaign Plan back into draft. The answer is 409 with error=revision_mismatch if the Campaign Plan changed after you read it.

POST/context/campaign-plans/{slug}/approve
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
base_revisionintegerrequired

The revision last read via GET. This is what makes it an approval of the content that was read, rather than of whatever the row holds now.

min -9007199254740991 · max 9007199254740991
Responses
200

The approved plan, and how many Line Items this call validated. A line that was already validated is not counted. Approving spends nothing and creates nothing — it opens the execution gate, and executing goes through the mutation tools on mutation:write.

campaignPlanobjectrequired
Show properties
allocationobjectrequired

Derived on every read. Never stored.

Show properties
allocatednumber | nullrequired

The sum of the Line Item budgets. null when the lines mix units, because that sum would be meaningless.

comparablebooleanrequired

False when the lines mix totals and daily rates. A surface must then print "not comparable" rather than a plausible-looking wrong total.

unallocatednumber | nullrequired

The envelope less the allocated, where both are known.

unitstring | nullrequired

The shared unit, when the lines agree on one.

Allowed:totaldaily
brandIdstring | nullrequired

Nullable and mutable: a plan may precede its brand, cover a portfolio, or be re-pointed. Deleting a Brand leaves its plans standing.

createdAtnumberrequired

Milliseconds since the Unix epoch, UTC.

createdBystringrequired
currencystringrequired

Editable until the first Line Item budget, and frozen thereafter.

descriptionstringrequired
endDatestring | nullrequired

A calendar date, YYYY-MM-DD.

idstringrequired
lineItemsobject[]required
Show properties
Array of object
advertiserIdstring | nullrequired
ageMaxnumber | nullrequired
ageMinnumber | nullrequired

Each bound is independently optional, so "35+" is expressible.

budgetnumber | nullrequired

Whole units of the plan’s currency.

campaignPlanIdstringrequired
channelstringrequired

The planner’s word for what is being bought, not a provider name. A plan may name a channel we cannot execute.

Allowed:metatiktoksnapchatgoogle_searchgoogle_pmaxgoogle_displayyoutubeprogrammatic_displaylinkedinx
countriesstring[]required
createdAtnumberrequired

Milliseconds since the Unix epoch, UTC.

createdBystringrequired
effectiveEndDatestring | nullrequired

The line’s own bound where it has one, else the plan’s.

effectiveStartDatestring | nullrequired

A calendar date, YYYY-MM-DD.

endDatestring | nullrequired

A calendar date, YYYY-MM-DD.

executablebooleanrequired

Whether this channel could be executed at all today. Derived from our capabilities, never a promise that it will be.

executionsobject[]required

What this line has spawned. Never a claim that it is finished — nobody declared how many objects a line should produce.

Show properties
Array of object
advertiserIdstringrequired
createdAtnumberrequired

Milliseconds since the Unix epoch, UTC.

entityIdstringrequired

The provider’s own id, unprefixed, so it joins to entities.

entityTypestringrequired

The provider’s word for the level — campaign, adset, ad.

idstringrequired
mutationWorkflowIdstring | nullrequired

The durable execution that performed the write, when known.

providerstringrequired
genderstring | nullrequired
Allowed:allmenwomen
idstringrequired
objectivestringrequired
Allowed:awarenessengagementleadssalestrafficapp_promotion
personaIdstring | nullrequired

Explains the targeting; never supplies its values.

providerstring | nullrequired

Who sells this channel, or null when nobody we integrate with does.

revisionnumberrequired

Increments on every write. Send it back as base_revision to edit; a stale one answers 409.

startDatestring | nullrequired

A calendar date, YYYY-MM-DD.

statusstringrequired

validated is the gate on execution.

Allowed:draftvalidated
unitstringrequired

How budget reads, derived from the effective end date. Present → a total for the period; absent → a daily rate. A surface must print this beside the amount.

Allowed:totaldaily
updatedAtnumber | nullrequired

Milliseconds since the Unix epoch, UTC.

measurementstring | nullrequired
namestringrequired
rationalestring | nullrequired
revisionnumberrequired

Increments on every write. Send it back as base_revision to edit; a stale one answers 409.

slugstringrequired
startDatestring | nullrequired

A calendar date, YYYY-MM-DD.

statusstringrequired

The only two stored states. active, closed and "executed" are derived, never stored.

Allowed:draftapproved
totalBudgetnumber | nullrequired
updatedAtnumber | nullrequired

Milliseconds since the Unix epoch, UTC.

lineItemsValidatednumberrequired

How many draft Line Items this approval moved to validated. Zero when they were all validated already.

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.

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. 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 plan moved since you read it. error is revision_mismatch. This is what makes the call an approval of the content you read, rather than of whatever the row holds now.

currentRevisionnumberrequired

The revision the row holds now. Re-read, re-apply your edit on top, and send this back as base_revision.

errorstringrequired

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

Allowed:revision_mismatch
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-701.adcrunch.dev/context/campaign-plans/string/approve" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "base_revision": 2
}'
Response
{
  "campaignPlan": {
    "allocation": {
      "allocated": 2500,
      "comparable": true,
      "unallocated": 2500,
      "unit": "total"
    },
    "brandId": "brd_6a9c33",
    "createdAt": 1768435200000,
    "createdBy": "usr_5d2b71",
    "currency": "EUR",
    "description": "The spring sale of Acme, on Meta, in France and Belgium.",
    "endDate": "2026-05-31",
    "id": "cpl_4e1a08",
    "lineItems": [
      {
        "advertiserId": "acc_1203456789012345",
        "ageMax": 44,
        "ageMin": 25,
        "budget": 2500,
        "campaignPlanId": "cpl_4e1a08",
        "channel": "meta",
        "countries": [
          "FR",
          "BE"
        ],
        "createdAt": 1768435200000,
        "createdBy": "usr_5d2b71",
        "effectiveEndDate": "2026-05-31",
        "effectiveStartDate": "2026-03-01",
        "endDate": null,
        "executable": true,
        "executions": [
          {
            "advertiserId": "acc_1203456789012345",
            "createdAt": 1772409600000,
            "entityId": "120210000000000",
            "entityType": "campaign",
            "id": "exe_7a4c12",
            "mutationWorkflowId": "b3d1f0c4-6a2e-4a1f-9f77-2c0d1e5a8b94",
            "provider": "meta"
          }
        ],
        "gender": "all",
        "id": "lni_2d9e77",
        "objective": "sales",
        "personaId": "psn_8c4a20",
        "provider": "meta",
        "revision": 2,
        "startDate": null,
        "status": "validated",
        "unit": "total",
        "updatedAt": 1769040000000
      }
    ],
    "measurement": "Revenue in the window, against the spring of 2025.",
    "name": "Spring Sale 2026",
    "rationale": "Meta carries the reach. One line keeps the budget in one place.",
    "revision": 3,
    "slug": "spring-sale",
    "startDate": "2026-03-01",
    "status": "approved",
    "totalBudget": 5000,
    "updatedAt": 1769040000000
  },
  "lineItemsValidated": 1
}