lads_create_lead_form
LinkedIn Ads write high risk
Part of the Lead Gen Agent.
What it does
Create a Lead Gen Form. POST /rest/leadForms (versioned, multi-locale schema). Top-level: name, owner (a union object — {"sponsoredAccount":"urn:li:sponsoredAccount:{id}"} or {"organization":"urn:li:organization:{id}"}), creationLocale (the tool defaults {country:US, language:en}), and state (REQUIRED by LinkedIn — the tool defaults DRAFT). Everything else is nested under `content`: headline + description (the tool wraps your plain strings into the required localized form {localized:{en_US:...}}), the `questions` array (pass a simple {predefinedField,...} per question — the tool expands it to the versioned union shape), and `legalInfo` — the privacy policy URL goes to content.legalInfo.privacyPolicyUrl (there is NO top-level/`content.privacyPolicyUrl`). Preview->approve->execute->log: show the full field list, privacy policy, and copy; get explicit approval that only lawful-basis fields are collected; then create. On success returns HTTP 201 with the form id in the x-restli-id header (urn:li:leadGenForm:{id}). Org-owned creation requires r_marketing_leadgen_automation and an org role. Anti-discrimination and editorial standards apply; collected lead data is subject to retention limits. A form without a headline, at least one question or an https privacy policy URL is refused at preview, and so is a question that asks for gender (policy_violation: Scalix policy, although LinkedIn offers GENDER). Two-phase (parity with Google, ADR-028/029): the first call (no preview_id) builds the request locally and returns a preview_id — nothing is sent to 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 to build a Lead Gen Form for a lead-generation campaign in one step. Push the user to confirm the field list is minimal and lawful and the privacy policy URL is correct, then create. Do NOT request sensitive/protected-attribute fields, omit the privacy policy, or try to create a form owned by a LinkedIn Page (unsupported). First call lads_plan_lead_gen_campaign for the campaign blueprint, operation ordering, and policy pre-checks.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
owner | string | yes | Owner URN — a BARE urn:li:sponsoredAccount:{id} (ad form) or urn:li:organization:{id} (organic) STRING; the tool wraps it into the required owner union server-side. Within bearer scope. |
name | string | yes | Internal form name. Trim. |
headline | string | yes | Plain headline string; the tool wraps it into content.headline={localized:{en_US:...}}. Respect editorial standards (no ALL CAPS). |
description | string | no | Plain description string; the tool wraps it into content.description={localized:{en_US:...}}. |
questions | array | yes | Each question must be an object. It may be a SIMPLE {predefinedField, name?, label?, required?} (label is the question text, question/q are read too; name, which LinkedIn requires and which must be unique in the form, defaults to the field id or a slug of the text) where predefinedField is one of LinkedIn's PredefinedField ids (FIRST_NAME, LAST_NAME, EMAIL, WORK_EMAIL, PHONE_NUMBER, WORK_PHONE_NUMBER, CITY, STATE, COUNTRY, ZIP_CODE, COMPANY_NAME, COMPANY_SIZE, INDUSTRY, JOB_TITLE, JOB_FUNCTION, SENIORITY, DEGREE, FIELD_OF_STUDY, SCHOOL, START_DATE, GRADUATION_DATE, LINKEDIN_PROFILE_LINK; common spellings such as postal_code -> ZIP_CODE and work_phone -> WORK_PHONE_NUMBER are normalised, any other id is rejected before the API call - send a custom question instead; LinkedIn also offers GENDER, but a question whose field, name or text asks for gender is refused, policy_violation, Scalix policy) — the tool expands it to the versioned shape (question.localized + name + questionDetails:{textQuestionDetails} + predefinedField sibling + responseRequired) — OR a full versioned question (passed through). predefinedField is a SIBLING of questionDetails, NOT a questionDetails union member. Only request fields the client has a lawful basis for. |
privacy_policy_url | string | yes | REQUIRED privacy policy URL; the tool places it at content.legalInfo.privacyPolicyUrl. Must be a valid HTTPS URL. |
confirmation_message | string | no | Thank-you message shown after submit -> content.postSubmissionInfo.message (localized). Defaulted if a cta is given but this is omitted. |
cta | string|object | no | Post-submit call-to-action -> content.postSubmissionInfo.callToAction. A label enum (VISIT_COMPANY_WEBSITE|LEARN_MORE|VIEW_NOW|DOWNLOAD_NOW|TRY_NOW) or an object {label, landing_page/url} (a JSON-encoded object is parsed); any other label is refused before the API call. Defaults to VISIT_COMPANY_WEBSITE when confirmation_message is set without it. |
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
Lead Gen Form: only collect fields the client has a lawful basis to use; a valid privacy policy URL is mandatory; copy must meet LinkedIn editorial standards and, for employment/housing/education/credit, must NOT solicit or imply protected-attribute discrimination (age off for recruitment). Lead responses (member PII) must be forwarded to the client's system and purged per retention limits (profile <=24h / social activity <=48h); LinkedIn stores responses up to 365 days. Do not attempt Page/Showcase Page form creation — it is unsupported.
Reminder
Collect only lawful-basis fields, attach the client's privacy policy, and never use captured leads to build a cross-account database or enrich profiles.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
INVALID_ARGUMENT | missing privacy policy URL, too many custom questions (>3), malformed question shape (missing localized/name/questionDetails), or custom question over the max length (400) — surface message. | Pass owner as a bare urn:li:sponsoredAccount / urn:li:organization string, use question.localized+name+questionDetails (predefinedField, not fieldType), trim to limits, and provide a valid HTTPS privacy policy URL; do not guess. | no |
UNSUPPORTED_OWNER | Owner is a LinkedIn Page / Showcase Page — Page-owned form creation is no longer supported (400). | Create the form under a sponsoredAccount or organization owner instead; block Page-owned creation. | no |
POLICY_VIOLATION | A question asks for gender, which Scalix policy keeps off every lead form; nothing was sent. Other protected-attribute questions and editorial problems are not detected. | Remove the question the message names, then call again. | no |
PERMISSION_DENIED | No write access to the owner sponsoredAccount/org, or missing scope (rw_ads, or r_marketing_leadgen_automation for org-owned) (403). | Verify the sponsoredAccount/org admin role + required scope; re-auth if needed (needs_reauth). | no |
TOKEN_REVOKED | Token expired/revoked (401). | Refresh and retry once; else re-auth. | yes |
RESOURCE_EXHAUSTED | Rate limit (429). | Backoff 5/10/20s cap 60s; respect Retry-After. | yes |
PLATFORM_ERROR | LinkedIn 5xx. | Retry with backoff. | yes |
Edge cases
- owner is a bare sponsoredAccount/organization URN string; the tool wraps it into the union — do NOT pass a pre-wrapped object.
- On success the form id is returned in the x-restli-id response header (HTTP 201), not in the body — read it from there.
- LinkedIn Page / Showcase Page-owned form creation is unsupported -> reject before send.
- More than 3 custom questions -> reject with guidance.
- Custom question text over the platform max length -> reject before send.
- Missing/invalid privacy policy URL -> hard block (mandatory).
- A question that asks for gender is refused on every form (policy_violation, Scalix policy). Recruitment/employment forms must also be gender-neutral, non-age-coded and not request other protected attributes.
- Created form typically starts unpublished -> remind it must be attached to a creative/campaign to collect leads.
- Idempotency: re-running creates a duplicate form; check existing forms first.