Guides
Mimicr

Sandbox control

Mimicr's control API, CLI and MCP to issue tokens, configure the app, play the reviewer, the member and billing, wait for events, move the clock and inject failures.

The Marketing API only lets you act as the advertiser. To test end to end, Mimicr also lets you act as the other side: the member on the consent page, the ad reviewer, whoever clicks and fills the form, billing, the Conversions API matcher and LinkedIn itself (versions and quotas). All of it lives in the control API, at https://api.mimicr.dev/v1/linkedin-ads, and the same commands exist in the console, the CLI and the MCP server.

Authentication

Use an organization API key (mk_…), created in the organization settings, "Chaves de API" tab. Read keys only query; actions, tokens, clock, chaos, settings and reset need a write key.

bash
curl --url https://api.mimicr.dev/v1/linkedin-ads \
  --header 'Authorization: Bearer mk_...'

With the CLI (Node 18+):

bash
npx mimicr login mk_...
npx mimicr status linkedin-ads

The key can also come from --key or the MIMICR_API_KEY variable. Output is JSON and the exit code is 1 on an HTTP error.

Routes

Method and pathWhat for
GET /v1/linkedin-adsState: host, authorization URL, app (client id and secret, URLs, products, scopes), organization, members with roles, accounts, lead subscriptions, versions, toggles, chaos, quotas and clock. {"active": false} if not activated
POST /v1/linkedin-ads/activateActivates the sandbox (201); if already active, 409 linkedin_ads_already_active
POST /v1/linkedin-ads/resetBrings back the organization, the personas and both accounts; deletes campaigns, creatives, leads, rules, tokens, subscriptions, stats and deliveries; keeps the app and the settings; the clock goes back to real time
POST /v1/linkedin-ads/tokenShortcut: consents and exchanges the code without the page
PUT /v1/linkedin-ads/appThe app's redirect_uris, products, rotate_secret and name
POST /v1/linkedin-ads/sweepProcesses now whatever is due
GET /v1/linkedin-ads/waitWaits until an object or a delivery shows up (long poll)
GET /v1/linkedin-ads/clockSandbox time (now) and offset (offset_ms)
POST /v1/linkedin-ads/clock/advanceAdvances the clock and processes whatever is due
GET /v1/linkedin-ads/objectsLists sandbox objects
GET /v1/linkedin-ads/objects/{kind}/{ref}One object
GET /v1/linkedin-ads/deliveriesLead notifications, with attempts and signature
GET /v1/linkedin-ads/deliveries/{id}One delivery
POST /v1/linkedin-ads/deliveries/{id}/resendOne more manual attempt
GET /v1/linkedin-ads/actionsLists the actions with their parameters
POST /v1/linkedin-ads/actions/{id}Runs an action
GET /v1/linkedin-ads/chaosChaos settings per area
PUT /v1/linkedin-ads/chaos/{key}Changes the chaos of api, oauth, analytics, conversions or webhooks
PUT /v1/linkedin-ads/homologHomologation toggles

Control API errors use {"error": {...}} with lowercase codes (linkedin_ads_not_active, unknown_action, action_failed, wait_timeout, invalid_parameter), different from LinkedIn's envelope.

Tokens without the page

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/linkedin-ads/token \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "member": "campaign_manager", "scopes": ["r_basicprofile", "r_ads", "rw_ads", "r_ads_reporting"] }'
FieldDefaultUse
memberadminId or persona (admin, campaign_manager, creative_manager, viewer, no_accounts)
scopesEvery scope of the appList or space-separated string; only scopes of the app's products

Answers 201 with access_token, expires_in, refresh_token, refresh_token_expires_in, scope, member and person, like /oauth/v2/accessToken.

App

bash
curl --request PUT \
  --url https://api.mimicr.dev/v1/linkedin-ads/app \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "redirect_uris": ["https://crm.example.com/linkedin/callback"], "products": ["ADVERTISING", "LEAD_SYNC", "CONVERSIONS"], "name": "CRM Exemplo" }'
  • redirect_uris: up to 10 absolute http(s) URLs, without #.
  • products: ADVERTISING, LEAD_SYNC and CONVERSIONS; they decide which scopes the page accepts (without LEAD_SYNC, r_marketing_leadgen_automation gives "Invalid scope").
  • rotate_secret: true generates a new client secret: code exchanges, introspection, the challenge and the webhook signature switch to it.

The response is the updated app.

Objects and deliveries

kind is one of organization, member, account, account_user, campaign_group, campaign, creative, post, image, video, lead_form, lead, lead_subscription, conversion_rule, campaign_conversion, conversion_event, click, external_id, oauth_grant, token, refresh_token or version. The ref is LinkedIn's id (tokens are stored by hash). Creatives and forms carry review.

