Overview
Replace one line of a plan awaiting approval (line_id from plan_quote) with another creator's format (unit_id from creators_search or creator_get) at its current all-in price, in one step: both happen or neither does, so the plan is never left with both creators or with none. The plan's total after the swap must fit the key's mandate and the campaign's budget: a creator at or under the removed creator's price always swaps in, a dearer one that would go over the budget is refused (conflict, reason over_budget, budget_cents, remaining_cents). A creator already on the plan is refused (already_in_plan); to change a creator's format, remove the line and add the format. Returns the new line_id, the removed_line_id and the plan as plan_quote returns it. Needs an idempotency_key. Scope: campaigns:write. MCP tool: plan_swap_creator.
- Endpoint
POST https://app.distribution.tech/api/v1/plans/{id}/lines/{line_id}/swap- Scope
campaigns:write- Changes data
- Yes, send an Idempotency-Key header
- MCP tool
- plan_swap_creator
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string (uuid) | Yes | |
line_id | path | string (uuid) | Yes | |
Idempotency-Key | header | string | Yes | 8 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
| Name | Type | Required | Description |
|---|---|---|---|
unit_id | string (uuid) | Yes | A format's unit_id from /creators. |
{
"unit_id": "<uuid>"
}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 -X POST "https://app.distribution.tech/api/v1/plans/$PLAN_ID/lines/$LINE_ID/swap" \
-H "Authorization: Bearer $DISTRIBUTION_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"unit_id": "<uuid>"
}'Response
200 OK. The body has these fields:
| Name | Type | Required | Description |
|---|---|---|---|
line_id | string (uuid) | Yes | |
removed_line_id | string (uuid) | Yes | |
plan | object | Yes | A plan as the person sees it and as an agent signs it (v1-product-spec 8.5 Quote). |
{
"line_id": "<uuid>",
"removed_line_id": "<uuid>",
"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"
}
}Errors
| Status | When |
|---|---|
400 | A parameter is not valid: details.problems names each field and what it accepts. |
401 | No API key, an unknown one, or a revoked one. |
403 | The key lacks the scope, or the mandate refuses (mandate_refused, with the limit and how much over). |
404 | No plan, line or creator of yours has that id. |
409 | conflict (with a reason), idempotency_conflict, or in_progress (Retry-After). |
422 | unprocessable: 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. |
429 | Too 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). |
500 | internal: the request failed on our side. Retry it with the same Idempotency-Key. |
503 | unavailable: writes are not available right now (for an approval: payments are not open yet). |
Related endpoints
POST /plans/{id}/approve: Approve and get the pay linkPOST /plans/{id}/dates: Move a plan's datesPOST /plans/{id}/lines: Add a creatorGET /plans/{id}/quote: A plan as you sign itDELETE /plans/{id}/lines/{line_id}: Remove a creator
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.