distribution.techdistribution.tech

API reference, Campaigns

Start a campaign

POST /campaigns

From a goal to a priced plan in one call: goal (launch, funding, feature or program), product, moment (what goes live and when), window_start, window_end.

Overview

From a goal to a priced plan in one call: goal (launch, funding, feature or program), product, moment (what goes live and when), window_start, window_end and budget_usd; optionally audience and company (left out, they come from your company context), geography (worldwide), desired_outcome (the goal's usual outcome), constraints and budget_min_usd. The answer's defaults lists every field it filled. The budget is held to this key's mandate: the plan is built within the smaller of budget_usd, the mandate's maximum plan total and what is left of its monthly cap, and a budget_min_usd above either limit is refused (mandate_refused, over_max_plan_total or over_monthly_cap, with the numbers); with no budget_min_usd the campaign is held to the mandate instead. The campaign is started for the brand exactly as from the workspace and the planner builds the plan from creators on sale now. Returns campaign_id and the plan as plan_quote returns it, or plan_note when nothing on sale fits yet. Needs an idempotency_key; a retry with the same key never starts a second campaign. A brand starts at most 3 campaigns in any 24 hours (rate_limited, details.reason daily_campaign_limit, details.resets_at when it reopens). Scope: campaigns:write. MCP tool: create_campaign.

Endpoint
POST https://app.distribution.tech/api/v1/campaigns
Scope
campaigns:write
Changes data
Yes, send an Idempotency-Key header

Parameters

Parameters of POST /campaigns
NameInTypeRequiredDescription
Idempotency-KeyheaderstringYes8 to 128 letters, digits or . _ : -. Retry with the same key and the same request to get the same answer; it never runs twice.

Request body

Request body of POST /campaigns
NameTypeRequiredDescription
goalone of "launch", "funding", "feature", "program"Yes
productstringYes
momentstringYesWhat goes live and when.
window_startstring (date)Yes
window_endstring (date)Yes
budget_usdintegerYesThe most to spend, in US dollars. The plan is held to this key's mandate: never above its maximum plan total or what is left of its monthly cap.
audiencestringNo
geographystringNo
budget_min_usdintegerNoThe least to spend. Above the mandate's maximum plan total, or what is left of its monthly cap, the campaign is refused (mandate_refused). Left out, the budget is held to the mandate instead of refused.
desired_outcomestringNo
companystringNo
constraintsstringNo
JSON body, every field
{
  "goal": "launch",
  "product": "<string>",
  "moment": "<string>",
  "audience": "<string>",
  "geography": "<string>",
  "window_start": "<date>",
  "window_end": "<date>",
  "budget_usd": 10,
  "budget_min_usd": 1,
  "desired_outcome": "<string>",
  "company": "<string>",
  "constraints": "<string>"
}

Request with curl

Set DISTRIBUTION_API_KEY to a key from Developers with the campaigns:write scope, and each path variable to an id from an earlier answer. The body carries the required fields.

curl
curl -X POST "https://app.distribution.tech/api/v1/campaigns" \
  -H "Authorization: Bearer $DISTRIBUTION_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "goal": "launch",
  "product": "<string>",
  "moment": "<string>",
  "window_start": "<date>",
  "window_end": "<date>",
  "budget_usd": 10
}'

Response

201 OK. The body has these fields:

