---
title: "Save a campaign context"
method: POST
path: "/sites/{site}/campaign-contexts"
tags: ["Context"]
---

# Save a campaign context

`POST /sites/{site}/campaign-contexts`

## Request

- Base URL: `https://api.onelence.com/v1`
- URL: `https://api.onelence.com/v1/sites/{site}/campaign-contexts`
- Auth: one of:
  - OAuth 2 (authorization code, authorization URL `https://api.onelence.com/oauth/authorize`, token URL `https://api.onelence.com/oauth/token`, scopes: `workspace:write`)
  - HTTP bearer

Creates or updates the description of a campaign on a source (objective, promise, audience, landing page, entered spend), matched by source and name. Fields passed replace the stored values, which are not kept; fields left out stay as they are.

## Path parameters

- `site` string, required

## Query parameters

- `dry_run` boolean

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `source_key` string, required: source_key from the campaign contexts list, or a source id.
  - `name` string, required: Campaign name; the same name updates that campaign.
  - `type` 'unknown' | 'ad_campaign' | 'organic_post' | 'referral_placement' | 'email_send' | 'community_post' | 'partner_placement' | 'other'
  - `objective` 'unknown' | 'awareness' | 'traffic' | 'engagement' | 'leads' | 'conversions' | 'sales' | 'retargeting' | 'trust'
  - `demand_job` 'unknown' | 'create_demand' | 'reframe_demand' | 'capture_demand' | 'convert_demand' | 'retain_demand'
  - `status` 'unknown' | 'running' | 'paused' | 'ended' | 'draft'
  - `promise` string, nullable
  - `audience` string, nullable
  - `primary_cta` string, nullable
  - `landing_page_url` string, uri, nullable
  - `context_url` string, uri, nullable
  - `note` string, nullable
  - `reported_spend` object, nullable: Spend the team confirms for this campaign; null clears it.
    - `amount` number, required
    - `currency` string, required
    - `period_start` string
    - `period_end` string

## Response `200`

Success.

- object
  - `object` 'campaign_context', required
  - `id` string, required
  - `source_key` string, required
  - `source_name` string, nullable, required
  - `name` string, required
  - `type` 'unknown' | 'ad_campaign' | 'organic_post' | 'referral_placement' | 'email_send' | 'community_post' | 'partner_placement' | 'other', required
  - `objective` 'unknown' | 'awareness' | 'traffic' | 'engagement' | 'leads' | 'conversions' | 'sales' | 'retargeting' | 'trust', required
  - `demand_job` 'unknown' | 'create_demand' | 'reframe_demand' | 'capture_demand' | 'convert_demand' | 'retain_demand', required
  - `status` 'unknown' | 'running' | 'paused' | 'ended' | 'draft', required
  - `promise` string, nullable, required
  - `audience` string, nullable, required
  - `primary_cta` string, nullable, required
  - `landing_page_url` string, nullable, required
  - `context_url` string, nullable, required
  - `reported_spend` object, nullable, required
    - `amount` number, required
    - `currency` string, nullable, required
    - `period_start` string, nullable, required
    - `period_end` string, nullable, required
  - `note` string, nullable, required
  - `updated_at` string, nullable, required

## Other responses

- `400`: Invalid input; `error.param` names the field.
- `401`: Missing, expired or revoked token. WWW-Authenticate points to the resource metadata.
- `402`: subscription_required or upgrade_required; the error carries billing_url.
- `403`: insufficient_scope or admin_required.
- `404`: Unknown endpoint, site, source or record.
- `409`: A request with this Idempotency-Key is still running.
- `422`: This Idempotency-Key was already used for a different request.
- `429`: Rate limited. Retry after Retry-After seconds.
- `500`: OneLence could not complete the request.

---

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