Skip to main content

Documentation Index

Fetch the complete documentation index at: https://lava.so/docs/llms.txt

Use this file to discover all available pages before exploring further.

LinkedIn’s official Marketing API for managing the full lifecycle of LinkedIn advertising — ad accounts, campaign groups, campaigns, creatives, and ad analytics reporting. Best for agents that need to launch, optimize, or report on B2B ads on behalf of an authenticated LinkedIn advertiser. Distinguished from other ad networks by professional/firmographic targeting (job title, industry, seniority, company size) not available elsewhere. 10 example endpoints available through Lava’s AI Gateway. See the LinkedIn Ads API docs for full documentation.
This provider requires your own credentials — connect your API key or OAuth account before use.
This is a catch-all provider — any valid URL under https://api.linkedin.com is supported. LinkedIn Marketing API. Base URL: https://api.linkedin.com. Versioned endpoints live at /rest/* and require LinkedIn-Version (YYYYMM) + X-Restli-Protocol-Version: 2.0.0 headers (Lava attaches both automatically). Legacy endpoint /v2/userinfo (OIDC identity) needs no version header. Discover ad accounts via GET /rest/adAccountUsers?q=authenticatedUser; campaign groups under GET /rest/adAccounts//adCampaignGroups; campaigns under GET /rest/adAccounts//adCampaigns; creatives under GET /rest/adAccounts//creatives; ad analytics finder at GET /rest/adAnalytics?q=analytics&pivot=CAMPAIGN&timeGranularity=DAILY&dateRange=(start:(year:Y,month:M,day:D),end:(year:Y,month:M,day:D))&accounts=List(urn%3Ali%3AsponsoredAccount%3A)&fields=impressions,clicks,costInUsd. Pagination: cursor-based (pageToken/pageSize) for adAccounts/adCampaignGroups/adCampaigns/creatives; legacy start/count for some finders; adAnalytics has no pagination (chunk by date range instead). URN encoding for IDs: urn:li:sponsoredAccount:, urn:li:sponsoredCampaign:. URL-encode the colons (%3A) when embedding URNs in query parameters. Errors: Rest.li envelope . 400 with “A version must be present” = header dropped; 401 = expired token (auto-retried after refresh); 403 = wrong scope (cannot be fixed by refresh; user must re-authorize with additional scopes); 429 = rate limit, respect Retry-After. See https://learn.microsoft.com/en-us/linkedin/marketing/overview for full reference. The endpoints below are curated examples.

Endpoints

List ad accounts the authenticated user has access to. Returns role (ACCOUNT_BILLING_ADMIN, ACCOUNT_MANAGER, CAMPAIGN_MANAGER, CREATIVE_MANAGER, VIEWER) and the sponsored-account URN per assignment. Start here to discover account IDs before fetching campaigns or analytics.

GET https://api.linkedin.com/rest/adAccountUsers?q=authenticatedUser — Free
const data = await lava.gateway('https://api.linkedin.com/rest/adAccountUsers?q=authenticatedUser', { method: 'GET' });

Get an ad account by ID. Returns currency, type (BUSINESS/ENTERPRISE), status, time zone, name, and reference org URN.

GET https://api.linkedin.com/rest/adAccounts/{account_id} — Free
const data = await lava.gateway('https://api.linkedin.com/rest/adAccounts/{account_id}', { method: 'GET' });
GET https://api.linkedin.com/rest/adAccounts/{account_id}/adCampaignGroups?q=search — Free
const data = await lava.gateway('https://api.linkedin.com/rest/adAccounts/{account_id}/adCampaignGroups?q=search', { method: 'GET' });

Create a new campaign group. Account reference goes in the body as a sponsoredAccount URN. New campaign groups default to DRAFT; set status to ACTIVE to start serving once child campaigns are configured.

POST https://api.linkedin.com/rest/adCampaignGroups — Free
const data = await lava.gateway('https://api.linkedin.com/rest/adCampaignGroups', {
  body: {
"account": "urn:li:sponsoredAccount:{account_id}",
"name": "Q2 Awareness",
"status": "DRAFT",
"totalBudget": {
  "amount": "5000",
  "currencyCode": "USD"
}
},
});

List campaigns under an ad account. Each campaign sits inside a campaign group and carries targeting, bidding, schedule, and creative associations. Supports cursor-based pagination via pageToken/pageSize.

