lads_create_company_list
LinkedIn Ads write high risk
Part of the LinkedIn Audience Agent.
What it does
Create and populate a COMPANY-type Matched Audience (ABM company-list targeting). First stage a type=COMPANY DMP segment (POST /rest/dmpSegments), then add companies via POST /rest/dmpSegments/{id}/companies with X-RestLi-Method: BATCH_CREATE (up to 5000 companies/batch), matching by company name + domain (and optional website / LinkedIn organization URN). Two calls: without segment_id the tool creates the segment (sourcePlatform DIRECT_API unless given, destinations LINKEDIN) and returns its id in x-restli-id; companies are NOT sent in that call. After ~5 seconds, re-call with segment_id and the companies to upload them (a per-company batch response; surface partial matches and unmatched rows). Preview->approve->execute->log on each call: show the segment name, company count, and match keys. Must reach >=300 matched companies/members to serve. Uploaded lists need a lawful basis. Batch cap: at most 5,000 rows per call (rejected pre-API above that). LinkedIn returns PER-ELEMENT statuses — a success envelope does not mean every row landed; failed rows are surfaced as warnings referencing their batchIndex. Without rw_dmp_segments, which Scalix requests only once LinkedIn approves its Audiences program (SCALIX_LINKEDIN_EXTRA_SCOPES), the call is refused at preview (access_gated). Two-phase (parity with Google, ADR-028/029): the first call (no preview_id) builds the request locally (without segment_id it reads the ad account and refuses a test account, where LinkedIn allows no segment; with segment_id it first reads the segment from LinkedIn: a missing segment, one in an ad account the user has not enabled, or a USER segment is refused) 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 to stand up an account-based-marketing company target list for a campaign. Confirm the list source and account, then create + upload. Do NOT mix company data across clients or upload into a USER-type segment.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
account | string | yes | Sponsored account; normalize to urn:li:sponsoredAccount:{id} (strip dashes/whitespace). Within bearer scope. |
name | string | yes | Audience/segment name. Trim. |
companies | array | no | Company rows (max 5000 per batch), sent only with segment_id (a new segment is created without them). A bare string -> companyName (or organizationUrn if it is a urn:li:organization). A row object uses identity fields companyName / organizationUrn / companyWebsiteDomain / companyPageUrl (NOT a 'company' field); action defaults to ADD. Provide name+domain for best match. |
source_platform | string | no | sourcePlatform for a NEW segment (no segment_id; default DIRECT_API: LinkedIn requires one, and this tool streams companies in with segment_id): pass LIST_UPLOAD for a CSV company list — the tool sets type=COMPANY_LIST_UPLOAD automatically; DIRECT_API/AGENCY_API/PARTNER_API create a streaming COMPANY segment. |
segment_id | string | no | Existing COMPANY segment id to append to; if omitted, a new segment is created. |
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
Company-list (ABM) uploads must have a lawful basis; the audience serves only at >=300 matched members. Anti-discrimination rules still apply to any campaign targeting this list. Operate only within the bearer's scoped account; never build a cross-account company database.
Reminder
Upload only consented company data for the authorizing client; never build a cross-account company database; audience serves at >=300 matches.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
PARTIAL_FAILURE | Some companies failed to match/add (per-row 400 with batchIndex). | Return per-row match results; report unmatched companies and suggest adding domains/URNs; retry only failed rows. | no |
INVALID_ARGUMENT | Bad payload, wrong segment type, >5000 companies, or missing source_platform on new-segment create (400) — surface message. | Ensure segment type is COMPANY, rows have name/domain, chunk to <=5000, supply source_platform when creating; fix and retry. | no |
PERMISSION_DENIED | No write access / missing rw_dmp_segments (403). | Verify role/scope; re-auth if needed (needs_reauth). | no |
RESOURCE_EXHAUSTED | Rate limit (429). | Backoff 5/10/20s cap 60s; chunk + throttle. | yes |
TOKEN_REVOKED | Token expired/revoked (401). | Refresh and retry once; else re-auth. | yes |
NOT_FOUND | Supplied segment_id not found (404). | Confirm the COMPANY segment id or omit to create a new one. | no |
Edge cases
- Low match rate when only company names are provided -> recommend including domains/organization URNs; report matched vs uploaded counts.
- Below 300 matched -> won't serve; warn explicitly.
- Newly created segment may need ~5s before companies can be added -> wait/retry once.
- Appending to a USER segment is invalid -> route to lads_add_segment_users.
- Lists >5000 must be chunked.
- Idempotent re-add of an already-matched company is a no-op.
- A LinkedIn test ad account refuses every segment (SEGMENT_CREATION_NOT_ALLOWED_FOR_TEST_ACCOUNTS): the error says so and to create it on a real ad account.