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.

Connect your agent
The test
  • campaign_group_created

    Calls 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_URL
  • LINKEDIN_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

GET/rest/adAccounts
GET/rest/adAccounts/:accountId

adAnalytics

GET/rest/adAnalytics

adCampaignGroups

GET/rest/adAccounts/:accountId/adCampaignGroups
POST/rest/adAccounts/:accountId/adCampaignGroups
GET/rest/adAccounts/:accountId/adCampaignGroups/:id
POST/rest/adAccounts/:accountId/adCampaignGroups/:id

adCampaigns

GET/rest/adAccounts/:accountId/adCampaigns
POST/rest/adAccounts/:accountId/adCampaigns
GET/rest/adAccounts/:accountId/adCampaigns/:id
POST/rest/adAccounts/:accountId/adCampaigns/:id

adTargetingEntities

GET/rest/adTargetingEntities

adTargetingFacets

GET/rest/adTargetingFacets

creatives

GET/rest/adAccounts/:accountId/creatives
POST/rest/adAccounts/:accountId/creatives
GET/rest/adAccounts/:accountId/creatives/:id
POST/rest/adAccounts/:accountId/creatives/:id

Seed 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/*/adCampaignGroups

More marketing tools

All 43 tools

LinkedIn Ads API mock FAQ

How do I test an agent that pauses a LinkedIn ad campaign?

Send POST /rest/adAccounts/:accountId/adCampaigns/:id 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 /rest/adAnalytics 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.

Book a demo

Ancha is not affiliated with LinkedIn Ads.