/objects filterExample
kindkind=campaign,creative
statusstatus=ACTIVE
refref=166531097
accountaccount=521119150
parentparent=347365458 (the creatives of a campaign)
reviewpending, approved, rejected, needs_review (forms: auto_approved)
sincesince=2026-11-06T12:00:00Z (updated since)
limit50 by default, up to 200
/deliveries filterExample
statuspending, retrying, delivered, failed or skipped_blocked
actionCREATED or DELETED
refThe lead id
subscription_idA subscription
since, limitAs above

Filters take several comma-separated values.

Wait

GET /v1/linkedin-ads/wait answers as soon as something matches the filters, or 408 wait_timeout. Parameters: on (object or delivery), at least one filter among ref, account, parent, kind, status, review, action and subscription_id, and timeout in seconds (default 25, max 50). While it waits, the simulator processes whatever is due.

bash
curl --url 'https://api.mimicr.dev/v1/linkedin-ads/wait?on=object&kind=creative&ref=166531097&review=approved' \
  --header 'Authorization: Bearer mk_...'
bash
npx mimicr wait linkedin-ads object kind=lead_form ref=6700000002689218625 review=auto_approved
npx mimicr wait linkedin-ads delivery action=CREATED status=delivered --timeout 50

The other side's actions

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/linkedin-ads/actions/creative.approve \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "creative": "urn:li:sponsoredCreative:166531097" }'
json
{ "ok": true, "action": "creative.approve", "message": "Criativo 166531097 aprovado.", "data": {} }

In the CLI: npx mimicr action linkedin-ads creative.approve creative=urn:li:sponsoredCreative:166531097 (true and false become booleans). An action that doesn't apply to the current state answers 422 action_failed with the reason. Creatives take the id or the URN; members, the id or the persona. Action messages are in Portuguese.

Members and tokens:

ActionParametersEffect
oauth.authorizeredirectUri (required), member (default admin), scope (default every scope of the app), stateThe click on Allow: returns the code (30 min, single use) and the redirect with code and state
member.createfirstName, lastName, email (required), roles (account:ROLE,account:ROLE), orgRoleCreates a member, with roles on accounts and on the organization
token.revokemember or tokenRevokes the tokens: 401 65601
token.expiretoken (required)Expires an access token now: 401 65602
refresh.expiremember (required)Expires the member's refresh tokens: the next refresh gets invalid_request
grant.forgetmember (required)The next authorization shows the page again

Accounts and billing:

ActionParametersEffect
account.createname (required; [billing-hold] creates it on BILLING_HOLD), currency (default BRL), test, member (default admin)A BUSINESS account with its default group, bypassing the access tier
account.set_statusaccount, status (CANCELED or ACTIVE) (required)CANCELED is terminal and cancels groups and campaigns
account.billing_failureaccount (required)BILLING_HOLD: delivery stops
account.billing_restoreaccount (required)Removes the BILLING_HOLD
account.holdaccount, reason (RESTRICTED_HOLD or INTERNAL_HOLD) (required)Stops the account's delivery
account.unholdaccount (required)Removes the hold

Review:

ActionParametersEffect
creative.approvecreative (required)review.status APPROVED
creative.rejectcreative (required), reasons (comma-separated; default MISLEADING_CLAIMS)REJECTED and the REJECTED hold
creative.needs_reviewcreative (required)NEEDS_REVIEW until a decision
review.run_alloutcome (approve or reject) (required)Decides every creative in review now
form.approveform (required)Approves the lead form
form.rejectform (required), reasonsRejects the form: linked creatives get FORM_HOLD

Delivery, clicks and leads:

ActionParametersEffect
traffic.delivercampaign or creative, date (UTC YYYY-MM-DD), hour (0–23), impressions (default 1000), clicks (10), spend (50.00), leads (0), videoViews (0)One manual hour of delivery, added to adAnalytics
campaign.completecampaign (required)The campaign becomes COMPLETED, as if its end date had passed
ad.clickcreative (required), member (default admin)A click: returns landingUrl with li_fat_id, the liFatId and the clickUrl for the browser
lead.submitcreative or form, member, answers (JSON {question or predefinedField: answer}), test, guestCreates the lead, counts it in oneClickLeads and notifies the subscriptions
lead.deletelead (required)The member deletes the lead: 404 on reads and a DELETED notification

Conversions API:

ActionParametersEffect
capi.set_outcomeoutcome (matched or unmatched) (required), count (default 1)Forces the matching of the next events (matched uses the admin)
capi.link_external_idexternalId, member (required)Links an externalId to a member for 1 year

Webhooks:

ActionParametersEffect
webhook.challengesubscription (required)Re-validates now (GET ?challengeCode=…); 3 failures in a row block it
webhook.blocksubscription (required)Blocks it: notifications become skipped_blocked
webhook.unblocksubscription (required)Unblocks it and clears the failures
webhook.resenddelivery (required)Resends a notification now, without changing the retries

Media, versions and quotas:

