skip to content

Value Provenance

Where a value is actually produced at the moment a request goes out: invented on the spot, held back because it is a secret, or expanded from a token in text you typed.

part ofAPI & DB clientsoverview, primer and where to startread it →
on this pageshow

explore

questions

11

In a Postman request, what does a dollar-prefixed placeholder like {{$guid}} or {{$timestamp}} produce on each send?

level: juniorimportance: must knowfreq 62%

answer

  1. The value is made, not remembered
  2. A dollar prefix marks the family
  3. Fresh UUID, clock reading, random integer
  4. Registered as substitution defaults, consulted last

basics

~20 s

Postman's dollar-prefixed placeholders are generators supplied by the collection SDK: {{$guid}}, {{$timestamp}}, {{$isoTimestamp}} and {{$randomInt}} manufacture a value while the request is assembled. Nothing is read from a saved store and nothing is kept afterwards.

solid answer

~40 s

The dollar-prefixed tokens are **generators**, not stored values. The collection SDK registers `$guid`, `$timestamp`, `$isoTimestamp` and `$randomInt` as substitution *defaults*, so writing `{{$guid}}` in a URL, a header or a body asks a function to manufacture a value while the request is assembled: a fresh UUID, the current epoch reading in seconds, the current UTC instant as an ISO-8601 string, or a random integer. Nothing is read out of a saved set and nothing is written back — the saved file keeps the literal token text, and every send, and every occurrence within one send, is evaluated on its own. Because they are registered as defaults they are consulted last, so a variable you define under the same name takes precedence over the generator.

code

json · 4 lines
json
[
  { "key": "X-Request-Id", "value": "{{$guid}}" },
  { "key": "X-Sent-At", "value": "{{$isoTimestamp}}" }
]

go deeper

for a junior

Be ready to name the dollar-prefixed tokens and say they manufacture a value as the request is built, rather than reading one you saved earlier.

for a middle

Explain that the SDK registers them as substitution defaults consulted last, and that each occurrence — and each iteration — is evaluated independently.

for a senior

Show judgment about where a generated value is safe: correlation and idempotency headers or unique identities, never a value you must also predict in an assertion.

for a principal

Own the tradeoff of manufacturing identifiers at all: generated values stop parallel runs colliding but make a failure harder to reproduce, so decide what a run must record about itself.

## What a generated placeholder is A **generated placeholder** is a token you write into a Postman request whose value is *manufactured* while the request is being assembled, instead of being read out of something you saved earlier. The collection SDK ships a small family of them under a dollar-prefixed naming convention — `$guid`, `$timestamp`, `$isoTimestamp` and `$randomInt` — and you use one by writing it exactly like any other token: `{{$guid}}` in a URL, a header value, or a request body. When the request is built, a function answers that name and hands back a value. No key holding that value existed before the send, and none exists afterwards. That is the whole distinction this corner of the tool draws. A **stored** value has *provenance*: somebody typed a key and a value into a scope, the pair lives in a file or in the run's memory, and every read returns what was put there. A **generated** value has no key at all. It is produced, used once, and forgotten. ## The family the SDK registers - `$guid` — a fresh UUID per evaluation; the usual choice for a correlation identifier or an idempotency key. - `$timestamp` — the current clock reading as a Unix epoch value in seconds. - `$isoTimestamp` — the current instant in UTC, formatted as an ISO-8601 string. - `$randomInt` — a random integer. All four are registered by the SDK as **defaults** for substitution, and that registration is also what fixes their priority — covered below. ## Stored versus generated, side by side | | Stored variable | Generated placeholder | |---|---|---| | Where the value lives | a key and value in a scope | nowhere; a function produces it | | When it is produced | when you or a script set it | while the request is assembled | | Same value twice? | yes, until something changes it | no, each evaluation stands alone | | Visible in the saved file | as the key and value you saved | only as the literal token text | | Survives the run | yes, the scope keeps it | no, nothing is written back | ## Every occurrence is its own evaluation This catches people out more than anything else about the family: 1. Two `{{$guid}}` tokens in the *same* request are two evaluations and yield two different UUIDs. If a server wants one identifier echoed in a header and in the body, one generated token cannot supply both — capture the value into a variable once and reference that variable in both places. 2. Two iterations of the same request are two evaluations. Nothing carries over from the previous one. 3. Re-opening the collection tomorrow changes nothing about the file: the saved request still holds the literal token text, never yesterday's UUID. ## Registered as defaults, consulted last The generators are not privileged. They are registered as **substitutor defaults**, which means substitution first asks the variables the run actually holds and only falls through to a default when nothing held answers that name. The practical consequence is worth stating plainly: **a variable whose key is literally `$timestamp` shadows the `$timestamp` generator**, and `{{$timestamp}}` then returns that saved value on every send, silently. Nothing errors and nothing warns. If a placeholder that should change stops changing, that collision is the first thing to look for. ## Where generated values fit — and where they do not - **Good fit:** correlation and idempotency headers, unique e-mail addresses or usernames so a repeated registration run does not collide, cache-busting query parameters, any body field the server needs only to be unique. - **Poor fit:** anything you must also assert on. A check comparing a response field against an expected constant cannot expect a value invented microseconds earlier, unless the script captured what was sent. - **Poor fit:** anything that must be byte-identical across two requests without an explicit capture step in between. - **Meaningless:** a generated token pasted into a saved example — the example records text, and the value it stood for never existed as data. ## What this is not A generated placeholder is **not** a hidden variable: it never shows up in a variable list, it cannot be exported, and there is no seed you can pin to make a run reproduce yesterday's values. Nor is the subject the same as *how a token is expanded at all* — the pattern that recognises a brace token, the repeated passes that let a nested token resolve, and the fate of a token nobody answers are a separate mechanism with its own rules. This material is about **where the answer comes from** once something does answer: a saved value with provenance, or a function with none.

  • If one request writes {{$guid}} into two different headers, do both headers carry the same UUID?
    No. Each occurrence is a separate evaluation, so the two headers carry different UUIDs. To send one identifier in two places, capture a generated value into a variable once and reference that variable in both places, so a single stored value is substituted twice.
  • Does a generated value ever end up inside the saved collection file?
    No. The file stores the literal token text, exactly as typed. Nothing is written back after a send, so a diff of the file never shows produced values and two people running the same collection see entirely different values with an identical file on disk.

