SCALIX help

← All tools

lads_create_dmp_segment

LinkedIn Ads write medium risk

Part of the LinkedIn Audience Agent.

What it does

Create an empty Matched Audience DMP segment (a staging entity that maps uploaded first/third-party data to LinkedIn member profiles and outputs an Ad Segment). POST /rest/dmpSegments with account (sponsoredAccount URN), name, type (USER | COMPANY | USER_LIST_UPLOAD | COMPANY_LIST_UPLOAD; paired with sourcePlatform), sourcePlatform (the partner-platform ENUM LinkedIn assigns at DMP/Audiences approval), and destinations:[{destination:'LINKEDIN'}]. Returns 201 with the new segment id in the x-restli-id header (id is a long; the served audience is exposed as destinations[].destinationSegmentId = urn:li:adSegment:{id}). Preview->approve->execute->log: this tool only stages the EMPTY segment; show the user the account, name, type, and intended use, get explicit approval, then create. The segment will NOT serve ads until it is populated AND reaches >=300 matched members (LinkedIn audience floor). After creation, wait ~5s before streaming users (eventual consistency). Requires the separately-approved rw_dmp_segments scope (not granted automatically with the Marketing Developer Platform); uploaded data must have lawful consent and is treated as sensitive PII subject to retention limits. 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) reads the ad account from LinkedIn (a test account is refused: LinkedIn allows no segment there), 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 when the client wants to build a Matched Audience for retargeting, contact targeting, or ABM company targeting and you must first stage the empty segment before uploading. Confirm consent and the correct account, then create. Do NOT create segments speculatively or in an account outside the bearer's scope.

Inputs

NameTypeRequiredDescription
accountstringyesSponsored ad account. Accept bare id or full URN; normalize to urn:li:sponsoredAccount:{id} (strip any dashes/whitespace). Must be within the bearer's scoped accounts.
namestringyesHuman-readable segment name shown in Campaign Manager. Trim whitespace.
typestringyesContent type of imported profiles. Enum-normalize to uppercase: USER | COMPANY | USER_LIST_UPLOAD | COMPANY_LIST_UPLOAD. Paired with sourcePlatform: streaming types (USER|COMPANY) use DIRECT_API|AGENCY_API|PARTNER_API; CSV list-upload types (USER_LIST_UPLOAD|COMPANY_LIST_UPLOAD) use LIST_UPLOAD. Passing USER/COMPANY with sourcePlatform=LIST_UPLOAD auto-composes to the compound *_LIST_UPLOAD type (a note says so); an illegal pair is rejected before the API call.
source_platformstringyesThe partner-platform ENUM string LinkedIn provisions when DMP/Audiences access is granted. Required; do not guess — pass the exact value LinkedIn assigned.
descriptionstringnoOptional free-text description. Trim.
source_segment_idstringnoOptional foreign key on the source platform; indexed for later lookup.
destinationsarraynoOnboarding destinations; default [{destination:'LINKEDIN'}] (only LINKEDIN accepted).
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.

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

Matched Audiences upload: uploaded lists must have member consent and a lawful basis; treat all uploaded identifiers as sensitive PII and honor retention limits (no enrichment, no cross-account pooling). Segment will not deliver until >=300 members are matched (LinkedIn audience floor). Anti-discrimination rules apply to any campaign that later targets this segment. Operate only within the bearer's scoped account.

Reminder

Uploaded audience data is sensitive PII for the authorizing client only — never pool, enrich, or retain beyond policy; segments serve only at >=300 matched members.

Errors

Error classMeansWhat to doRetry
PERMISSION_DENIEDNo WRITE access to the sponsored account, or the rw_dmp_segments scope (Audiences program) is not granted to this bearer (403).Confirm the member holds a write role on the account and that DMP/Audiences access was approved; re-auth if scope is missing (needs_reauth).no
INVALID_ARGUMENTMalformed request — surface LinkedIn's message verbatim (e.g. bad sourcePlatform ENUM, invalid type, missing/invalid destinations).Fix the offending field per the surfaced message; do not guess the sourcePlatform value.no
TOKEN_REVOKEDAccess token expired or revoked (401).Refresh the access token and retry once; if refresh fails, prompt re-authorization (needs_reauth).yes
RESOURCE_EXHAUSTEDRate limit exceeded (429).Exponential backoff 5/10/20s capped at 60s; respect Retry-After / X-RateLimit-Reset if present.yes
PLATFORM_ERRORLinkedIn 5xx while creating the segment.Retry with backoff; if persistent, report to the user that LinkedIn is unavailable.yes

Edge cases

  • Created segment is empty and will NOT serve until populated and >=300 members match — return success with a warning to add users and that the audience may take hours to build.
  • destinationSegmentId may be absent immediately after creation (status BUILDING); surface that the served urn:li:adSegment appears only after onboarding begins.
  • type=COMPANY routes population to the segment-companies endpoint, not the users endpoint — pair with lads_create_company_list, not lads_add_segment_users.
  • Idempotency: re-running with the same name does NOT dedupe — it creates a second segment; list existing segments first and warn if a same-named segment already exists for the account.
  • Account outside bearer scope -> hard block before the call (per-account isolation).
  • A sponsored account can hold at most 1,000 DMP segments (LinkedIn 429 SEGMENT_LIMIT_EXCEEDED once full).
  • 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.