Guides
Mimicr

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.

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

With the CLI (Node 18+):

bash
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 pathPurpose
GET /v1/google-adsState: 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/activateActivates the sandbox (201); if already active, 409 google_ads_already_active
POST /v1/google-ads/resetRestores 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/sweepProcesses everything already due now (reviews, delivery, conversions, retries)
POST /v1/google-ads/tokenShortcut: a user's access and refresh token without the consent screen
PUT /v1/google-ads/oauthAuthorized redirect_uris and rotate_secret
GET /v1/google-ads/waitWaits until an object or a delivery shows up (long poll)
GET /v1/google-ads/clockSandbox time (now) and offset (offset_ms)
POST /v1/google-ads/clock/advanceMoves the clock forward and processes what became due
GET /v1/google-ads/objectsLists sandbox objects
GET /v1/google-ads/objects/{kind}/{ref}One object (ref may contain slashes)
GET /v1/google-ads/deliveriesLists lead webhook deliveries, with their attempts
GET /v1/google-ads/deliveries/{id}One delivery
POST /v1/google-ads/deliveries/{id}/resendA new manual attempt
GET /v1/google-ads/actionsLists the actions and their parameters
POST /v1/google-ads/actions/{id}Runs an action
GET /v1/google-ads/chaosChaos configuration per area
PUT /v1/google-ads/chaos/{key}Changes chaos for oauth, ads_search, ads_mutate, datamanager or webhook
PUT /v1/google-ads/homologHomologation 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.

bash
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

bash
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 filterExample
kindkind=campaign,ad_group_ad
statusstatus=ENABLED,PAUSED
refref=customers/2220330728/campaigns/54542599977
customercustomer=2220330728
parentparent=customers/2220330728/campaigns/54542599977
sincesince=2026-11-05T20:00:00Z (updated since)
limit50 by default, up to 200
/deliveries filterExample
statuspending, retrying, delivered or failed
lead_idlead_id=<lead_id>
asset_idasset_id=54542600318
since, limitas 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.

bash
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_...'
bash
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

bash
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" }'
json
{
  "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:

ActionParametersEffect
ad.approveadGroupAd (required)REVIEWED / APPROVED: starts delivering
ad.limitadGroupAd (required), topic (default TRADEMARKS_IN_AD_TEXT), countries (comma-separated ids, default 2076)REVIEWED / APPROVED_LIMITED with a LIMITED entry
ad.area_of_interest_onlyadGroupAd (required)REVIEWED / AREA_OF_INTEREST_ONLY
ad.disapproveadGroupAd (required), topic (default PERSONALIZED_ADVERTISING_PERSONAL_HARDSHIP), evidence (default: the first headline)REVIEWED / DISAPPROVED with a PROHIBITED entry: stops delivering
ad.appealadGroupAd (required)UNDER_APPEAL; the decision comes from ad.approve or ad.disapprove
ad.rereviewadGroupAd (required)Back to REVIEW_IN_PROGRESS, finishing on its own after the review delay
ad.eligible_may_serveadGroupAd (required)ELIGIBLE_MAY_SERVE / APPROVED: delivers while still under review
asset.approveasset (required, resource name or id)Approves the lead form
asset.disapproveasset (required), topicDisapproves the lead form
keyword.disapproveadGroupCriterion (required)approvalStatus: DISAPPROVED: the keyword stops delivering
campaign.force_eligiblecampaign (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:

ActionParametersEffect
traffic.delivercampaign (default: all), hours (default 24, up to 744)Generates the next hours of delivery without moving the clock
traffic.clickadGroupAd (required), keyword, at (ISO 8601), device (MOBILE, DESKTOP, TABLET), braidA click with a gclid; returns landingUrl with ?gclid=
traffic.set_profilecampaign (required), ctr (0 to 1), cpcMicros, budgetUsage (0 to 2)Pins the campaign's delivery factors
lead.submitcampaignId (required), assetId, fields (JSON with FULL_NAME, EMAIL, PHONE_NUMBER…), gclidLead with a click, lead_form_submission_data and webhook
lead.send_testasset (required)Test webhook (is_test: true, lead_id TeSter-…), with no lead or click
lead.set_stageleadId, stage (required)lead_stage on the next webhook resend
webhook.resenddeliveryId (required)A manual delivery attempt
conversion.set_outcomereason (required: ACCEPTED or the reason without the prefix, such as CLICK_NOT_FOUND), and requestId, transactionId or gclidForces the outcome of events still PROCESSING
conversion.process_now—Processes pending events:ingest now

Accounts, billing, OAuth and project:

ActionParametersEffect
customer.createname (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_statuscustomer, status (required: ENABLED, CANCELED, SUSPENDED, CLOSED)CANCELED and CLOSED give CUSTOMER_NOT_ENABLED; SUSPENDED blocks mutates and delivery
customer.require_signupcustomer (required)Incomplete setup: CUSTOMER_NOT_ENABLED until customer.set_status ENABLED
billing.failcustomer (required)Payment fails: delivery stops
billing.restorecustomer (required)Payment is restored and delivery resumes
user.addemail (required), name, customers (comma-separated ids)New Google user on the consent screen
user.not_ads_useruser (required), undoThe user's calls give authenticationError: NOT_ADS_USER
oauth.revokeuser or refreshTokenRevokes 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_levellevel (required: TEST, EXPLORER, BASIC, STANDARD)The project's access level and daily quota
project.disable_apiapi (required: googleads or datamanager)Calls give 403 SERVICE_DISABLED with the activation link
project.enable_apiapi (required)Re-enables the API
chaos.concurrent_modificationcampaign (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

bash
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

bash
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

bash
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 }'
FieldMeaning
enabledTurns the area on or off
apiErrorRate% of calls that respond with an error
apiErrorStatus500 (INTERNAL), 503 (UNAVAILABLE) or 429 (RESOURCE_EXHAUSTED)
apiErrorWhenbefore (nothing is processed) or after (processes, then responds with an error)
latencyMinMs, latencyMaxMsExtra latency
opsFailRate, opsFailCodeads_mutate only: % of mutates that respond CONCURRENT_MODIFICATION
webhookFailRatewebhook only: % of deliveries whose first attempt fails
webhookDuplicateRatewebhook only: % of leads delivered twice
KeyCovers
oauth/token, /revoke, /v1/userinfo (errors in OAuth format)
ads_searchsearch, searchStream, listAccessibleCustomers, suggest
ads_mutateAll mutates, createCustomerClient and uploadClickConversions
datamanagerevents:ingest, requestStatus:retrieve
webhookThe 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

bash
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