---
title: "Record what a Line Item spawned"
method: POST
path: "/context/campaign-plans/{slug}/line-items/{lineItemId}/executions"
tags: ["Line Items"]
---

# Record what a Line Item spawned

`POST /context/campaign-plans/{slug}/line-items/{lineItemId}/executions`

## Request

- Base URL: `https://api.adcrunch.dev`
- URL: `https://api.adcrunch.dev/context/campaign-plans/{slug}/line-items/{lineItemId}/executions`
- Auth: HTTP bearer

Records one provider object that this Line Item created. The caller that created the object writes this record, because only that caller knows which line the object belongs to.

A record is a **fact**, not an attempt. AdCrunch keeps the attempts in the mutation ledger.

This call refuses almost nothing. The provider object already exists, and a refusal would leave it live and untracked. A draft line records, an edited line records, and a line on a channel AdCrunch cannot write to records. The state of the line does not change, and neither does the state of the Campaign Plan.

The same object recorded again answers `200` with the existing row, and not `201`. The same object is the same provider, the same level and the same native id, on the same line.

AdCrunch never removes a record. It can tell you how many objects a line created. It cannot tell you how many objects a line must create, because a Campaign Plan never declares that number.

## Path parameters

- `lineItemId` string, required
- `slug` string, required

## Request body

- object
  - `advertiser_id` string, required: The ad account the object was created in.
  - `entity_id` string, required: The **native** provider id, unprefixed — exactly as the Insight entities table holds it, which is what makes the two joinable.
  - `entity_type` string, required: The provider’s own word for the level: campaign, adset, ad. Free text, because the vocabulary is the provider’s.
  - `mutation_workflow_id` string: The mutation that performed the write, when known — links this fact to the attempt without either duplicating the other.
  - `provider` union, required
    - 'meta'
    - 'tiktok'
    - 'snapchat'
    - 'gads'
    - 'dv360'
    - 'x'
    - 'openai'

## Response `200`

This object was already recorded against this line. The existing row comes back unchanged, so the call is idempotent — recording twice does not inflate what the line has spawned.

- object
  - `advertiserId` string, required
  - `createdAt` number, required: Milliseconds since the Unix epoch, UTC.
  - `entityId` string, required: The provider’s own id, unprefixed, so it joins to `entities`.
  - `entityType` string, required: The provider’s word for the level — `campaign`, `adset`, `ad`.
  - `id` string, required
  - `mutationWorkflowId` string, nullable, required: The durable execution that performed the write, when known.
  - `provider` string, required

## Other responses

- `201`: Recorded. Neither response shape was observed against the deployed service, because the verification organization has no connected advertiser — both are written from the Context Layer’s view type.
- `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.
- `401`: No API key, or one that does not resolve. See the security scheme. `error` is `unauthorized`.
- `402`: The organization has no active subscription. An owner subscribes at `paywallUrl`. `error` is `organization_unentitled`.
- `403`: The caller does not hold `campaign_plan:write`. `error` is `forbidden`.
- `404`: No such plan, or no Line Item with that id on it. `error` is `not_found`.
- `422`: That ad account is not connected to this organization. `error` is `advertiser_not_owned`. Almost nothing else is refused here, deliberately: the provider object already exists, and refusing the record would leave it live and untracked.

---

[API](https://skmtc.dev/adcrunch/apis/adcrunch-api.md) · [All operations](https://skmtc.dev/adcrunch/apis/adcrunch-api/llms.txt) · [OpenAPI document](https://skmtc.dev/adcrunch/apis/adcrunch-api/revisions/a420ba80914f?raw)
