A LinkedIn Ads API mock for organizing campaigns.
Give your agent seeded ad accounts, campaigns and creatives. Check its campaign-group creation call, then retrieve the group’s status and budget.
campaign_group_createdCalls POST /rest/adAccounts/*/adCampaignGroups
Starting records
accounts
- id
501001- status
ACTIVE- name
Acme · US growth- currency
USD
campaignGroups
- id
601001- status
ACTIVE- name
Q4 enterprise pipeline
Connect your agent to the LinkedIn Ads mock
When ancha runs your agent, it sets:
LINKEDIN_ADS_API_URLLINKEDIN_ADS_TOKEN
Point the client you already use at them.
const response = await fetch(process.env.LINKEDIN_ADS_API_URL + '/rest/adAccounts?q=search', { headers: { Authorization: 'Bearer ' + process.env.LINKEDIN_ADS_TOKEN, 'LinkedIn-Version': '202610', 'X-Restli-Protocol-Version': '2.0.0' } });
const accounts = await response.json();Locally, ancha runs your agent as an ordinary process, so keep real LinkedIn Ads credentials out of its environment.
See all 17 endpoints
adAccounts
/rest/adAccounts/rest/adAccounts/:accountIdadAnalytics
/rest/adAnalyticsadCampaignGroups
/rest/adAccounts/:accountId/adCampaignGroups/rest/adAccounts/:accountId/adCampaignGroups/rest/adAccounts/:accountId/adCampaignGroups/:id/rest/adAccounts/:accountId/adCampaignGroups/:idadCampaigns
/rest/adAccounts/:accountId/adCampaigns/rest/adAccounts/:accountId/adCampaigns/rest/adAccounts/:accountId/adCampaigns/:id/rest/adAccounts/:accountId/adCampaigns/:idadTargetingEntities
/rest/adTargetingEntitiesadTargetingFacets
/rest/adTargetingFacetscreatives
/rest/adAccounts/:accountId/creatives/rest/adAccounts/:accountId/creatives/rest/adAccounts/:accountId/creatives/:id/rest/adAccounts/:accountId/creatives/:idSeed your own data
The data the LinkedIn Ads mock starts with on every run, cut to a few records. ancha twins seed linkedin-ads prints every field.
Full seed YAML
twins:
- linkedin-ads
seed:
linkedin-ads:
accounts:
- id: 501001
name: Acme · US growth
currency: USD
status: ACTIVE
type: BUSINESS
reference: urn:li:organization:71001
campaignGroups:
- account: urn:li:sponsoredAccount:501001
name: Q4 enterprise pipeline
status: ACTIVE
runSchedule:
start: 1790812800000
totalBudget:
amount: "12000.00"
currencyCode: USD
id: 601001
campaigns:
- account: urn:li:sponsoredAccount:501001
campaignGroup: urn:li:sponsoredCampaignGroup:601001
name: Ridgeway Robotics · operations leaders
status: ACTIVE
type: SPONSORED_UPDATES
costType: CPC
unitCost:
amount: "8.50"
currencyCode: USD
dailyBudget:
amount: "150.00"
currencyCode: USD
runSchedule:
start: 1790812800000
locale:
country: US
language: en
associatedEntity: urn:li:organization:71001
targetingCriteria:
include:
and:
- or:
urn:li:adTargetingFacet:locations:
- urn:li:geo:103644278
- or:
urn:li:adTargetingFacet:interfaceLocales:
- urn:li:locale:en_US
id: 701001
creatives:
- campaign: urn:li:sponsoredCampaign:701001
name: Ridgeway operations guide
intendedStatus: ACTIVE
content:
reference: urn:li:share:801001
id: urn:li:sponsoredCreative:901001
review:
status: APPROVED
contents:
- id: urn:li:share:801001
account: urn:li:sponsoredAccount:501001
author: urn:li:organization:71001
headline: A clearer operations pipeline for Ridgeway
text: See how robotics teams connect buyer intent to a shared sales plan.
landingPage: https://acme.example/ridgeway
assetUrl: https://acme.example/assets/operations.png
analytics:
- campaign: urn:li:sponsoredCampaign:701001
date: 2026-10-24
impressions: 14200
clicks: 117
oneClickLeads: 0
costInLocalCurrency: "132.40"
targetingEntities:
- facet: urn:li:adTargetingFacet:locations
urn: urn:li:geo:103644278
name: United States
- facet: urn:li:adTargetingFacet:interfaceLocales
urn: urn:li:locale:en_US
name: English (US)
access:
accounts:
- accountId: 501001
role: ACCOUNT_MANAGER
provenance:
dataset: b2b-linkedin-starter-v1
synthetic: true
companyKey: acme
Check what your agent did
Checks YAML
checks:
- id: campaign_group_created
trace:
called: POST /rest/adAccounts/*/adCampaignGroupsMore marketing tools
All 43 toolsLinkedIn Ads API mock FAQ
How do I test an agent that pauses a LinkedIn ad campaign?
Send POST / to the mock with X-RestLi-Method: PARTIAL_UPDATE and patch.$set.status set to PAUSED. Retrieve the campaign again to check its saved status.
Can I check whether a LinkedIn Ads agent respects read-only access?
Set the seeded account role to VIEWER to make campaign writes return 403 in Ancha’s mock. Writes also require the seeded rw_ads scope.
Where do campaign performance numbers come from in the LinkedIn Ads sandbox?
The mock’s / reads seeded analytics rows for the requested campaigns and date range. With pivot=CAMPAIGN, timeGranularity=DAILY groups results by day and ALL totals the selected range. Request impressions, clicks, oneClickLeads or costInLocalCurrency through fields.
Install the CLI and run your agent against the LinkedIn Ads mock.
Ancha is not affiliated with LinkedIn Ads.