For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inBook a demo
GuidesAPI Reference
Logo
GuidesAPI Reference
  • Getting started
    • Introduction
    • IP Whitelisting
    • Obtaining API keys
    • LLMs.txt
    • MCP server
    • Quickstart
    • Native clients
    • Concepts
    • Embedding authentication
    • Multitenancy
    • Versioning
    • Idempotent requests
    • Events
    • Self-hosted option
    • 2025-09-18 Migration Guide
  • Configuring your connections
    • Overview
    • CDC streaming from databases
    • Syncing to custom webhooks
  • Code examples
    • Overview
    • Bulk sync (ELT) from HubSpot to PostgreSQL
    • Bulk sync (ELT) from Salesforce to S3
    • Bulk sync (ELT) from Salesforce to Snowflake
    • Model sync (Reverse ETL) from Snowflake query to Salesforce
    • Model sync (Reverse ETL) from MongoDB to Salesforce
    • Adding users from Snowflake to Salesloft Cadence
    • Adding contacts from Snowflake to Gong Engage
    • Joined model sync from Postgres, Airtable, and Stripe to Hubspot
    • Model sync from MySQL to Snowflake
    • Model sync from Salesforce to Netsuite
    • Querying Salesforce using SOQL
    • Syncing audiences from Snowflake to LinkedIn Ads
    • Syncing contacts from Google Cloud Storage to Salesforce
    • Syncing contacts from Google Cloud Storage to webhooks
    • Transactional calls with LinkedIn Ads audiences
  • Terraform examples
    • Overview
    • Model sync (Reverse ETL) from BigQuery to Salesforce
    • Model sync (Reverse ETL) from BigQuery to LinkedIn Ads
Log inBook a demo
On this page
  • 1. Get a DMP segment
  • 2. Get multiple DMP segments
  • 3. Add or remove a company audience member
  • 4. Batch add or remove companies
  • 5. Batch add or remove users
  • 6. Add or remove a single user
  • 7. Create a DMP segment
Code examples

Transactional calls with LinkedIn Ads audiences

Was this page helpful?
Previous

Overview

Next

The connection proxy lets you call LinkedIn’s API directly through a Polytomic LinkedIn Ads Connection. Polytomic authenticates the request and injects the required LinkedIn headers automatically — you only need to supply the method, path, and body.

Set your Polytomic API key as an environment variable:

$export POLYTOMIC_API_KEY=YOUR-API-TOKEN
Proxy info

Call GET /api/connections/{id}/proxy/info to inspect the inherited base URL, locked headers, allowed methods, and rate limits before building requests dynamically.

1. Get a DMP segment

Retrieve a single DMP segment by ID.

cURL
Python
Typescript
Go
$curl --request POST \
> --url "https://app.polytomic.com/api/connections/${LINKEDIN_CONNECTION_ID}/proxy" \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "X-Polytomic-Version: 2025-09-18" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> -d '{
> "request": {
> "method": "GET",
> "path": "/dmpSegments/11204"
> }
> }'

2. Get multiple DMP segments

Retrieve several segments in one call using LinkedIn’s ids=List(...) query syntax. Use rawQuery instead of query for non-standard query strings like this one.

cURL
Python
Typescript
Go
$curl --request POST \
> --url "https://app.polytomic.com/api/connections/${LINKEDIN_CONNECTION_ID}/proxy" \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "X-Polytomic-Version: 2025-09-18" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> -d '{
> "request": {
> "method": "GET",
> "path": "/dmpSegments",
> "rawQuery": "ids=List(10804,10814)"
> }
> }'

3. Add or remove a company audience member

Add or remove a single company from a DMP segment.

cURL
Python
Typescript
Go
$curl --request POST \
> --url "https://app.polytomic.com/api/connections/${LINKEDIN_CONNECTION_ID}/proxy" \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "X-Polytomic-Version: 2025-09-18" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> -d '{
> "request": {
> "method": "POST",
> "path": "/dmpSegments/10804/companies",
> "body": {
> "action": "ADD",
> "companyName": "LinkedIn",
> "companyWebsiteDomain": "linkedin.com",
> "companyPageUrl": "www.linkedin.com/company/linkedin",
> "stockSymbol": "MSFT",
> "industries": ["information technology", "software"],
> "city": "Seattle",
> "state": "WA",
> "country": "US"
> }
> }
> }'

