Sandbox and Test Keys
Build and test an integration with test keys: real checks and prices, sample results, no credits spent.
What a test key is
A test key starts with imk_test_. Make one in Settings > MCP & API with Create key and Test as its Mode, or from code with POST /v1/api-keys and "livemode": false. It can be personal or a service account and has scopes like any key.
A test key calls the same endpoints as a live key, and its requests go through the same checks: the study's fields, the audiences the workspace may use, the price. Then, instead of running anything, iMario keeps the result in the sandbox and finishes it with sample data a few seconds later.
A test key never:
- spends a credit or counts against the workspace's daily limit,
- asks a model a question,
- changes live data: no live study, audience, report, Library item or member is created or changed,
- sends an event to a live webhook endpoint.
Rate limits apply to test keys as they do to live keys.
What a test key reads
Reads that cost nothing return the workspace's real data, so your code can use real ids: the workspace and its balance, audiences (the workspace's, official ones and markets), their people, Library items and files, reports, connections, and for an owner or admin the members and keys. These objects say "livemode": true.
What a test key creates lives in the sandbox and says "livemode": false. Sandbox objects are visible to every test key of the workspace and never to a live key. Their ids look like live ids. Studies and Auto studies listed with a test key are sandbox ones only.
How sandbox work finishes
| What you create | What happens |
|---|---|
| Study | queued, running after about 3 seconds, completed about 8 seconds after it was made. Results, responses and segments are sample answers in the live shape, the same every time for the same study, with up to 40 people per audience (a focus group seats 3 to 8 people in all) |
| Estimate | The live price, with "charged": 0 |
| Audience, sub-group, audience from files | building, then ready after about 8 seconds, with sample people |
| Report | Written after about 8 seconds: a sample report over the studies you named, sandbox or live. A sandbox report never fails, so report.failed cannot be tried here |
| Report download | Ready after about 3 seconds: a small sample file behind a link valid for one hour |
| Auto study | Plans, runs two sample studies and writes its report in about 10 seconds |
| Message to a person | A sample reply at once, never charged |
| AI read of a group | Computed from the sample answers, never charged |
| File upload | Checked like a live upload; the sandbox keeps its details but not the file itself, so download_url is null |
Each object turns final when its time comes, whether or not you ask for it, and sends its webhook event then.
Make it fail on purpose
Put a marker in the text you send to test how your code handles failure:
| Marker | Where | Result |
|---|---|---|
[fail] | A study's question (or its topics, questions or announcement) | The study ends failed |
[fail] | An audience's brief, or its name (a sub-group made with a brief reads only the brief) | The audience ends failed |
[fail] | An Auto study's goal | The Auto study ends failed |
[fail] | A message to a person | 503 reply_failed, as when a person gives no answer |
[no_credits] | A study's question, an Auto study's goal or a message | 402 insufficient_credits when you create it |
[pause] | An Auto study's goal | It pauses after its first run until you call POST /v1/auto-studies/{id}/continue |
Webhooks in the sandbox
An endpoint is live or test. One created with a test key, or with Test as its mode in Settings > MCP & API, is a test endpoint: it receives only sandbox events, and over the API only test keys see it. A live endpoint never receives sandbox events. Test events are signed and retried exactly like live ones, so you can check your signature code against them. credits.low never fires in the sandbox, since nothing is charged. See Webhooks.
What test keys cannot do
- Invite, change or remove members, make or revoke API keys, or start a connection sync. These calls are refused with 403
livemode_only. - Change or delete live objects, such as a live Library item or a live report's share link (403
live_object_read_only). - Connect to the MCP server. Test keys work on the REST API only.
Going live
Swap the test key for a live one. Nothing else changes: the same requests, the same fields, the same ids for audiences, people and Library items. Sandbox objects stay in the sandbox; a live key does not see them.