SCALIX help

← All tools

lads_create_campaign

LinkedIn Ads write high risk

Part of the LinkedIn Campaign Manager Agent.

What it does

Creates a campaign under an account + campaign group. Two-phase write (Scalix guardrail): although LinkedIn permits creating a campaign directly in ACTIVE, our policy builds the request locally and returns a preview_id (LinkedIn has no validate_only, so nothing is created at preview; it reads the campaign group and, when needed, the targeted locations' names); COMMIT creates the campaign in DRAFT (never directly ACTIVE) and writes an immutable audit log. Required fields: account (urn:li:sponsoredAccount), campaignGroup (urn:li:sponsoredCampaignGroup), name, type (TEXT_AD|SPONSORED_UPDATES|SPONSORED_INMAILS|DYNAMIC), costType (CPM|CPC|CPV), unitCost{amount,currencyCode}, dailyBudget and/or totalBudget{amount,currencyCode}, locale{country,language}, targetingCriteria, offsiteDeliveryEnabled (bool), politicalIntent (NOT_POLITICAL or NOT_DECLARED; required since 202508; POLITICAL is refused), runSchedule.start (epoch ms; LinkedIn 202606 rejects a create without it, even for a DRAFT), status. At preview Scalix refuses a request missing any of cost_type, unit_cost, a budget, locale, offsite_delivery_enabled, run_schedule_start or political_intent, or whose targeting_criteria is not in LinkedIn's targetingCriteria form, naming them, and includes the exact request it will send (preview.request). It also refuses political_intent=POLITICAL (LinkedIn does not allow political ads), and NOT_DECLARED when the targeting includes an EU country or region, which it checks by reading the targeted locations' names from LinkedIn; an EU campaign declared NOT_POLITICAL gets LinkedIn's EU statement in the preview warnings, for the user to confirm. A campaign without objectiveType takes its group's; another objective than the group's is refused. Age or gender targeting on a JOB_APPLICANT or TALENT_LEAD campaign, named or inherited, is refused (age: LinkedIn's rule; gender: Scalix policy), as are age or gender in exclude. associatedEntity (urn:li:organization) is required for Sponsored Content/Dynamic/Lead Gen. Optional: objectiveType, pacingStrategy, optimizationTargetType (default NONE), creativeSelection (OPTIMIZED|ROUND_ROBIN), format, audienceExpansionEnabled. Accuracy notes: budgets & bids are DECIMAL STRINGS in account currency (NOT micros); currencyCode MUST equal the account; audience must resolve to >=300 members to serve; the new id is returned in the x-restli-id response header (201 Created), not the body.

When to use it

Use to launch a campaign once its group and targeting are decided. Preview as DRAFT and read back every field (objective, budget, bid strategy, targeting size, format, politicalIntent) for approval before activating. First call the matching planner skill (lads_plan_sponsored_content_campaign, lads_plan_lead_gen_campaign, lads_plan_message_campaign, or lads_plan_dynamic_ad_campaign) for the campaign blueprint, operation ordering, and policy pre-checks.

Inputs

NameTypeRequiredDescription
account_idstringyesNumeric ad account ID (digits only) for the path; body account = urn:li:sponsoredAccount:{id}.
campaign_group_idstringyesParent group ID; body campaignGroup = urn:li:sponsoredCampaignGroup:{id}. Must belong to the same account.
namestringyesCampaign name.
typestringyesCampaignType; enum-normalize: TEXT_AD|SPONSORED_UPDATES|SPONSORED_INMAILS|DYNAMIC.
cost_typestringyesCPM|CPC|CPV (cost-cap/target strategies force CPM).
unit_costobjectyes{amount:string,currencyCode:string} bid/target/cap; decimal string in account currency, not micros. May be '0' only when optimizationTargetType is auto (e.g., MAX_*) and manual bidding is off.
daily_budgetobjectno{amount:string,currencyCode:string}; supply dailyBudget and/or totalBudget (at least one required).
total_budgetobjectno{amount:string,currencyCode:string}; run_schedule_end is required when total_budget is set without daily_budget.
localeobjectyes{country:ISO-3166 alpha-2, language:ISO-639}.
targeting_criteriaobjectyesLinkedIn's targetingCriteria (li-lms-2026-06): {include: {and: [{or: {<facet URN>: [<value URNs>]}}, ...]}, exclude: {or: {<facet URN>: [<value URNs>]}}}. The include.and entries are ANDed; the facets and values inside one or are ORed; exclude (optional) drops anyone matching any of its values. Facet keys are full URNs (urn:li:adTargetingFacet:locations, :titles, :seniorities, :industries, :skills, ...); values are entity URNs from lads_get_targeting_entities or the lads_list_* helpers (a location is urn:li:geo:{id}, an interface locale urn:li:locale:en_US). Example: {include: {and: [{or: {'urn:li:adTargetingFacet:locations': ['urn:li:geo:103644278']}}, {or: {'urn:li:adTargetingFacet:interfaceLocales': ['urn:li:locale:en_US']}}]}}. Any other shape, such as the retired includedTargetingFacets/excludedTargetingFacets form or a short facet name, is refused at preview, naming the fault, as are ageRanges or genders in exclude (LinkedIn refuses them there) and age or gender on a JOB_APPLICANT or TALENT_LEAD campaign; age or gender on any other campaign gets a warning to remove it from housing, credit, education and job ads. Must resolve to >=300 members to serve (check with lads_get_audience_count).
associated_entitystringnourn:li:organization:{id}; REQUIRED for Sponsored Content, Dynamic Ads, and Lead Gen Forms.
offsite_delivery_enabledbooleanyesWhether the campaign may serve on the LinkedIn Audience Network. Required. Must be true when connectedTelevisionOnly=true; disallowed for some format/objective combos (surface platform error if rejected).
political_intentstringyesNOT_POLITICAL or NOT_DECLARED (required since 202508). POLITICAL is refused at preview: LinkedIn does not allow political ads. A campaign that targets the EU must be NOT_POLITICAL, declared only after the user confirms LinkedIn's EU statement, which the preview shows; NOT_DECLARED on EU targeting is refused at preview.
objective_typestringnoBRAND_AWARENESS|CREATIVE_ENGAGEMENT|ENGAGEMENT|JOB_APPLICANT|LEAD_GENERATION|TALENT_LEAD|VIDEO_VIEW|WEBSITE_CONVERSION|WEBSITE_TRAFFIC|WEBSITE_VISIT, singular (LinkedIn refuses the plurals its schema table lists); any other value is refused at preview. Omitted, the campaign takes its group's objective; a different one is refused at preview, as LinkedIn refuses it. A JOB_APPLICANT or TALENT_LEAD campaign, its objective named or inherited, cannot target by age (LinkedIn's rule) or gender (Scalix policy).
pacing_strategystringnoLIFETIME|ACCELERATED.
optimization_target_typestringnoDefault NONE; e.g. NONE|ENHANCED_CONVERSION|MAX_IMPRESSION|MAX_CLICK|MAX_CONVERSION|MAX_VIDEO_VIEW|MAX_LEAD|MAX_QUALIFIED_LEAD(202602+)|MAX_REACH|TARGET_COST_PER_CLICK|TARGET_COST_PER_IMPRESSION|TARGET_COST_PER_VIDEO_VIEW|CAP_COST_AND_MAXIMIZE_CLICKS|CAP_COST_AND_MAXIMIZE_IMPRESSIONS|CAP_COST_AND_MAXIMIZE_VIDEO_VIEWS|CAP_COST_AND_MAXIMIZE_LEADS. Cost-cap/target strategies force costType=CPM and a non-zero unitCost.
creative_selectionstringnoOPTIMIZED|ROUND_ROBIN.
formatstringnocampaignFormat (e.g., STANDARD_UPDATE|SINGLE_VIDEO|CAROUSEL|SPONSORED_INMAIL|SPONSORED_MESSAGE|SPOTLIGHT|FOLLOW_COMPANY|JOBS|TEXT_AD).
audience_expansion_enabledbooleannoWhether LinkedIn may expand targeting to lookalike members.
preview_idstringnoOmit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview.
run_schedule_startintegeryesInclusive start as epoch milliseconds (UTC). Required: LinkedIn 202606 rejects a campaign create without runSchedule.start, even for a DRAFT, so a missing one, or one that is not epoch ms (such as an ISO date), is refused at preview.
run_schedule_endintegernoExclusive end as epoch ms; required when total_budget is set without daily_budget; omit for open-ended.

Safeguards

A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.

Policy

politicalIntent is REQUIRED (since 202508) and must be declared honestly; for EU-targeted campaigns display and capture the EU consent ('I confirm this is not political advertising...under EU law...') before activating. For employment/housing/education/credit objectives, enforce anti-discrimination targeting (no targeting/excluding by protected attributes — age, gender, etc.; age targeting off for recruitment; copy gender-neutral/non-age-coded). EU geo is not a hard block for messaging formats (lifted ~Oct 2024): enforce politicalIntent + member opt-in instead. Never circumvent LinkedIn ad policy. Strict per-account isolation.

Reminder

Create paused, confirm the preview, then activate; declare politicalIntent honestly, honor anti-discrimination on protected categories, and keep audiences >=300 to serve.

Errors

Error classMeansWhat to doRetry
INVALID_ARGUMENTLinkedIn rejected a field — e.g., missing required politicalIntent/offsiteDeliveryEnabled/status/associatedEntity, currencyCode != account currency, unitCost is 0 while a manual/cost-cap optimizationTargetType is set, no budget supplied, or budget not a decimal string.Surface the exact platform message; fix the named field and re-preview. Never guess valid enums.no
POLICY_VIOLATIONTargeting or settings violate policy — e.g., protected-attribute targeting on employment/housing/education/credit, missing/false politicalIntent for EU targeting, or restricted-content objective.Block the create; explain the specific policy and require corrected targeting/declaration. Not retryable as-is.no
AUDIENCE_TOO_SMALLTargeting resolves to fewer than 300 members; the campaign will not serve (CAMPAIGN_AUDIENCE_COUNT_HOLD).Broaden targeting to >=300 before activating; surface the estimated audience size.no
PERMISSION_DENIEDMissing rw_ads or insufficient role (VIEWER/CREATIVE_MANAGER), or out of bearer scope (403).Confirm CAMPAIGN_MANAGER+ and rw_ads.no
CUSTOMER_NOT_FOUNDAccount or campaign group not found / not in scope (404).Verify account_id and campaign_group_id.no
PREVIEW_EXPIREDpreview_id unknown/expired (TTL elapsed) or fields changed since preview.Re-preview to regenerate a fresh preview_id before committing.no
TOKEN_REVOKEDToken expired/revoked (401).needs_reauth — refresh once and retry the same step; else reconnect.yes
RESOURCE_EXHAUSTEDRate/quota limit (429).Backoff 5/10/20s cap 60s; honor reset.yes
PLATFORM_UNAVAILABLELinkedIn 5xx.Retry with backoff; if the create may have applied, search by name (lads_list_campaigns) before retrying to avoid duplicates.yes

Edge cases

  • Preview-only leaves a DRAFT campaign + preview_id; never serves until commit.
  • Audience <300 -> won't serve; warn at preview using an audience-size estimate.
  • Cost-cap/target optimizationTargetType requires costType=CPM and a non-zero unitCost (unitCost defaults to 0).
  • associatedEntity required for Sponsored Content/Dynamic/Lead Gen — missing it -> INVALID_ARGUMENT.
  • EU targeting: NOT blocked for messaging formats (block lifted ~Oct 2024); instead politicalIntent + EU consent must be set.
  • objectiveType: LinkedIn takes JOB_APPLICANT, WEBSITE_VISIT, VIDEO_VIEW and WEBSITE_CONVERSION and refuses the plural spellings its schema table lists (DRAFT probe, 1 Oct 2026); Scalix refuses those at preview.
  • campaignGroup must belong to the same account or the create fails.
  • Test account: campaign created with test=true never serves and yields no analytics.
  • Idempotency: capture x-restli-id; on 5xx after POST, check for an existing campaign by name before retrying.
  • Modifying any field after preview invalidates preview_id -> re-preview.
  • Preview TTL expiry -> PREVIEW_EXPIRED.