Testing with dry_run
There is no sandbox. Here is how to build and test safely against real workspaces.
2 min read
Listener does not have a separate sandbox or test mode environment. Your code talks to real workspaces with real data from day one. Instead of a sandbox, the API gives you tools that make that safe.
dry_run
#Every write accepts dry_run: true, in the JSON body or as a query parameter. The API runs the same validation and the same preview logic as the real write, then returns what it would store, without changing anything and without emitting events.
curl https://api.listener.com/v1/campaigns \
-H "Authorization: Bearer $LISTENER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "Acme Coffee Q4 host reads", "brand": "Acme Coffee", "show_goals": {"8sQe1v0x2kTq": 250000}, "dry_run": true}'A campaign needs at least one show, given through show_goals, show_budgets or planned_episodes; replace 8sQe1v0x2kTq with one of your show ids from GET /v1/shows.
{
"object": "dry_run",
"resource": "campaign",
"action": "create",
"would_write": {
"title": "Acme Coffee Q4 host reads",
"brand": { "name": "Acme Coffee", "slug": "acme-coffee" },
"goals": { "total_views": 250000, "show_goals": { "8sQe1v0x2kTq": 250000 } },
"created_at": "2026-10-15T09:30:00Z"
},
"warnings": []
}would_write is exactly what the write would store, in the resource’s snake_case shape (trimmed above). Dry runs answer 200 even where the real request would answer 201.
If you send an Idempotency-Key with a dry run, the dry run uses that key up: repeating the key replays the dry-run response, so give the real write a new key.
A dry run surfaces the same 400 errors a real write would (unknown show ids, bad dates, missing fields), so it is the right way to validate a payload in CI or before showing a confirmation step to a user.
confirm
#Writes that cannot be undone or that cost money need an explicit confirm: true as well:
- Deleting campaigns, clusters and shared reports.
- Publishing a shared report (it becomes a public URL).
- Refreshing cluster data or a metered platform (TikTok, X, Facebook, Instagram, Threads, LinkedIn), and filing Spotify or Apple data requests.
- Changing the network’s default EMV, which changes EMV figures across the workspace.
- Some edits only need it in certain cases: changing a show or network
handle(the old public URL stops working) and editing a brand that several campaigns share. The reference marks these “Some changes need confirm”.
A dry run of one of these still works without confirm: the preview carries "requires_confirm": true and a note saying what the real request needs (confirm: true, or ?confirm=true on a DELETE). Without confirm, the real request answers 409 confirmation_required and changes nothing. The error carries a preview of exactly what would happen, so you can show it to the user before repeating the request with confirm: true.
A safe development setup
#- Develop with a read-only key. The Read preset cannot change anything, so you can explore every endpoint freely.
- Add write scopes narrowly when you need them, for example only
campaigns:write. - Keep
dry_run: trueon by default in development builds of anything that writes, and turn it off deliberately. - Use the Try it console in the API reference. It defaults writes to
dry_run. - Test webhooks with the test event.
POST /v1/webhook-endpoints/{id}/testsends awebhook_endpoint.testevent to your endpoint right away, without touching data. - Use a test show for live writes. If you need to exercise real writes, do it against a show or campaign you created for testing, and delete it afterwards.