lads_create_document_creative
LinkedIn Ads write high risk
Part of the Sponsored Content Agent.
What it does
Create a Document Ad creative (Sponsored Content document format) on the LinkedIn Creatives API. A document (uploaded via the Documents API as urn:li:document) is wrapped in a Post (adContext direct sponsored content, content.media = document URN + title, feedDistribution NONE), then the creative references that post via content.documentAd.reference - or built inline. For lead-gen (whitepaper download) campaigns, set content.documentAd.gatedLeadgenPreviewPageCount to gate the document behind a lead form after N preview pages. Preview->approve->commit: LinkedIn has no validate-only flag, so ALWAYS create intendedStatus=DRAFT, summarize the document title/commentary/gating/landing page, confirm a privacy policy exists, run the editorial check, get explicit approval, then activate via lads_update_creative. Returns creative URN in x-restli-id (201). Report later with page views, read rate, completion and lead attach. Inputs: campaign URN, document post reference OR inline post (author org + document URN + title), gatedLeadgenPreviewPageCount, name, leadgenCallToAction when objective is LEAD_GENERATION. Two-phase (parity with Google, ADR-028/029): the first call (no preview_id) reads the campaign from LinkedIn in this ad account (a nonexistent one is refused), builds the request locally and returns a preview_id — nothing is changed on LinkedIn; re-call with that preview_id and identical arguments to COMMIT (single-use, 30-min; a changed/forged/replayed token fails closed).
When to use it
Use for gated whitepaper/ebook lead-gen or ungated document promotion. Build in DRAFT, show the document title, preview-page gating count, lead form/CTA and confirm a privacy policy exists, then get explicit approval before activating. Re-preview on any change. First call lads_plan_sponsored_content_campaign for the campaign blueprint, operation ordering, and policy pre-checks.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
ad_account_id | string | yes | Numeric sponsored account ID; strip urn prefix and dashes. Server-derived from bearer scope; reject out-of-scope accounts. |
campaign | string | yes | Parent document/sponsored-content campaign URN; for gated whitepaper download both campaign type and ad form must be Whitepaper Download (WHITEPAPER_DOWNLOAD_CAMPAIGN_AD_FORM_MISMATCH). |
reference | string | no | Existing document post URN (share or ugcPost) set inside content.documentAd.reference. Mutually exclusive with inline_content. |
inline_content | object | no | createInline post: {author: urn:li:organization:{id}, commentary, visibility:PUBLIC, lifecycleState:PUBLISHED, distribution.feedDistribution:NONE, adContext:{dscAdAccount,dscStatus:ACTIVE}, content:{media:{id: urn:li:document:{id}, title}}, isReshareDisabledByAuthor:true}. Pass the post itself or {post:{...}}: the tool sends POST .../creatives?action=createInline with {creative:{inlineContent:{post}, campaign, intendedStatus}}, sets adContext.dscAdAccount to this ad account (a post naming another account is refused) and defaults visibility PUBLIC and lifecycleState PUBLISHED. gated_leadgen_preview_page_count goes on content.documentAd next to it. |
gated_leadgen_preview_page_count | integer | no | Number of pages shown before gating behind a lead form (preview begins at page 1). Applies ONLY to LeadGen content; ignored for ungated document ads. |
intended_status | string | no | Enum ACTIVE|PAUSED|DRAFT|ARCHIVED; enum-normalize upper-case; default/required DRAFT on create. |
name | string | no | Creative name (202410+); reference only. |
leadgen_call_to_action | object | no | Required if campaign objective is LEAD_GENERATION: {destination: urn:li:adForm:{id}, label e.g. DOWNLOAD/LEARN_MORE - must be a supported label or ORGANIC_STORY_UGC_INVALID_CTA_LABEL}. destination immutable post-DRAFT. |
preview_id | string | no | Omit 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. |
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
Document Ads attaching a Lead Gen Form require a privacy policy on the destination (MISSING_PRIVACY_POLICY) and a valid CTA (CTA_REQUIRED_FOR_LEAD_GEN; an unsupported label triggers ORGANIC_STORY_UGC_INVALID_CTA_LABEL). The same document/post cannot be reused across multiple LEAD_GENERATION creatives - upload it again per creative. Whitepaper-download campaign type and ad form must match (WHITEPAPER_DOWNLOAD_CAMPAIGN_AD_FORM_MISMATCH). Collect only fields the client has a lawful basis to use; lead data is subject to LinkedIn retention limits and must be used only for the authorizing client (no cross-account lead DB, no enrichment).
Reminder
Create paused, confirm the document/gating/CTA preview and that a privacy policy exists, then activate; collect only lawful lead fields and honor retention limits; strict per-account isolation.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
TOKEN_REVOKED | Access token expired/revoked; member must re-authorize. | Refresh once and retry; else needs_reauth. Never log the token. | yes |
PERMISSION_DENIED | 403 - missing rw_ads / org posting role / out-of-scope account. | Confirm scope and roles; do not retry until corrected. | no |
LEADGEN_CONFIG_INVALID | 400 CTA_REQUIRED_FOR_LEAD_GEN / WHITEPAPER_DOWNLOAD_CAMPAIGN_AD_FORM_MISMATCH / MISSING_PRIVACY_POLICY / ORGANIC_STORY_UGC_INVALID_CTA_LABEL. | Provide a matching whitepaper campaign+form, a supported CTA label, and a privacy-policy landing page; do not retry until fixed. | no |
INVALID_ARGUMENT | 400 INVALID_VALUE_NOT_EXIST (bad document URN), UGC_INVALID_SHARE_MEDIA_CATEGORY, FIELD_VALUE_TOO_LONG (title), INVALID_HREF. | Relay platform message; fix the named field; do not guess. | no |
ASSET_REUSE_BLOCKED | Reusing the same document/post in another LEAD_GENERATION creative is not allowed. | Re-upload the document and create a fresh post per creative. | no |
RESOURCE_EXHAUSTED | 429 daily app/member limit. | Honor X-RateLimit-Reset; backoff 5/10/20s cap 60s; retry once. | yes |
PLATFORM_ERROR | 500/503 transient (FAIL_TO_RETRIEVE_DIRECT_SPONSORED_CONTENT). | Retry with backoff; report if persistent; do not silently drop. | yes |
Edge cases
- gatedLeadgenPreviewPageCount only applies to LeadGen content - it is ignored for ungated document ads.
- The document must be uploaded via the Documents API first; a raw/invalid urn:li:document fails (INVALID_VALUE_NOT_EXIST).
- Two-step create can orphan a post if the creative step fails - surface the orphan URN; prefer createInline.
- Lead-gen document posts must be dark posts (feedDistribution NONE).
- Account/campaign creative caps (15,000 / 100) apply -> 400 when exceeded.
- Lead data is subject to retention limits and must not be commingled across accounts.
- Expired token -> refresh and retry once.