Skills linkedin-ads-cli
install
source · Clone the upstream repo
git clone https://github.com/openclaw/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/bin-huang/linkedin-ads-cli" ~/.claude/skills/clawdbot-skills-linkedin-ads-cli && rm -rf "$T"
manifest:
skills/bin-huang/linkedin-ads-cli/SKILL.mdsource content
LinkedIn Ads CLI Skill
You have access to
linkedin-ads-cli, a read-only CLI for the LinkedIn Marketing API (REST API, version 202603). Use it to query ad accounts, pull performance analytics with pivot breakdowns, inspect creatives, explore audiences and targeting facets, retrieve lead form submissions, and get budget and delivery forecasts.
Quick start
# Check if the CLI is available linkedin-ads-cli --help # Get authenticated user info linkedin-ads-cli me # List organizations you administer linkedin-ads-cli organization-acls # List ad accounts linkedin-ads-cli accounts
If the CLI is not installed, install it:
npm install -g linkedin-ads-cli
Authentication
The CLI requires a LinkedIn OAuth2 Bearer token. Credentials are resolved in this order:
flag (per-command)--credentials <path>- Environment variable:
LINKEDIN_ADS_ACCESS_TOKEN - Auto-detected file:
~/.config/linkedin-ads-cli/credentials.json
Required OAuth scopes depend on the commands used:
-- read ad accounts and campaignsr_ads
-- read ad analyticsr_ads_reporting
-- read organization datar_organization_social
Before running any command, verify credentials are configured by running
linkedin-ads-cli me. If it fails with a credentials error, ask the user to set up authentication.
Entity hierarchy
Organization (Company Page) +-- Ad Account (urn:li:sponsoredAccount:XXXXX) +-- Campaign Group | +-- Campaign | +-- Creative +-- Matched Audience (DMP Segment) +-- Conversion Rule +-- Insight Tag +-- Lead Gen Form
LinkedIn uses URN format for IDs (e.g.,
urn:li:sponsoredAccount:123456). The CLI accepts both full URNs and plain numeric IDs for all commands that take entity IDs.
When chaining commands, extract the numeric ID from URNs (the part after the last colon). For example,
organization-acls returns organization URNs like urn:li:organization:12345678 -- use 12345678 with the organization command.
Most list commands require the parent entity ID. Start with
me to get your profile, then organization-acls to find organizations you manage, then accounts to find ad accounts.
Monetary values
The analytics API returns monetary fields as-is from LinkedIn. The
costInLocalCurrency field is in the account's local currency and costInUsd is in USD. Both are returned as decimal string values from the API in the major currency unit (e.g. "244.85000").
Output format
All commands output pretty-printed JSON by default. Use
--format compact for single-line JSON (useful for piping).
Two pagination styles exist depending on the command:
- Token-based: uses
and--page-size
(look for--page-token
in the response for the next page)pageToken - Offset-based: uses
and--count
(increment--start
by--start
for the next page)--count
Commands reference
User & organization discovery
# Authenticated user profile linkedin-ads-cli me # Get an organization (company page) by numeric ID linkedin-ads-cli organization 12345678 # List organizations the authenticated user administers linkedin-ads-cli organization-acls linkedin-ads-cli organization-acls --role ADMINISTRATOR linkedin-ads-cli organization-acls --count 50 --start 0
organization-acls options:
-- results per page (default 100)--count <n>
-- start index (default 0)--start <n>
-- filter by role: ADMINISTRATOR, DIRECT_SPONSORED_CONTENT_POSTER, etc.--role <role>
Ad accounts
# List ad accounts linkedin-ads-cli accounts linkedin-ads-cli accounts --search "My Company" linkedin-ads-cli accounts --page-size 50 # Get a specific ad account (numeric ID or full URN) linkedin-ads-cli account 123456789 linkedin-ads-cli account urn:li:sponsoredAccount:123456789 # List users with access to an ad account linkedin-ads-cli account-users 123456789 linkedin-ads-cli account-users 123456789 --count 50 --start 0
accounts options (token-based pagination):
-- results per page (default 100)--page-size <n>
-- page token for pagination--page-token <token>
-- search by account name or ID--search <query>
account-users options (offset-based pagination):
-- results per page (default 100)--count <n>
-- start index (default 0)--start <n>
Campaign groups & campaigns
# List campaign groups for an ad account linkedin-ads-cli campaign-groups 123456789 linkedin-ads-cli campaign-groups 123456789 --page-size 50 # Get a specific campaign group linkedin-ads-cli campaign-group 987654321 # List campaigns for an ad account linkedin-ads-cli campaigns 123456789 linkedin-ads-cli campaigns 123456789 --status ACTIVE linkedin-ads-cli campaigns 123456789 --campaign-group 987654321 # Get a specific campaign linkedin-ads-cli campaign 111222333
campaign-groups options (token-based pagination):
-- results per page (default 100)--page-size <n>
-- page token for pagination--page-token <token>
campaigns options (token-based pagination):
-- results per page (default 100)--page-size <n>
-- page token for pagination--page-token <token>
-- filter by status: ACTIVE, PAUSED, ARCHIVED, COMPLETED, CANCELED, DRAFT--status <status>
-- filter by campaign group ID--campaign-group <id>
Creatives
# List creatives for an ad account linkedin-ads-cli creatives 123456789 linkedin-ads-cli creatives 123456789 --campaign 111222333 # Get a specific creative linkedin-ads-cli creative 444555666
creatives options (token-based pagination):
-- results per page (default 100)--page-size <n>
-- page token for pagination--page-token <token>
-- filter by campaign ID--campaign <campaign-id>
Analytics
The
analytics command is the primary tool for performance analysis. It requires an account ID, a date range, and supports pivot breakdowns.
# Basic analytics for a date range linkedin-ads-cli analytics 123456789 --start-date 2026-01-01 --end-date 2026-01-31 # Daily granularity with campaign pivot linkedin-ads-cli analytics 123456789 --start-date 2026-01-01 --end-date 2026-01-31 --granularity DAILY --pivot CAMPAIGN # Monthly granularity with campaign group pivot linkedin-ads-cli analytics 123456789 --start-date 2026-01-01 --end-date 2026-06-30 --granularity MONTHLY --pivot CAMPAIGN_GROUP # Account-level aggregate linkedin-ads-cli analytics 123456789 --start-date 2026-01-01 --end-date 2026-01-31 --granularity ALL --pivot ACCOUNT # Filter by specific campaigns linkedin-ads-cli analytics 123456789 --start-date 2026-01-01 --end-date 2026-01-31 --campaign-ids 111222333,444555666 # Filter by campaign groups linkedin-ads-cli analytics 123456789 --start-date 2026-01-01 --end-date 2026-01-31 --campaign-group-ids 987654321 # Custom metric fields linkedin-ads-cli analytics 123456789 --start-date 2026-01-01 --end-date 2026-01-31 --fields impressions,clicks,costInUsd
analytics options:
-- start date in YYYY-MM-DD format (required)--start-date <date>
-- end date in YYYY-MM-DD format (required)--end-date <date>
-- time granularity: DAILY, MONTHLY, ALL (default DAILY)--granularity <gran>
-- pivot dimension: CAMPAIGN, CAMPAIGN_GROUP, CREATIVE, ACCOUNT (default CAMPAIGN)--pivot <pivot>
-- filter by campaign IDs (comma-separated, numeric or URN)--campaign-ids <ids>
-- filter by campaign group IDs (comma-separated, numeric or URN)--campaign-group-ids <ids>
-- metric fields (comma-separated)--fields <fields>
Default metric fields (when
--fields is not specified): impressions, clicks, costInLocalCurrency, costInUsd, externalWebsiteConversions, likes, comments, shares, follows, videoViews
The CLI passes
--fields and --pivot values directly to the LinkedIn API without validation. Additional fields and pivot values beyond the documented defaults may be available. Refer to the LinkedIn Ad Analytics API docs for the full list.
Audiences & targeting
# List matched audiences (DMP segments) for an ad account linkedin-ads-cli audiences 123456789 linkedin-ads-cli audiences 123456789 --count 50 --start 0 # Get estimated audience size for targeting criteria linkedin-ads-cli audience-counts 123456789 # List available targeting facets (industries, job titles, locations, etc.) linkedin-ads-cli targeting-facets
audiences options (offset-based pagination):
-- results per page (default 100)--count <n>
-- start index (default 0)--start <n>
audience-counts takes only the account ID argument (no additional options).
targeting-facets takes no arguments.
Conversions & tracking
# List conversion rules for an ad account linkedin-ads-cli conversion-rules 123456789 linkedin-ads-cli conversion-rules 123456789 --count 50 # List LinkedIn Insight Tags for an ad account linkedin-ads-cli insight-tags 123456789 linkedin-ads-cli insight-tags 123456789 --count 50
conversion-rules options (offset-based pagination):
-- results per page (default 100)--count <n>
-- start index (default 0)--start <n>
insight-tags options (offset-based pagination):
-- results per page (default 100)--count <n>
-- start index (default 0)--start <n>
Lead gen
# List Lead Gen forms for an ad account linkedin-ads-cli lead-gen-forms 123456789 linkedin-ads-cli lead-gen-forms 123456789 --count 50 # List form responses (submissions) for an ad account linkedin-ads-cli lead-form-responses 123456789 linkedin-ads-cli lead-form-responses 123456789 --form 777888999 linkedin-ads-cli lead-form-responses 123456789 --start-time 1709251200000 --end-time 1711929600000
lead-gen-forms options (offset-based pagination):
-- results per page (default 100)--count <n>
-- start index (default 0)--start <n>
lead-form-responses options (offset-based pagination):
-- results per page (default 100)--count <n>
-- start index (default 0)--start <n>
-- filter by form ID (numeric or URN)--form <form-id>
-- filter responses after this time (epoch milliseconds)--start-time <time>
-- filter responses before this time (epoch milliseconds)--end-time <time>
Forecasting
# Get budget recommendations for a campaign linkedin-ads-cli budget-recommendations 111222333 # Get ad delivery forecasts for an account linkedin-ads-cli ad-forecasts 123456789
budget-recommendations takes a campaign ID (numeric or URN). No additional options.
ad-forecasts takes an account ID (numeric or URN). No additional options.
Workflow guidance
When the user asks for a quick overview
- Run
to find accessible ad accountslinkedin-ads-cli accounts - Use
with a recent date range andanalytics
for a performance snapshot--granularity ALL --pivot ACCOUNT - Present the data with key metrics (impressions, clicks, cost, conversions)
When the user asks for deep analysis
- Start with account-level analytics using
--granularity ALL --pivot ACCOUNT - Add
to identify top/bottom campaign groups--pivot CAMPAIGN_GROUP - Drill down with
for individual campaign performance--pivot CAMPAIGN - Use
with--granularity DAILY
for daily trends to spot anomalies--pivot CAMPAIGN - Filter specific campaigns with
for detailed analysis--campaign-ids - Cross-reference with
to review ad contentcreatives
When the user asks about creative performance
- Run
withanalytics
to get creative-level metrics--pivot CREATIVE - Use
to list creatives for the accountcreatives - Use
to inspect the actual creative contentcreative
When the user asks about audience and targeting
- Use
to see matched audiences (DMP segments) and their detailsaudiences - Use
to get estimated audience size for targeting criteriaaudience-counts - Use
to explore available targeting dimensions (industries, job titles, locations)targeting-facets
When the user asks about conversion tracking
- Run
to list conversion rules for the accountconversion-rules - Run
to check active Insight Tagsinsight-tags - Use
withanalytics
inexternalWebsiteConversions
to see conversion metrics--fields
When the user asks about lead gen
- Use
with the account ID to list formslead-gen-forms - Use
with the account ID to retrieve submissionslead-form-responses - Filter by specific form with
or by time range with--form
/--start-time--end-time
When the user asks about budget planning
- Use
with a campaign ID to get LinkedIn's budget suggestionsbudget-recommendations - Use
with an account ID to get delivery forecastsad-forecasts - Combine with
historical data to compare forecasts against actual performanceanalytics
Error handling
- Authentication errors -- ask the user to verify their access token and OAuth scopes
- "No credentials found" -- the user needs to set
, useLINKEDIN_ADS_ACCESS_TOKEN
, or place credentials at--credentials~/.config/linkedin-ads-cli/credentials.json - Empty analytics -- check the date range, ensure the account had active campaigns in the period, and verify the pivot dimension is appropriate
- Permission errors -- different commands require different scopes (
,r_ads
,r_ads_reporting
); check the required scopes list abover_organization_social - URN format issues -- the CLI accepts both plain numeric IDs and full URN format (e.g.,
or123456789
)urn:li:sponsoredAccount:123456789