Skip to content
Download

Variables from scripts

// Use in a test script after parsing a login response:
const body = pm.response.json()
pm.environment.set("authToken", body.access_token)
pm.environment.unset("authToken")
// Runtime-scoped:
pm.variables.set("traceId", "kurlo-" + Date.now())

A common pattern: a “login” request fetches a token and stores it under authToken. Every other request uses Authorization: Bearer {{authToken}} and inherits the value.