A stored variable is an address book entry you look up; a generated placeholder is a ticket machine that prints a new number every time you press it and keeps no copy.

saying these in an interview costs you the question

  • Says the generated value is saved into the environment automatically
  • Expects two {{$guid}} tokens in one request to match
  • Thinks the generated value is written back into the collection file
  • Assumes a generator can be seeded for repeatable runs
  • Believes a generator outranks a same-named user variable
open as a page

A Postman request goes out with the literal text {{baseUrl}} still in its URL — what happened?

level: juniorimportance: must knowfreq 70%

basics

~20 s

Nothing supplied a usable value for that name. The substitutor replaces a double-brace match only when the lookup yields a string, number or boolean; otherwise it returns the matched text unchanged, so the token itself is sent.

open as a page

In Postman, what happens to {{$timestamp}} if a variable literally named $timestamp exists in a run's scopes?

level: middleimportance: must knowfreq 50%

basics

~20 s

The saved variable wins and the placeholder stops generating. Postman's dollar-prefixed generators are registered as substitution defaults consulted last, so a same-named variable is found first and {{$timestamp}} returns its stored value on every send, silently.

open as a page

In a Postman variable, how is a value marked as secret, and does the collection format's schema declare it?

level: middleimportance: must knowfreq 45%

basics

~20 s

Postman's collection SDK marks a secret with a Boolean secret property on a Variable, and it is the variable scope's only tracked property. The collection format's schema never declares it, and there is no variable type called secret.

open as a page

In a Postman script, what does pm.vault.get('apiKey') return, and how must the script consume it?

level: juniorimportance: should knowfreq 34%

basics

~20 s

It returns a Promise, so a Postman script must await it or chain then; the value never arrives synchronously. The vault interface offers get, set and unset, all promise-returning, unlike a variable scope's synchronous get.

open as a page

In a Postman collection, how does a token like {{host-{{env}}}} resolve, and what may a name never contain?

level: middleimportance: should knowfreq 42%

basics

~20 s

Innermost first. The extraction pattern excludes braces from a captured name, so only the inner token matches on the first pass; substitution then repeats and the composed name resolves later. A name may never contain a brace.

open as a page

In a Postman script, what does pm.variables.replaceIn('{{base}}/orders/{{id}}') return, and when would you use it?

level: middleimportance: should knowfreq 32%

basics

~20 s

The template with every token it can answer already replaced, and any it cannot left literal. It runs the same expansion the runtime runs over a request, on a string the script hands it, and returns the expanded result.

open as a page

Every iteration of a Postman run sends an identical X-Request-Id although the header is set to {{$guid}}. Why?

level: seniorimportance: should knowfreq 38%

basics

~20 s

Something in the run holds a variable keyed literally $guid. Postman's dollar-prefixed generators are registered as substitution defaults consulted last, so that saved value answers the name first and the header repeats unchanged, with no error raised.

open as a page

In a Postman run, why can a script read an environment variable as undefined while the request still sends its value?

level: seniorimportance: should knowfreq 26%

basics

~20 s

Postman's runtime clones the environment, globals and collection scopes for a script and blanks any flagged secret the host declined to expose, while the request keeps substituting from the untouched originals. Script and request are deliberately given different views.

open as a page

At what point in a Postman or Newman run is a {{token}} in the request URL actually expanded?

level: seniorimportance: should knowfreq 36%

basics

~20 s

Immediately before the send. The runtime resolves the item and its auth in the request step, after the pre-request script has finished, so a value the script has just written is already visible to the expansion.

open as a page

In a Postman run, why might a vault secret resolve into one request's URL but not into another's?

level: seniorimportance: nice to knowfreq 17%

basics

~20 s

A vault variable can carry a domains array of URL match patterns. The runtime compiles them and offers the variable only to requests whose URL they match, so a non-matching URL keeps the token literal.

open as a page