Skip to main content

Variables Reference

Complete reference for all variable features in Nidra.

Variable Syntax

Variables use double curly brace syntax:

{{variableName}}

Variable Scopes

Listed by precedence (highest to lowest):

ScopeDescriptionUse Case
RequestLocal to single requestRequest-specific overrides
ConduitDuring conduit executionExtracted/temporary values
CollectionScoped to collectionCollection-wide settings
EnvironmentEnvironment-specificURLs, credentials by env
GlobalApplication-wideApp defaults

Dynamic Variables

Built-in variables that generate values:

VariableDescriptionExample Output
{{$timestamp}}Current Unix timestamp1678098234
{{$isoTimestamp}}ISO 8601 timestamp2024-03-06T10:30:34.000Z
{{$randomInt}}Random integer (0-1000)742
{{$randomUUID}}Random UUID v4a3bb189e-8bf9-3888-9912-ace4e6543002
{{$randomEmail}}Random email addressuser742@example.com
{{$randomString}}Random alphanumeric stringa7b3f9d2
{{$randomBoolean}}Random booleantrue or false

Variable References

Variables can reference other variables:

domain: example.com
apiUrl: https://api.{{domain}}
authUrl: https://auth.{{domain}}

Resolution happens at request time.

Environment Variables

Defined in environment configurations:

Development:
baseUrl: https://dev-api.example.com
apiKey: dev_key_123

Production:
baseUrl: https://api.example.com
apiKey: prod_key_xyz

Collection Variables

Defined in collection settings:

apiVersion: v2
timeout: 5000
defaultLimit: 100

Extracted Variables

Set during conduit execution from responses:

Extract from response:
data.userId → {{userId}}
token → {{accessToken}}

Learn more about extraction →

Variable Type Handling

Strings

"email": "{{userEmail}}"

Outputs: "email": "user@example.com"

Numbers

"count": {{itemCount}}

Outputs: "count": 42 (no quotes)

Booleans

"active": {{isActive}}

Outputs: "active": true (no quotes)

Null

"optional": {{nullValue}}

Outputs: "optional": null

Special Cases

Variable Not Found

If variable doesn't exist:

{{undefinedVar}}

Outputs: {{undefinedVar}} (literal string)

Empty Variable

If variable exists but is empty:

{{emptyVar}}

Outputs: `` (empty string)

Reserved Characters

If variable contains special characters, values are used as-is.

Usage Locations

Variables can be used in:

  • Request URLs
  • Query parameters
  • Headers
  • Request body (JSON, XML, text)
  • Authentication configurations
  • Assertions
  • Environment values (chained)
  • Conduit step configurations

Best Practices

  • Use descriptive names: userId not id1
  • Follow naming convention: camelCase or snake_case
  • Don't expose secrets in global scope
  • Document variables in environments
  • Use parent environments to reduce duplication

Limitations

  • Variable names are case-sensitive
  • Cannot use variables in variable names
  • Circular references are not supported
  • Maximum variable value length: (check docs)

See Also