RESTKDocs

Environments

Manage variables across different environments like development, staging, and production.

8 min read

Environments help you manage different sets of variables for various deployment contexts. Switch seamlessly between development, staging, and production without modifying your requests.

Quick Start

Create an Environment

Click + Add Environment and name it (e.g., "Development", "Staging", "Production").

Add Variables

Define variables like baseUrl, apiKey, and apiVersion with values specific to this environment.

Activate

Select the environment from the dropdown to make it active. You can also choose No Environment to deactivate.

Use in Requests

Reference variables using {{variableName}} in any request field.


Creating Environments

To create an environment:

  1. Click + Add Environment in the environments panel
  2. Enter a name (required) and optionally a description
  3. Click Create

Works Offline

Environments can be created offline and will sync automatically when you reconnect.

To duplicate an environment:

  1. Right-click on an environment
  2. Select Duplicate
  3. A copy is created with " Copy" suffix, with all variables copied

Duplicate Naming

When duplicating, the client adds a " Copy" suffix (e.g., "Production Copy"). If a name conflict arises on the server during sync, the server may auto-rename it (e.g., "Production 2").


Managing Variables

Adding Variables

Select Environment

Click on an environment to open it.

Add Variable

Click Add Variable and configure:

  • Key: Variable name — must start with a letter or underscore, followed by ASCII letters, numbers, or underscores
  • Initial Value: The default value that syncs across devices
  • Current Value: Optional local-only override (takes precedence over initial value)
  • Type: Default or Secret (toggle)
  • Enabled: Toggle to include or exclude the variable without deleting it
  • Description: Optional note explaining the variable's purpose

Save

Changes save automatically.

Variable Types

Default Variables

  • Value is visible
  • Syncs across devices
  • Use for URLs, versions, non-sensitive data
baseUrl = "https://api.staging.example.com"
apiVersion = "v2"
timeout = "5000"

Secret Variables

  • Value is masked (••••••)
  • Encrypted when syncing
  • Use for tokens, passwords, API keys
apiKey = "sk-prod-abc123xyz789"
authToken = "eyJhbGciOiJIUzI1NiIs..."

Secret Variables Are Encrypted

Secret variables are masked in the UI and their values are encrypted when syncing. For maximum security, use secret type for all sensitive credentials.

Two-Value System

Environment variables support two layers of values:

Initial Value (Default)

  • Set manually in the environment editor
  • Syncs across all devices (encrypted if secret)
  • Used as the base value

Current Value (Script Override)

  • Set by scripts using nova.environment.set()
  • Stays local on your device (never syncs)
  • Takes priority over the initial value when present
  • Persists across app restarts (local only)

Effective Value = Current Value (if set) or Initial Value

Example:

// In a post-response script
const data = nova.response.json();
// Sets the current value (local only, overrides initial value)
nova.environment.set("accessToken", data.token);

The script-set current value takes precedence until cleared. The initial value remains unchanged and continues to sync.

set() Only Updates Existing Variables

nova.environment.set() can only update variables that already exist in the active environment — it cannot create new ones. If no environment is active, an error is thrown. Always pre-define your variables in the environment editor before referencing them in scripts.

Runtime vs Persisted

nova.variable.set() creates a runtime-only variable that disappears after the script chain completes. Use nova.environment.set() or nova.collectionVariables.set() if you need the value to persist.


Switching Environments

Activating an Environment

You can have one active environment per workspace:

  • Use the environment dropdown in the top bar
  • Select an environment to activate it, or No Environment to deactivate
  • Active environment variables are used in all requests

What happens:

  • Previous active environment is deselected
  • New environment variables become available
  • All requests instantly use the new values
  • Works offline (local operation)

User-Specific

Active environment is specific to your account. Other users can have different active environments in the same workspace.

Using Variables

Reference environment variables in any request field:

In URL:

{{baseUrl}}/api/{{apiVersion}}/users

In Headers:

Authorization: Bearer {{authToken}}
X-API-Key: {{apiKey}}

In Body:

{
  "environment": "{{env}}",
  "timestamp": "{{timestamp}}"
}

In Parameters:

?api_key={{apiKey}}&version={{apiVersion}}

Variable Highlighting

Variables in the URL bar and body are color-coded: green means resolved, orange means the variable exists but is empty, and red means the variable is undefined. This helps catch typos instantly.


Variable Priority

When the same variable name exists at multiple levels, the highest-priority scope wins:

  1. Runtime variables — set by nova.variable.set(), exist only during the script chain
  2. Request variables — defined in the request's Variables tab
  3. Folder variables — from the immediate folder, then parent folders up to the root
  4. Collection variables — defined at the collection level
  5. Environment variables — from the active environment (lowest priority)

Example:

Environment: baseUrl = "https://api.prod.com"
Collection: baseUrl = "https://api.staging.com"
Request uses: "https://api.staging.com"

The collection variable overrides the environment variable.


Right-Click Options

Right-clicking an environment shows these options:

ActionDescription
RenameEdit the environment name inline
DuplicateCreate a copy with all variables
ExportExport the environment and its variables
DeletePermanently remove the environment

Deleting Environments

To delete an environment:

  1. Right-click the environment
  2. Select Delete
  3. Confirm the deletion

Works Offline

Deletions work offline. When you reconnect, changes sync automatically to the server.


Offline Mode

Environments work fully offline with automatic sync.

Creating Offline

  • Create environments and variables without network
  • Changes are marked as pending sync
  • Automatically syncs when reconnected

Editing Offline

  • Make any changes offline
  • Changes saved locally
  • Sync happens automatically when online

Deleting Offline

  • Delete environments offline
  • Deletions sync automatically when you reconnect

Multi-Device Sync

What Syncs

Environment Properties:

  • Name
  • Description

Variable Properties:

  • Key
  • Value (encrypted for secrets)
  • Type (default/secret)
  • Enabled status
  • Display order

What Doesn't Sync

  • Active environment: Each user has their own active environment
  • Current values: Script-set overrides stay local

Conflict Resolution

If the same environment is edited on multiple devices simultaneously:

  • The server version wins automatically for conflicting fields
  • Changes are merged where possible
  • Name conflicts are resolved by the server with automatic renaming

Environment Sync

Unlike requests and collections (which offer three-way merge with user choices), environment conflicts are resolved automatically by the server. Your local pending changes are pushed first, then the latest server state is pulled.


Use Cases

Development Environment

baseUrl = "http://localhost:3000"
apiKey = "dev-key-123"
debug = "true"
timeout = "10000"

Staging Environment

baseUrl = "https://api-staging.example.com"
apiKey = "staging-key-xyz"
debug = "true"
timeout = "5000"

Production Environment

baseUrl = "https://api.example.com"
apiKey = "prod-key-abc-secret"
debug = "false"
timeout = "3000"

Common Variables

API Configuration:

baseUrl
apiVersion
apiPath

Authentication:

apiKey
accessToken
refreshToken
clientId
clientSecret

Request Settings:

timeout
retryCount
debug

User Context:

userId
tenantId
workspaceId

Permissions

Environment permissions are governed by your workspace role — there are no per-environment permissions.

RoleViewEditDelete
ViewerYes
EditorYesYesYes
ManagerYesYesYes
OwnerYesYesYes

Tips

  • One environment per stage: Create separate environments for dev, staging, and production
  • Descriptive names: "Production - US East" is clearer than "Prod 1"
  • Document variables: Use the description field to explain what each variable does
  • Secret sensitive data: Mark API keys and tokens as secret
  • Pre-define variables: Always create variables in the editor before using nova.environment.set() in scripts
  • Works offline: Create and edit environments offline, they'll sync when reconnected
  • Use in scripts: Access variables in pre-request scripts to generate dynamic values
  • Team coordination: Communicate when adding new required variables

Next Steps