GET https://api.linkedin.com/rest/adAccounts/{account_id}/adCampaigns?q=search — Free
const data = await lava.gateway('https://api.linkedin.com/rest/adAccounts/{account_id}/adCampaigns?q=search', { method: 'GET' });

Create a new campaign. Requires campaignGroup URN, sponsoredAccount URN, type (TEXT_AD, SPONSORED_UPDATES, etc.), objectiveType (BRAND_AWARENESS, WEBSITE_VISITS, etc.), unitCost, and targetingCriteria. Defaults to DRAFT; activate by updating status to ACTIVE.

POST https://api.linkedin.com/rest/adCampaigns — Free
const data = await lava.gateway('https://api.linkedin.com/rest/adCampaigns', {
  body: {
"account": "urn:li:sponsoredAccount:{account_id}",
"campaignGroup": "urn:li:sponsoredCampaignGroup:{campaign_group_id}",
"name": "Senior Engineers — US",
"type": "SPONSORED_UPDATES",
"objectiveType": "WEBSITE_VISITS",
"status": "DRAFT",
"costType": "CPM",
"unitCost": {
  "amount": "25.00",
  "currencyCode": "USD"
},
"dailyBudget": {
  "amount": "100.00",
  "currencyCode": "USD"
},
"targetingCriteria": {
  "include": {
    "and": [
      {
        "or": {
          "urn:li:adTargetingFacet:locations": [
            "urn:li:geo:103644278"
          ]
        }
      }
    ]
  }
}
},
});

List creatives under an ad account. Each creative references a sponsored campaign and a content URN (post, video, document, etc.). Use search.test=true|false to filter test creatives.

GET https://api.linkedin.com/rest/adAccounts/{account_id}/creatives?q=criteria — Free
const data = await lava.gateway('https://api.linkedin.com/rest/adAccounts/{account_id}/creatives?q=criteria', { method: 'GET' });

Fetch ad performance analytics. Specify q=analytics or q=statistics, a pivot dimension (CAMPAIGN, CREATIVE, ACCOUNT, MEMBER_COUNTRY_V2, etc.), timeGranularity (DAILY/MONTHLY/YEARLY/ALL), a dateRange tuple, an accounts List of sponsoredAccount URNs, and a fields list (impressions, clicks, costInUsd, conversions, etc.). Returns an elements array; this endpoint does not support pagination — chunk by date range for large result sets.

GET https://api.linkedin.com/rest/adAnalytics?q=analytics&pivot=CAMPAIGN&timeGranularity=DAILY&dateRange=(start:(year:2026,month:5,day:1),end:(year:2026,month:5,day:18))&accounts=List(urn%3Ali%3AsponsoredAccount%3A{account_id})&fields=impressions,clicks,costInUsd,conversions — Free
const data = await lava.gateway('https://api.linkedin.com/rest/adAnalytics?q=analytics&pivot=CAMPAIGN&timeGranularity=DAILY&dateRange=(start:(year:2026,month:5,day:1),end:(year:2026,month:5,day:18))&accounts=List(urn%3Ali%3AsponsoredAccount%3A{account_id})&fields=impressions,clicks,costInUsd,conversions', { method: 'GET' });

Update a campaign (status, budget, schedule, targeting, bidding). LinkedIn uses Rest.li partial-update semantics: the body is wrapped in { patch: { $set: { ... } } }. The most common use is activating a campaign by setting status from DRAFT to ACTIVE.

PATCH https://api.linkedin.com/rest/adCampaigns/{campaign_id} — Free
const data = await lava.gateway('https://api.linkedin.com/rest/adCampaigns/{campaign_id}', { method: 'PATCH', body: {"patch":{"$set":{"status":"ACTIVE"}}} });

Delete a creative by URN. Only DRAFT creatives can be deleted; ACTIVE creatives must be archived (PATCH status to ARCHIVED) instead. URL-encode the URN colons (%3A).

DELETE https://api.linkedin.com/rest/creatives/urn%3Ali%3AsponsoredCreative%3A{creative_id} — Free
const data = await lava.gateway('https://api.linkedin.com/rest/creatives/urn%3Ali%3AsponsoredCreative%3A{creative_id}', { method: 'DELETE' });

Next Steps

All Providers

Browse all supported AI providers

Forward Proxy

Learn how to construct proxy URLs and authenticate requests