Guides
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.
curl --url https://api.mimicr.dev/v1/linkedin-ads \ --header 'Authorization: Bearer mk_...'
With the CLI (Node 18+):
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 path | What for |
|---|---|
GET /v1/linkedin-ads | State: 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/activate | Activates the sandbox (201); if already active, 409 linkedin_ads_already_active |
POST /v1/linkedin-ads/reset | Brings 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/token | Shortcut: consents and exchanges the code without the page |
PUT /v1/linkedin-ads/app | The app's redirect_uris, products, rotate_secret and name |
POST /v1/linkedin-ads/sweep | Processes now whatever is due |
GET /v1/linkedin-ads/wait | Waits until an object or a delivery shows up (long poll) |
GET /v1/linkedin-ads/clock | Sandbox time (now) and offset (offset_ms) |
POST /v1/linkedin-ads/clock/advance | Advances the clock and processes whatever is due |
GET /v1/linkedin-ads/objects | Lists sandbox objects |
GET /v1/linkedin-ads/objects/{kind}/{ref} | One object |
GET /v1/linkedin-ads/deliveries | Lead notifications, with attempts and signature |
GET /v1/linkedin-ads/deliveries/{id} | One delivery |
POST /v1/linkedin-ads/deliveries/{id}/resend | One more manual attempt |
GET /v1/linkedin-ads/actions | Lists the actions with their parameters |
POST /v1/linkedin-ads/actions/{id} | Runs an action |
GET /v1/linkedin-ads/chaos | Chaos settings per area |
PUT /v1/linkedin-ads/chaos/{key} | Changes the chaos of api, oauth, analytics, conversions or webhooks |
PUT /v1/linkedin-ads/homolog | Homologation 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
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"] }'| Field | Default | Use |
|---|---|---|
member | admin | Id or persona (admin, campaign_manager, creative_manager, viewer, no_accounts) |
scopes | Every scope of the app | List 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
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 absolutehttp(s)URLs, without#.products:ADVERTISING,LEAD_SYNCandCONVERSIONS; they decide which scopes the page accepts (withoutLEAD_SYNC,r_marketing_leadgen_automationgives "Invalid scope").rotate_secret: truegenerates 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 filter | Example |
|---|---|
kind | kind=campaign,creative |
status | status=ACTIVE |
ref | ref=166531097 |
account | account=521119150 |
parent | parent=347365458 (the creatives of a campaign) |
review | pending, approved, rejected, needs_review (forms: auto_approved) |
since | since=2026-11-06T12:00:00Z (updated since) |
limit | 50 by default, up to 200 |
/deliveries filter | Example |
|---|---|
status | pending, retrying, delivered, failed or skipped_blocked |
action | CREATED or DELETED |
ref | The lead id |
subscription_id | A subscription |
since, limit | As 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.
curl --url 'https://api.mimicr.dev/v1/linkedin-ads/wait?on=object&kind=creative&ref=166531097&review=approved' \ --header 'Authorization: Bearer mk_...'
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
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" }'{ "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:
| Action | Parameters | Effect |
|---|---|---|
oauth.authorize | redirectUri (required), member (default admin), scope (default every scope of the app), state | The click on Allow: returns the code (30 min, single use) and the redirect with code and state |
member.create | firstName, lastName, email (required), roles (account:ROLE,account:ROLE), orgRole | Creates a member, with roles on accounts and on the organization |
token.revoke | member or token | Revokes the tokens: 401 65601 |
token.expire | token (required) | Expires an access token now: 401 65602 |
refresh.expire | member (required) | Expires the member's refresh tokens: the next refresh gets invalid_request |
grant.forget | member (required) | The next authorization shows the page again |
Accounts and billing:
| Action | Parameters | Effect |
|---|---|---|
account.create | name (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_status | account, status (CANCELED or ACTIVE) (required) | CANCELED is terminal and cancels groups and campaigns |
account.billing_failure | account (required) | BILLING_HOLD: delivery stops |
account.billing_restore | account (required) | Removes the BILLING_HOLD |
account.hold | account, reason (RESTRICTED_HOLD or INTERNAL_HOLD) (required) | Stops the account's delivery |
account.unhold | account (required) | Removes the hold |
Review:
| Action | Parameters | Effect |
|---|---|---|
creative.approve | creative (required) | review.status APPROVED |
creative.reject | creative (required), reasons (comma-separated; default MISLEADING_CLAIMS) | REJECTED and the REJECTED hold |
creative.needs_review | creative (required) | NEEDS_REVIEW until a decision |
review.run_all | outcome (approve or reject) (required) | Decides every creative in review now |
form.approve | form (required) | Approves the lead form |
form.reject | form (required), reasons | Rejects the form: linked creatives get FORM_HOLD |
Delivery, clicks and leads:
| Action | Parameters | Effect |
|---|---|---|
traffic.deliver | campaign 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.complete | campaign (required) | The campaign becomes COMPLETED, as if its end date had passed |
ad.click | creative (required), member (default admin) | A click: returns landingUrl with li_fat_id, the liFatId and the clickUrl for the browser |
lead.submit | creative or form, member, answers (JSON {question or predefinedField: answer}), test, guest | Creates the lead, counts it in oneClickLeads and notifies the subscriptions |
lead.delete | lead (required) | The member deletes the lead: 404 on reads and a DELETED notification |
Conversions API:
| Action | Parameters | Effect |
|---|---|---|
capi.set_outcome | outcome (matched or unmatched) (required), count (default 1) | Forces the matching of the next events (matched uses the admin) |
capi.link_external_id | externalId, member (required) | Links an externalId to a member for 1 year |
Webhooks:
| Action | Parameters | Effect |
|---|---|---|
webhook.challenge | subscription (required) | Re-validates now (GET ?challengeCode=…); 3 failures in a row block it |
webhook.block | subscription (required) | Blocks it: notifications become skipped_blocked |
webhook.unblock | subscription (required) | Unblocks it and clears the failures |
webhook.resend | delivery (required) | Resends a notification now, without changing the retries |
Media, versions and quotas:
| Action | Parameters | Effect |
|---|---|---|
media.seed_video | owner (default the organization) | Creates an AVAILABLE urn:li:video: for SINGLE_VIDEO campaigns (the video API is 501) |
image.set_status | image, status (PROCESSING, AVAILABLE, PROCESSING_FAILED, WAITING_UPLOAD) (required) | Changes the image status |
version.release | version (required, YYYYMM) | Releases a not yet published version (e.g. 202611) |
version.sunset | version (required) | Sunsets the version now: 426 from then on |
quota.exhaust | scope (app or member) (required), endpoint (e.g. GET /rest/adAnalytics; default all) | 429 until midnight UTC or quota.reset |
quota.reset | Resets the daily quotas |
Homologation toggles
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
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
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 }'| Field | Meaning |
|---|---|
enabled | Turns the area on or off |
apiErrorRate | % of calls that answer an error |
apiErrorStatus | 500 (INTERNAL_ERROR), 503 (UNDER_MAINTENANCE) or 429 (TOO_MANY_REQUESTS) |
apiErrorWhen | before (nothing is processed) or after (processes and answers an error: "created but reported failed") |
latencyMinMs, latencyMaxMs | Extra latency |
opsFailRate, opsFailCode | % of operations that fail with the area's code |
webhookFailRate | Only on webhooks: % of deliveries whose first attempt fails |
webhookDuplicateRate | Only on webhooks: % of notifications delivered twice |
| Area | Covers | opsFailCode |
|---|---|---|
api | /rest: accounts, campaigns, creatives, leads | CONFLICT (409 "Write Conflict", writes only), GATEWAY_TIMEOUT (504), INTERNAL_ERROR (500) |
oauth | /oauth/v2/accessToken | server_error (500) |
analytics | adAnalytics | TIMEOUT (408) or EMPTY (a response with no rows) |
conversions | /rest/conversionEvents | BATCH_REJECTED (400 with batchIndex) |
webhooks | Challenge and notifications | WRONG_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
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