agent-ads
01
Step 01

Authenticate

LinkedIn v1 uses an access token only. Store it once in your OS credential store:

Primary command
Authenticate
bash
agent-ads linkedin auth set

Or set a shell variable for the current process:

bash
export LINKEDIN_ADS_ACCESS_TOKEN=access-token

Optional default account:

bash
export LINKEDIN_ADS_DEFAULT_ACCOUNT_ID=1234567890
02
Step 02

Verify your setup

Add --api to also ping the LinkedIn Marketing API and confirm the token works.

Primary command
Verify your setup
bash
agent-ads linkedin doctor

Add --api to also ping the LinkedIn Marketing API and confirm the token works.

03
Step 03

Discover your ad accounts

Primary command
Discover your ad accounts
bash
agent-ads linkedin ad-accounts list
agent-ads linkedin ad-accounts search --status ACTIVE
04
Step 04

Explore campaigns and creatives

Primary command
Explore campaigns and creatives
bash
agent-ads linkedin campaign-groups list --account-id 1234567890
agent-ads linkedin campaigns list --account-id 1234567890
agent-ads linkedin creatives list --account-id 1234567890
05
Step 05

Pull a reporting query

Primary command
Pull a reporting query
bash
agent-ads linkedin analytics query \
  --finder statistics \
  --account-id 1234567890 \
  --pivot CAMPAIGN \
  --time-granularity DAILY \
  --since 2026-03-01 \
  --until 2026-03-16 \
  --fields impressions,clicks,costInLocalCurrency
Reference

LinkedIn guides

1 guides — exact flags, auth details, and workflow notes.

Guide

LinkedIn Guide

This is the provider guide for LinkedIn Marketing API work in agent-ads.

This is the provider guide for LinkedIn Marketing API work in agent-ads.

Start Here

TaskFirst command
Set up auth or inspect configagent-ads linkedin doctor
List accessible ad accountsagent-ads linkedin ad-accounts list
Search or fetch one ad accountagent-ads linkedin ad-accounts search / get --account-id <id>
Explore campaign groups or campaignsagent-ads linkedin campaign-groups list --account-id <id> / campaigns list --account-id <id>
Inspect creativesagent-ads linkedin creatives list --account-id <id>
Run reportingagent-ads linkedin analytics query --finder ... --account-id <id> ...

Auth Model

LinkedIn v1 uses one credential:

CredentialPersistent storageShell override
Access tokenagent-ads linkedin auth setLINKEDIN_ADS_ACCESS_TOKEN

Optional defaults:

Variable / configPurpose
LINKEDIN_ADS_DEFAULT_ACCOUNT_ID / providers.linkedin.default_account_idDefault ad account for scoped commands
LINKEDIN_ADS_API_VERSION / providers.linkedin.api_versionOverride the Linkedin-Version header (default 202603)

Command Model

  • ad-accounts list discovers accessible accounts through the authenticated-user account-access surface and adds authenticated_user_role to each hydrated account object.
  • ad-accounts search stays account-native and returns raw LinkedIn account search results without role enrichment.
  • campaign-groups list, campaigns list|get, and creatives list|get stay provider-native and map directly to LinkedIn Marketing API resources.
  • analytics query wraps LinkedIn adAnalytics finder queries.
  • Keep LinkedIn finder semantics intact. Do not remap them into Meta/TikTok insights query.

ID Rules

  • --account-id, --campaign-group-id, and --campaign-id accept either raw numeric IDs or full URNs.
  • --creative-id accepts a numeric ID or a sponsored creative URN and is normalized to a URN internally.
  • Search and analytics filters use URNs where LinkedIn expects them.

Pagination

LinkedIn list commands use cursor pagination:

FlagMeaning
--page-token <token>Resume from metadata.nextPageToken
--page-size <n>Items per API request
--allFollow all pages
--max-items <n>Stop after N items

LinkedIn report queries use offset pagination:

FlagMeaning
--start <n>Start offset for the first report page
--page-size <n> / --count <n>Rows per API request
--allFollow all report pages
--max-items <n>Stop after N report rows

Reporting Finder Rules

  • --finder analytics: exactly one --pivot, requires --time-granularity
  • --finder statistics: one to three --pivot values, requires --time-granularity
  • --finder attributed-revenue-metrics: one to three pivots, only ACCOUNT, CAMPAIGN_GROUP, CAMPAIGN, requires both --since and --until, 30-366 day range, within the last year

Common Mistakes

  • Forgetting --account-id on scoped commands without setting a default
  • Passing --creative-id to --finder attributed-revenue-metrics
  • Mixing raw IDs and URNs inconsistently in shell scripts instead of letting the CLI normalize them
  • Expecting write operations; LinkedIn support in agent-ads is read-only