Response fields of POST /campaigns
NameTypeRequiredDescription
campaign_idstring (uuid)Yes
statusone of "plan_ready", "no_plan"Yes
plannull or objectYes
plan_notestring or nullYes
defaultsarray of one of "company", "audience", "geography", "desired_outcome"NoThe fields filled because the request left them out.
budgetobjectNoThe budget the campaign was stored with. held is true when budget_usd alone was held lower, to what the mandate allows.
201 response body, every field with its type
{
  "campaign_id": "<uuid>",
  "status": "plan_ready",
  "plan": {
    "plan_id": "<uuid>",
    "campaign_id": "<uuid>",
    "version": 0,
    "status": "awaiting_approval",
    "currency": "<string>",
    "launch_window_start": "<date>",
    "launch_window_end": "<date>",
    "terms_fingerprint": "<string>",
    "total_cents": 0,
    "totals": {},
    "lines": [
      {
        "id": "<uuid>",
        "creator": {
          "id": "<uuid>",
          "name": "<string>",
          "handle": "<string>",
          "profile_url": "<string>",
          "avatar_url": "<uri>",
          "followers": 0
        },
        "creator_id": "<uuid>",
        "unit_id": "<uuid>",
        "stage_id": "planned",
        "stage": "<string>",
        "channel": "<string>",
        "channel_label": "<string>",
        "format": "<string>",
        "deliverable": "<string>",
        "scheduled_date": "<date>",
        "price_cents": 0,
        "vetting": "<string>",
        "reason": "<string>",
        "expected_views_low": 0,
        "expected_views_high": 0,
        "on_sale": false
      }
    ],
    "payment_options": [
      {
        "rail": "checkout",
        "label": "<string>",
        "clears": "<string>"
      }
    ],
    "agent_payment": "checkout",
    "brand_terms": {
      "current_version": "<string>",
      "current_number": 0,
      "url": "<string>",
      "accepted_for_this_key": "<string>",
      "accepted_number_for_this_key": 0
    },
    "mandate": {
      "key_id": "<uuid>",
      "version": 0,
      "max_plan_cents": 0,
      "monthly_cap_cents": 0,
      "channels": [
        "<string>"
      ],
      "may_approve": false,
      "may_exceed_budget": false,
      "expires_at": "<date-time>",
      "updated_at": "<date-time>",
      "spent_this_month_cents": 0,
      "terms_version": "<string>",
      "terms_accepted_at": "<date-time>",
      "terms_accepted_email": "<string>"
    },
    "policy": {
      "allowed": false,
      "refusal": {}
    },
    "blocked_lines": [
      "<uuid>"
    ],
    "over_budget": {
      "budget_cents": 0,
      "total_cents": 0,
      "over_by_cents": 0
    },
    "order": {},
    "valid_while": "terms_fingerprint_unchanged"
  },
  "plan_note": "<string>",
  "defaults": [
    "company"
  ],
  "budget": {
    "min_usd": 0,
    "max_usd": 0,
    "held": false
  }
}

Errors

Error statuses of POST /campaigns
StatusWhen
400A parameter is not valid: details.problems names each field and what it accepts.
401No API key, an unknown one, or a revoked one.
403The key lacks the scope, or the mandate refuses (mandate_refused, with the limit and how much over).
404No plan, line or creator of yours has that id.
409conflict (with a reason), idempotency_conflict, or in_progress (Retry-After).
422unprocessable: the body is readable but a value cannot be used (a blank or too long name, a campaign that cannot be planned yet); details.problems names each field when there are several.
429Too many requests for this key in the current minute (60); Retry-After and RateLimit-Reset say when to try again. On POST /campaigns and on POST /plans/current/lines when it starts a plan: the brand's 3 new campaigns in 24 hours are used (details.reason daily_campaign_limit); details.resets_at and Retry-After say when the limit reopens, a rolling 24 hours from the first of them, not a calendar day; archiving or deleting a campaign does not give its slot back. On GET /creators and GET /creators/{id}: a creator read limit is used (details.reason per_minute, daily_lists, daily_reveals, daily_seen or locked). daily_seen is your workspace's one pool of 300 creator views a day (300 different creators shown or opened since midnight UTC), shared by the app and every API key of the brand: details.scope workspace and details.limit 300; a creator already seen today, in the app or through any key, still opens and costs nothing. The other reasons are this key's own limit (details.scope key) or the brand's ceiling over all its keys (details.scope api).
500internal: the request failed on our side. Retry it with the same Idempotency-Key.
503unavailable: writes are not available right now (for an approval: payments are not open yet).

Get access

Keys are created in Developers once your brand is approved. Connect an agent to ask for access, then read the agent guide for the full flow.