My tiny “Clean Slate” button (one click before I start)
I keep a pinned request at the top of every collection called Clean Slate. I hit it once when I open Postman and it does three boring things that save me from silly mistakes:
-
Blocks prod unless I’ve explicitly allowed it
-
Creates a short
run_idand anidempotency_keyfor today’s work -
Sets a couple of sane JSON defaults so I don’t retype headers
// Clean Slate — run once when you open the collection
const base = pm.environment.get("base_url") || "";
const isProd = /prod|live|production/i.test(base);
if (isProd && pm.environment.get("ALLOW_PROD") !== "true") {
postman.setNextRequest(null);
throw new Error("Prod blocked. Set ALLOW_PROD=true if you really mean it.");
}
pm.collectionVariables.set("run_id", pm.guid().slice(0, 8));
pm.collectionVariables.set("idempotency_key", Date.now().toString());
pm.collectionVariables.set("accept", "application/json");
pm.collectionVariables.set("content_type", "application/json");
How I actually use it
-
{{base_url}}lives in my environment (dev/stage/prod). -
I only set
ALLOW_PROD=truewhen I intend to touch prod. -
For writes, I add
Idempotency-Key: {{idempotency_key}}to avoid duplicate creates/charges. -
I log with
X-Run-Id: {{run_id}}so hunting failures takes seconds.
Nothing fancy—just one click that keeps me out of prod by accident and stops me from retyping the same stuff all day.

