Guides
Sandbox control
Mimicr's control API, CLI and MCP server to issue tokens, play the reviewer, the user and Google, wait for events, move the clock and inject failures.
Google's APIs only let you act as the advertiser. To test end to end, Mimicr also lets you act as the other side: the policy reviewer, the user who clicks and submits leads, Google's conversion processing, billing, the Google Cloud project and the account tree. All of it lives in the control API, at https://api.mimicr.dev/v1/google-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, "API keys" tab. Read keys can only query; actions, tokens, clock, chaos and reset need a write key.
curl --url https://api.mimicr.dev/v1/google-ads \ --header 'Authorization: Bearer mk_...'
With the CLI (Node 18+):
npx mimicr login mk_... npx mimicr status google-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 | Purpose |
|---|---|
GET /v1/google-ads | State: host, OAuth client and URLs, project (access level, APIs), Google users with their directly accessible accounts, account tree, toggles, chaos, quota and clock |
POST /v1/google-ads/activate | Activates the sandbox (201); if already active, 409 google_ads_already_active |
POST /v1/google-ads/reset | Restores the default tree and the three users and deletes campaigns, stats, leads and tokens; keeps the OAuth client, project and settings; returns the clock to real time |
POST /v1/google-ads/sweep | Processes everything already due now (reviews, delivery, conversions, retries) |
POST /v1/google-ads/token | Shortcut: a user's access and refresh token without the consent screen |
PUT /v1/google-ads/oauth | Authorized redirect_uris and rotate_secret |
GET /v1/google-ads/wait | Waits until an object or a delivery shows up (long poll) |
GET /v1/google-ads/clock | Sandbox time (now) and offset (offset_ms) |
POST /v1/google-ads/clock/advance | Moves the clock forward and processes what became due |
GET /v1/google-ads/objects | Lists sandbox objects |
GET /v1/google-ads/objects/{kind}/{ref} | One object (ref may contain slashes) |
GET /v1/google-ads/deliveries | Lists lead webhook deliveries, with their attempts |
GET /v1/google-ads/deliveries/{id} | One delivery |
POST /v1/google-ads/deliveries/{id}/resend | A new manual attempt |
GET /v1/google-ads/actions | Lists the actions and their parameters |
POST /v1/google-ads/actions/{id} | Runs an action |
GET /v1/google-ads/chaos | Chaos configuration per area |
PUT /v1/google-ads/chaos/{key} | Changes chaos for oauth, ads_search, ads_mutate, datamanager or webhook |
PUT /v1/google-ads/homolog | Homologation toggles and limits |
Control API errors use {"error": {...}} with lowercase codes (google_ads_not_active, unknown_action, action_failed, wait_timeout, invalid_parameter), unlike Google's envelope.
Tokens without consent
curl --request POST \
--url https://api.mimicr.dev/v1/google-ads/token \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "user": "gestor@minha-org.mimicr.dev", "scopes": ["https://www.googleapis.com/auth/adwords"] }'Responds 201 with access_token, expires_in (3599), refresh_token, scope, token_type and user. Without user, it uses the first user; without scopes, openid, email, adwords and datamanager. The refresh token works at POST https://google-ads.mimicr.dev/token just like one obtained through the consent screen.
OAuth client
curl --request PUT \
--url https://api.mimicr.dev/v1/google-ads/oauth \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "redirect_uris": ["https://app.example.com/oauth/google/callback"], "rotate_secret": true }'The redirect_uris (up to 50) are only enforced with the anyRedirectUri toggle off. rotate_secret: true generates a new client_secret; the old one stops working.
Objects and deliveries
kind is one of customer, budget, campaign, campaign_criterion, ad_group, ad_group_ad, ad_group_criterion, conversion_action, asset, campaign_asset, lead, click, conversion or ingest_request. The ref is the resource name (customers/2220330728/campaigns/54542599977), or the account id, the click id or the requestId.
/objects filter | Example |
|---|---|
kind | kind=campaign,ad_group_ad |
status | status=ENABLED,PAUSED |
ref | ref=customers/2220330728/campaigns/54542599977 |
customer | customer=2220330728 |
parent | parent=customers/2220330728/campaigns/54542599977 |
since | since=2026-11-05T20:00:00Z (updated since) |
limit | 50 by default, up to 200 |
/deliveries filter | Example |
|---|---|
status | pending, retrying, delivered or failed |
lead_id | lead_id=<lead_id> |
asset_id | asset_id=54542600318 |
since, limit | as above |
Filters accept several comma-separated values.
Wait
GET /v1/google-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, customer, parent, kind, status, lead_id and asset_id, and timeout in seconds (default 25, max 50). While waiting, the simulator processes what is due.
curl --url 'https://api.mimicr.dev/v1/google-ads/wait?on=object&kind=ingest_request&ref=67d2e870-4c32-4531-9266-7c05f19d6b56&status=SUCCESS' \ --header 'Authorization: Bearer mk_...'
npx mimicr wait google-ads object kind=ingest_request ref=<requestId> status=SUCCESS npx mimicr wait google-ads delivery lead_id=<lead_id> status=delivered --timeout 50
Other-side actions
curl --request POST \
--url https://api.mimicr.dev/v1/google-ads/actions/ad.approve \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "adGroupAd": "customers/2220330728/adGroupAds/54542599986~54542599990" }'{
"ok": true,
"action": "ad.approve",
"message": "Anúncio customers/2220330728/adGroupAds/54542599986~54542599990: REVIEWED/APPROVED.",
"data": { "resourceName": "customers/2220330728/adGroupAds/54542599986~54542599990", "status": "ENABLED", "policySummary": { "reviewStatus": "REVIEWED", "approvalStatus": "APPROVED" } }
}With the CLI: npx mimicr action google-ads ad.approve adGroupAd=<resource name> (true and false become booleans). An action that doesn't apply to the current state responds 422 action_failed with the reason. Where the table says "resource name or id", the id alone also works.
Policy review:
| Action | Parameters | Effect |
|---|---|---|
ad.approve | adGroupAd (required) | REVIEWED / APPROVED: starts delivering |
ad.limit | adGroupAd (required), topic (default TRADEMARKS_IN_AD_TEXT), countries (comma-separated ids, default 2076) | REVIEWED / APPROVED_LIMITED with a LIMITED entry |
ad.area_of_interest_only | adGroupAd (required) | REVIEWED / AREA_OF_INTEREST_ONLY |
ad.disapprove | adGroupAd (required), topic (default PERSONALIZED_ADVERTISING_PERSONAL_HARDSHIP), evidence (default: the first headline) | REVIEWED / DISAPPROVED with a PROHIBITED entry: stops delivering |
ad.appeal | adGroupAd (required) | UNDER_APPEAL; the decision comes from ad.approve or ad.disapprove |
ad.rereview | adGroupAd (required) | Back to REVIEW_IN_PROGRESS, finishing on its own after the review delay |
ad.eligible_may_serve | adGroupAd (required) | ELIGIBLE_MAY_SERVE / APPROVED: delivers while still under review |
asset.approve | asset (required, resource name or id) | Approves the lead form |
asset.disapprove | asset (required), topic | Disapproves the lead form |
keyword.disapprove | adGroupCriterion (required) | approvalStatus: DISAPPROVED: the keyword stops delivering |
campaign.force_eligible | campaign (required) | A Performance Max campaign without asset groups starts delivering |
Topics accepted in topic: PERSONALIZED_ADVERTISING_PERSONAL_HARDSHIP, MISLEADING_CONTENT, DESTINATION_NOT_WORKING, TRADEMARKS_IN_AD_TEXT, PUNCTUATION, CAPITALIZATION and UNAVAILABLE_OFFERS.
Traffic, leads and conversions:
| Action | Parameters | Effect |
|---|---|---|
traffic.deliver | campaign (default: all), hours (default 24, up to 744) | Generates the next hours of delivery without moving the clock |
traffic.click | adGroupAd (required), keyword, at (ISO 8601), device (MOBILE, DESKTOP, TABLET), braid | A click with a gclid; returns landingUrl with ?gclid= |
traffic.set_profile | campaign (required), ctr (0 to 1), cpcMicros, budgetUsage (0 to 2) | Pins the campaign's delivery factors |
lead.submit | campaignId (required), assetId, fields (JSON with FULL_NAME, EMAIL, PHONE_NUMBER…), gclid | Lead with a click, lead_form_submission_data and webhook |
lead.send_test | asset (required) | Test webhook (is_test: true, lead_id TeSter-…), with no lead or click |
lead.set_stage | leadId, stage (required) | lead_stage on the next webhook resend |
webhook.resend | deliveryId (required) | A manual delivery attempt |
conversion.set_outcome | reason (required: ACCEPTED or the reason without the prefix, such as CLICK_NOT_FOUND), and requestId, transactionId or gclid | Forces the outcome of events still PROCESSING |
conversion.process_now | — | Processes pending events:ingest now |
Accounts, billing, OAuth and project:
| Action | Parameters | Effect |
|---|---|---|
customer.create | name (required), parent (MCC id; without it, a standalone account), currency (default BRL), timeZone (default America/Sao_Paulo), status, manager, testAccount, user (email that gets direct access) | Adds an account to the tree |
customer.set_status | customer, status (required: ENABLED, CANCELED, SUSPENDED, CLOSED) | CANCELED and CLOSED give CUSTOMER_NOT_ENABLED; SUSPENDED blocks mutates and delivery |
customer.require_signup | customer (required) | Incomplete setup: CUSTOMER_NOT_ENABLED until customer.set_status ENABLED |
billing.fail | customer (required) | Payment fails: delivery stops |
billing.restore | customer (required) | Payment is restored and delivery resumes |
user.add | email (required), name, customers (comma-separated ids) | New Google user on the consent screen |
user.not_ads_user | user (required), undo | The user's calls give authenticationError: NOT_ADS_USER |
oauth.revoke | user or refreshToken | Revokes the authorization: the refresh gives invalid_grant and access tokens give 401 |
oauth.expire_access_tokens | — | All access tokens expire now (the refresh token still works) |
project.set_access_level | level (required: TEST, EXPLORER, BASIC, STANDARD) | The project's access level and daily quota |
project.disable_api | api (required: googleads or datamanager) | Calls give 403 SERVICE_DISABLED with the activation link |
project.enable_api | api (required) | Re-enables the API |
chaos.concurrent_modification | campaign (required), count (default 1) | The next mutates on the campaign give CONCURRENT_MODIFICATION |
quota.exhaust | — | The day's quota runs out: 429 RESOURCE_EXHAUSTED until quota.reset or the daily rollover (Pacific time) |
quota.reset | — | Resets the quota counters |
Homologation toggles
curl --request PUT \
--url https://api.mimicr.dev/v1/google-ads/homolog \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "autoReview": false, "conversionProcessingSeconds": 5, "limits": { "clientsPerManager": 3 } }'Booleans: autoReview, anyRedirectUri, legacyConversionUploadAllowed, enforceClickAge, overdelivery and requireBilling. Numbers: reviewDelayMinutes, conversionProcessingSeconds and newActionCooldownMinutes. Limits: limits.clientsPerManager and limits.minDailyBudgetMicros. Defaults and effects in Testing in the sandbox. With the CLI: npx mimicr put /v1/google-ads/homolog autoReview=false.
Clock
curl --request POST \
--url https://api.mimicr.dev/v1/google-ads/clock/advance \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "hours": 24 }'The body accepts seconds, minutes, hours and days, added together, up to 400 days per call. The response is {now, offset_ms}. With the CLI: npx mimicr clock google-ads +30m, +2h or +1d.
Advancing the clock expires access tokens (3599 s) and codes (10 min), completes reviews, generates delivery hours, moves campaigns through their start and end dates, processes conversions, runs webhook retries and rolls over the quota day. Reset returns the clock to real time.
Chaos
curl --request PUT \
--url https://api.mimicr.dev/v1/google-ads/chaos/ads_search \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "enabled": true, "apiErrorRate": 20, "apiErrorStatus": 503, "apiErrorWhen": "before", "latencyMinMs": 500, "latencyMaxMs": 2000 }'| Field | Meaning |
|---|---|
enabled | Turns the area on or off |
apiErrorRate | % of calls that respond with an error |
apiErrorStatus | 500 (INTERNAL), 503 (UNAVAILABLE) or 429 (RESOURCE_EXHAUSTED) |
apiErrorWhen | before (nothing is processed) or after (processes, then responds with an error) |
latencyMinMs, latencyMaxMs | Extra latency |
opsFailRate, opsFailCode | ads_mutate only: % of mutates that respond CONCURRENT_MODIFICATION |
webhookFailRate | webhook only: % of deliveries whose first attempt fails |
webhookDuplicateRate | webhook only: % of leads delivered twice |
| Key | Covers |
|---|---|
oauth | /token, /revoke, /v1/userinfo (errors in OAuth format) |
ads_search | search, searchStream, listAccessibleCustomers, suggest |
ads_mutate | All mutates, createCustomerClient and uploadClickConversions |
datamanager | events:ingest, requestStatus:retrieve |
webhook | The lead webhook |
The consent screen and /mimicr/click are not affected by 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, simulated API calls, actions, waiting and advancing the clock. The simulated API tool issues the token on its own and infers the login-customer-id from the account tree. npx mimicr mcp shows the command to connect it in Claude Code and the JSON for other clients.
End-to-end test example
npx mimicr reset google-ads TOKEN=$(npx mimicr post /v1/google-ads/token | jq -r .access_token) # your app publishes the campaign against https://google-ads.mimicr.dev and keeps the ad's resource name npx mimicr action google-ads ad.approve adGroupAd=<ad resource name> GCLID=$(npx mimicr action google-ads traffic.click adGroupAd=<ad resource name> | jq -r .data.gclid) # your app sends the conversion with $GCLID through /v1/events:ingest and keeps the requestId npx mimicr action google-ads conversion.process_now npx mimicr wait google-ads object kind=ingest_request ref=<requestId> status=SUCCESS