Skip to content
AdCrunch
Esc
navigateopen⌘Jpreview

Validate a Line Item

Validates one Line Item. Use this call when you want to validate one row, and not to approve the whole plan.

Validation is the gate for execution. It changes nothing on any provider. To execute the line, you also need the mutation:write permission.

A call on a line that is already validated succeeds and changes nothing.

POST/context/campaign-plans/{slug}/line-items/{lineItemId}/validate
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
lineItemIdstringrequired
matches ^lni_[\s\S]{0,}$
slugstringrequired
Request body
requiredapplication/json
base_revisionintegerrequired

The revision last read via GET. This is what makes it a validation of the content that was read.

min -9007199254740991 · max 9007199254740991
Responses
200

The Line Item, now validated. Validating an already-validated line is a no-op rather than an error.

advertiserIdstring | nullrequired
ageMaxnumber | nullrequired
ageMinnumber | nullrequired

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

budgetnumber | nullrequired

Integer minor 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.

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 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 such plan, or no Line Item with that id on it. 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 Line Item moved since you read it. error is revision_mismatch. This is what makes it a validation of the content you read.

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.adcrunch.dev/context/campaign-plans/string/line-items/string/validate" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "base_revision": -9007199254740991
}'
Response
{
  "advertiserId": "string",
  "ageMax": 0,
  "ageMin": 0,
  "budget": 0,
  "campaignPlanId": "string",
  "channel": "meta",
  "countries": [
    "string"
  ],
  "createdAt": 0,
  "createdBy": "string",
  "effectiveEndDate": "string",
  "effectiveStartDate": "string",
  "endDate": "string",
  "executable": true,
  "executions": [
    {
      "advertiserId": "string",
      "createdAt": 0,
      "entityId": "string",
      "entityType": "string",
      "id": "string",
      "mutationWorkflowId": "string",
      "provider": "string"
    }
  ],
  "gender": "all",
  "id": "string",
  "objective": "awareness",
  "personaId": "string",
  "provider": "string",
  "revision": 0,
  "startDate": "string",
  "status": "draft",
  "unit": "total",
  "updatedAt": 0
}