ActionParametersEffect
media.seed_videoowner (default the organization)Creates an AVAILABLE urn:li:video: for SINGLE_VIDEO campaigns (the video API is 501)
image.set_statusimage, status (PROCESSING, AVAILABLE, PROCESSING_FAILED, WAITING_UPLOAD) (required)Changes the image status
version.releaseversion (required, YYYYMM)Releases a not yet published version (e.g. 202611)
version.sunsetversion (required)Sunsets the version now: 426 from then on
quota.exhaustscope (app or member) (required), endpoint (e.g. GET /rest/adAnalytics; default all)429 until midnight UTC or quota.reset
quota.resetResets the daily quotas

Homologation toggles

bash
curl --request PUT \
  --url https://api.mimicr.dev/v1/linkedin-ads/homolog \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "lenientRestli": true, "reviewDelayMinutes": 0, "accessTier": "standard" }'

Booleans: programmaticRefresh, lenientRestli, autoBilling, honorTestAccounts, autoReview, autoDelivery, autoLeads, requireWebhookValidation, allowHttpWebhooks and crmConnected. Numbers: reviewDelayMinutes (0–10080), deliveryRate (0–10), cpmMultiplier (0.01–100), fx (0.01–1000), demographicsLagHours (0–72), conversionLagMinutes (0–10080), quotaScale, appDailyQuota and memberDailyQuota. Also accessTier (development or standard) and devAccounts (up to 5 account ids). Defaults and effects in Testing in the sandbox. In the CLI, numbers need a JSON body: npx mimicr put /v1/linkedin-ads/homolog '{"reviewDelayMinutes": 0}'.

Clock

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/linkedin-ads/clock/advance \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "hours": 24 }'

The body takes seconds, minutes, hours and days, added up, up to 400 days per call. The response is {now, offset_ms}. In the CLI: npx mimicr clock linkedin-ads +30m, +2h or +1d.

Advancing the clock finishes creative and form reviews and image processing, generates the delivery hours and the budget and date holds, completes campaigns (COMPLETED), expires codes (30 min), access tokens (60 days) and refresh tokens (365 days), turns PENDING_DELETION into REMOVED (24 h), runs webhook retries and re-validation (every 2 h), applies the conversion lag, resets the daily quotas and sunsets 202511 on 2026-11-16. The reset sets the clock back to real time.

Chaos

bash
curl --request PUT \
  --url https://api.mimicr.dev/v1/linkedin-ads/chaos/api \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "enabled": true, "apiErrorRate": 20, "apiErrorStatus": 500, "apiErrorWhen": "after", "latencyMinMs": 300, "latencyMaxMs": 1500 }'
FieldMeaning
enabledTurns the area on or off
apiErrorRate% of calls that answer an error
apiErrorStatus500 (INTERNAL_ERROR), 503 (UNDER_MAINTENANCE) or 429 (TOO_MANY_REQUESTS)
apiErrorWhenbefore (nothing is processed) or after (processes and answers an error: "created but reported failed")
latencyMinMs, latencyMaxMsExtra latency
opsFailRate, opsFailCode% of operations that fail with the area's code
webhookFailRateOnly on webhooks: % of deliveries whose first attempt fails
webhookDuplicateRateOnly on webhooks: % of notifications delivered twice
AreaCoversopsFailCode
api/rest: accounts, campaigns, creatives, leadsCONFLICT (409 "Write Conflict", writes only), GATEWAY_TIMEOUT (504), INTERNAL_ERROR (500)
oauth/oauth/v2/accessTokenserver_error (500)
analyticsadAnalyticsTIMEOUT (408) or EMPTY (a response with no rows)
conversions/rest/conversionEventsBATCH_REJECTED (400 with batchIndex)
webhooksChallenge and notificationsWRONG_CHALLENGE (the challenge fails)

The authorization page, the click and the upload URLs are exempt from chaos. Fields you don't send keep their current value.

MCP server

Agents can use https://api.mimicr.dev/mcp (Streamable HTTP, same mk_… key). The tools cover the overview, the reference, control API calls, already-authenticated calls to the simulated API, actions, waiting and advancing the clock. npx mimicr mcp prints the command to connect it in Claude Code and the JSON for other clients.

End-to-end test example

bash
npx mimicr reset linkedin-ads
TOKEN=$(npx mimicr post /v1/linkedin-ads/token | jq -r .access_token)
# your app creates a group, campaign, form and creative at https://linkedin-ads.mimicr.dev/rest and stores the creative URN
npx mimicr action linkedin-ads review.run_all outcome=approve
npx mimicr wait linkedin-ads object kind=creative ref=<id> review=approved
# your app activates the campaign
npx mimicr action linkedin-ads lead.submit creative=urn:li:sponsoredCreative:<id>
npx mimicr wait linkedin-ads delivery action=CREATED status=delivered
npx mimicr clock linkedin-ads +1d
# your app reads the previous day's adAnalytics