4. Batch add or remove companies

Add or remove multiple companies in a single request. Pass X-RestLi-Method: BATCH_CREATE as a per-request header via request.headers.

cURL
Python
Typescript
Go
$curl --request POST \
> --url "https://app.polytomic.com/api/connections/${LINKEDIN_CONNECTION_ID}/proxy" \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "X-Polytomic-Version: 2025-09-18" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> -d '{
> "request": {
> "method": "POST",
> "path": "/dmpSegments/10804/companies",
> "headers": {
> "X-RestLi-Method": "BATCH_CREATE"
> },
> "body": {
> "elements": [
> {"action": "ADD", "companyName": "LinkedIn"},
> {"action": "ADD", "companyName": "Microsoft"}
> ]
> }
> }
> }'

5. Batch add or remove users

Add multiple users to a segment in one request. Each element can carry one or more identity types (SHA256_EMAIL, GOOGLE_AID, etc.) and optional profile attributes.

cURL
Python
Typescript
Go
$curl --request POST \
> --url "https://app.polytomic.com/api/connections/${LINKEDIN_CONNECTION_ID}/proxy" \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "X-Polytomic-Version: 2025-09-18" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> -d '{
> "request": {
> "method": "POST",
> "path": "/dmpSegments/10804/users",
> "body": {
> "elements": [
> {
> "action": "ADD",
> "userIds": [
> {"idType": "SHA256_EMAIL", "idValue": "692682111bc191d915ac7009d118a78bc496cf7a2ba8c2d0134ade012ac1234"},
> {"idType": "GOOGLE_AID", "idValue": "cffg876e-gm9v-98de-0013d927s873"}
> ]
> },
> {
> "action": "ADD",
> "userIds": [
> {"idType": "SHA256_EMAIL", "idValue": "09d118a78b69261bc191d915ac70c496cf7a9e0502ba8c2d016f2f134ade"},
> {"idType": "GOOGLE_AID", "idValue": "cdda802e-12cd-fb9c-47ad-0794d394c912"}
> ],
> "firstname": "mike",
> "lastname": "smith"
> }
> ]
> }
> }
> }'

6. Add or remove a single user

Add or remove one user from a segment, optionally including profile attributes to improve match rates.

cURL
Python
Typescript
Go
$curl --request POST \
> --url "https://app.polytomic.com/api/connections/${LINKEDIN_CONNECTION_ID}/proxy" \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "X-Polytomic-Version: 2025-09-18" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> -d '{
> "request": {
> "method": "POST",
> "path": "/dmpSegments/10804/users",
> "body": {
> "action": "ADD",
> "userIds": [
> {"idType": "SHA256_EMAIL", "idValue": "09d118a78b69261bc191d915ac70c496cf7a9e0502ba8c2d016f2f134ade"},
> {"idType": "GOOGLE_AID", "idValue": "cdda802e-fb9c-47ad-0794d394c912"}
> ],
> "firstname": "mike",
> "lastname": "smith",
> "titleName": "software engineer",
> "companyName": "microsoft",
> "countryName": "us"
> }
> }
> }'

7. Create a DMP segment

Create a new DMP segment and associate it with a LinkedIn Ads account.

cURL
Python
Typescript
Go
$curl --request POST \
> --url "https://app.polytomic.com/api/connections/${LINKEDIN_CONNECTION_ID}/proxy" \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "X-Polytomic-Version: 2025-09-18" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> -d '{
> "request": {
> "method": "POST",
> "path": "/dmpSegments",
> "body": {
> "name": "DMP Segment 1",
> "sourcePlatform": "DMP_PARTNER_PLATFORM",
> "account": "urn:li:sponsoredAccount:516848833",
> "type": "USER",
> "destinations": [
> {"destination": "LINKEDIN"}
> ]
> }
> }
> }'