Apidog Docs
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
HomeLearning Center
Support CenterAPI ReferencesDownloadChangelog
HomeLearning Center
Support CenterAPI ReferencesDownloadChangelog
Discord Community
Slack Community
X / Twitter
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
  1. Environments & Variables
  • Apidog Learning Center
  • Getting Started
    • Introduction to Apidog
    • Basic Concepts in Apidog
    • Navigating Apidog
    • Quick Start
      • Overview
      • Creating an Endpoint
      • Making a Request
      • Adding an Assertion
      • Creating Test Scenarios
      • Sharing API Documentation
      • Explore More
    • Migration to Apidog
      • Overview
      • Manual Import
      • Scheduled Import (Bind Data Sources)
      • Import Options
      • Export Data
      • Import From
        • Import from Postman
        • Import OpenAPI Spec
        • Import cURL
        • Import Markdowns
        • Import from Insomnia
        • Import from apiDoc
        • Import .har File
        • Import WSDL
  • Design APIs
    • Overview
    • Create a New API Project
    • Endpoint Basics
    • APl Design Guidelines
    • Module
    • Configure Multiple Request Body Examples
    • Components
    • Common Fields
    • Global Parameters
    • Endpoint Change History
    • Comments
    • Batch Endpoint Management
    • Custom Protocol API
    • Schemas
      • Overview
      • Create a New Schema
      • Build a Schema
      • Generate Schemas from JSON Etc
      • oneOf, allOf, anyOf
      • Using Discriminator
    • Security Schemes
      • Overview
      • Create a Security Scheme
      • Use the Security Scheme
      • Security Scheme in Online Documentation
    • Advanced Features
      • Custom Endpoint Fields
      • Associated Test Scenarios
      • Endpoint Status
      • Appearance of Parameter Lists
      • Endpoint Unique Identification
  • Develop and Debug APIs
    • Overview
    • Generating Requests
    • Sending Requests
    • Debugging Cases
    • Test Cases
    • Dynamic Values
    • Validating Responses
    • Design-First vs Request-First
    • Generating Code
    • Environments & Variables
      • Overview
      • Environment Management
      • Using Variables
    • Vault Secrets
      • Overview
      • HashiCorp Vault
      • Azure Key Vault
      • AWS Secrets Manager
    • Pre and Post Processors
      • Assertion
      • Extract Variable
      • Wait
      • Overview
      • Database Operations
        • Overview
        • MySQL
        • MongoDB
        • Redis
        • Oracle Client
      • Using Scripts
        • Overview
        • Pre Processor Scripts
        • Post Processor Scripts
        • Public Scripts
        • Postman Scripts Reference
        • Calling Other Programming Languages
        • Using JS Libraries
        • Visualizing Responses
        • Script Examples
          • Assertion Scripts
          • Using Variables
          • Modifying Requests
          • Other Examples
    • Dynamic Values Modules
  • Mock API data
    • Overview
    • Smart mock
    • Custom mock
    • Mock priority sequence
    • Mock scripts
    • Cloud mock
    • Self-hosted runner mock
    • Mock language (Locales)
  • API Testing
    • Overview
    • Test scenarios
      • Create a test scenario
      • Pass data between requests
      • Flow control conditions
      • Sync data from endpoints or endpoint cases
      • Import endpoints or endpoint cases from other projects
      • Export test scenarios
    • Run test scenarios
      • Run a test scenario
      • Run test scenarios in batch
      • Manage the runtime environment of APIs from other projects
      • Data-driven testing
      • Scheduled tasks
    • Test Suite
      • Overview
      • Create a test suite
      • Orchestrate test suite
      • Run test suite locally
      • Run test suites via CLI
      • Scheduled tasks
    • Test reports
      • Test reports
    • Test APIs
      • Integration testing
      • Performance testing
      • End-to-end testing
      • Regression testing
      • Contract testing
    • Apidog CLI
      • Overview
      • Installing and running Apidog CLI
      • Apidog CLI Options
    • CI CD
      • Overview
      • Integrate with Gitlab
      • Integrate with Jenkins
      • Trigger Test by Git Commit
      • Integrate with Github Actions
  • Publish API Docs
    • Overview
    • API Technologies Supported
    • Quick share
    • View the API documentation
    • Markdown documentations
    • Publish docs sites
    • Custom layouts
    • Custom CSS, JavaScript, HTML
    • Custom domain
    • LLM-friendly Features
    • SEO settings
    • Advanced Settings
      • Documentation Search
      • CORS Proxy
      • Integrating Google Analytics with Doc Sites
      • Folder tree settings
      • Visibility settings
      • Embedding values in document URLs
    • API Versions
      • Overview
      • Create API versions
      • Publish API versions
      • Share endpoints with API versions
  • Send requests
    • Overview
    • SSE debugging
    • Socket.IO
    • WebSocket
    • Webhook
    • SOAP or WebService
    • GraphQL
    • gRPC
    • Use request proxy agents for debugging
    • Create requests
      • Request History
      • Request basics
      • Parameters and body
      • Request headers
      • Request settings
      • Debug requests
      • Save the request as an endpoint
      • HTTP2
    • Response and cookies
      • Overview
      • API response in Apidog
      • Create and send cookies
    • Authentication and authorization
      • Overview
      • CA and client certificates
      • Authorization types supported by Apidog
      • Digest Auth
      • OAuth 1.0
      • OAuth 2.0
      • Hawk Authentication
      • Kerberos
      • NTLM
      • Akamai EdgeGrid
  • Branches
    • Overview
    • Create a new sprint branch
    • Test APIs in a branch
    • Design API in a branch
    • Merge sprint branches
    • Manage sprint branches
  • AI Features
    • Overview
    • Enable AI features
    • Generate Test Cases
    • Modify schemas with AI
    • Endpoint compliance check
    • API documentation completeness check
    • AI naming
    • FAQs
  • Apidog MCP Server
    • Overview
    • Connect API Specification within Apidog Project to AI via Apidog MCP Server
    • Connect Online API Documentation Published by Apidog to AI via Apidog MCP Server
    • Connect OpenAPI Files to AI via Apidog MCP Server
  • Best Practices
    • How to handle API signatures
    • How to access OAuth 2.0 protected APIs
    • Apidog collaboration workflow
    • Managing authentication state in Apidog
  • Offline Space
    • Overview
  • Administration
    • Onboarding Checklist
      • Basic Concepts
      • Onboarding Guide
    • Managing teams
      • Managing Teams
      • Managing Team Members
      • Member Roles & Permission Settings
      • Team Activities
      • Team Resources
        • General Runner
        • Team Variables
        • Request Proxy Agent
      • Real-time Collaborations
        • Team Collaboration
    • Managing Projects
      • Managing Projects
      • Managing Project Members
      • Notification Settings
      • Project Resources
        • Database Connection
        • Git Connection
    • Managing Organization
      • Managing Organization
      • Single Sign-On (SSO)
        • SSO Overview
        • Configure Microsoft Entra ID
        • Configure Okta
        • Configure SSO for an Organization
        • Managing user accounts
        • Mapping Groups to Teams
      • SCIM Provisioning
        • Intro to SCIM Provisioning
        • Microsoft Entra ID
        • Okta
      • Organization Resources
        • Self-hosted Runner
      • Plans management
        • Billing managers in organization
  • Billing
    • Overview
    • Credits
    • Unable to use credit cards
    • Managing subscriptions
    • Upgrade plan
    • How to move a paid team to a organization
  • Data & Security
    • Apidog data storage location and security
    • User data privacy and storage location
    • Request routing and data security
  • Add-ons
    • API Hub
    • Apidog Intellij IDEA plugin
    • Browser Extension
      • Chrome
      • Microsoft Edge
    • Request Proxy
      • Request proxy in Apidog web
      • Request proxy in shared docs
      • Request proxy in Apidog client
  • Account & preferences
    • Account settings
    • Generate OpenAPI access token
    • Notification
    • Language settings
    • Hot keys
    • Network proxy configuration
    • Data backup
    • Updating Apidog
    • Deleting account
    • Experimental Features
  • References
    • API-Design First Approach
    • Apidog OpenAPI Specificaiton Extensions
    • JSONPath
    • XPath
    • Regular Expressions
    • JSON Schema
    • CSV File Format
    • Install Java Environment
    • Runner deployment environment
    • Apidog flavored Markdown
  • Apidog Europe
    • Apidog Europe
  • Support Center
  • Schemas
    • MinifiedFestivalType
    • DateType
    • LocationType
    • ArtistType
    • FestivalType
    • GetAllFestivalsResponseType
    • GetFestivalByIdResponseType
    • UserType
    • GetUserResponseType
HomeLearning Center
Support CenterAPI ReferencesDownloadChangelog
HomeLearning Center
Support CenterAPI ReferencesDownloadChangelog
Discord Community
Slack Community
X / Twitter
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
  1. Environments & Variables

Environment Management

When making API requests, it is often necessary to switch between development, testing, and production environments. Apidog makes it convenient to send requests to different environments—you simply need to click and select the desired environment at the top right corner of the interface.
An Apidog environment consists of two core elements:
1.
Base URL: Maintains the target of request delivery.
2.
Variables: Groups of variables that can be referenced in requests or scripts.
When switching between environments, both the base URL and environment variables will use the values defined in the current environment.

Create an Environment#

1
Open Environment Management
Click on the Environment Management button ≡ in the top right corner of the interface.
2
Create New Environment
Click on the last item in the left-side list labeled New Environment.
3
Configure Environment
Enter a name for your new environment. Add the Base URL and variables.
Create environment
4
Save
Click Save.
5
Select Environment
To use the new environment, select it from the environment selector at the top right of the interface. This makes it the active environment and sets all variables to the values specified in the environment.
TIP
Apidog maintains a clear separation between environments and base URLs. Environments represent different deployment stages (development, testing, production), while base URLs are configured within each environment. This separation provides flexibility when managing multiple services or micro-services across different environments.
In contrast, Apidog's environments directly reflect real environments like development, testing, and production, rather than treating each base URL as a single environment.

Base URLs#

The Base URL is the primary feature in an Apidog environment. In Apidog, an endpoint path usually starts with a forward slash (/) and does not include the base URL. When sending a request, Apidog prepends the destination Base URL to the endpoint path.
A standardized Base URL format begins with the protocol and excludes the trailing slash (/).
Examples:
https://127.0.0.1
http://abc.com/v1
Each Base URL corresponds to a specific Module. In most cases, an endpoint will use the Base URL of its module to send requests.
For instance, if the Base URL of the default module for the Production environment is http://abc.com/v1 and your endpoint path is /pet, then when you send a request in the Production environment, the actual request URL sent would be:
http://abc.com/v1/pet
TIP
If the endpoint path begins with http:// or https://, the Base URL will not be appended. However, hardcoding full URLs in endpoints is generally discouraged.
BASE_URL variable
In Apidog, there is a special environment variable called BASE_URL which stores the Base URL for the "Default Server" of the current environment. It is generally discouraged to use this variable directly.
For custom scripts:
Recommended: Use pm.request.getBaseUrl() to fetch the Base URL for the current endpoint.
Avoid: Using pm.environment.get('BASE_URL'), as it may not correctly capture the Base URL if the endpoint does not occupy the "Default Server".
If you manually create an environment variable labeled BASE_URL, it will supersede the system's predefined BASE_URL.
Note: Scripts cannot modify the Base URL configuration itself. The command pm.environment.set('BASE_URL', 'My_url') will only create a variable named BASE_URL.

Using Multiple Base URLs with Modules#

If your project’s endpoints need to connect to multiple Base URLs (e.g., microservices), the best way to manage them is by using multiple Modules in Apidog.
Example Scenario:
User endpoints: https://user.example.com
Order endpoints: https://order.example.com
Product endpoints: https://product.example.com
Setup Steps:
1
Create Modules
At the top of the API folder tree, add multiple modules corresponding to your services.
Add modules
2
Configure Base URLs
In Environment Management, you’ll see fields to set the Base URL for each module. Enter the URLs for each environment and click Save.
Configure module base URLs
3
Set Module Base URL
In a module’s root folder settings, choose which Base URL the module’s endpoints should use.
Default Settings: Uses the first Base URL listed for that module (Recommended).
Manually Specify: Select another Base URL manually. (Not recommended for most cases).
Module folder settings
4
Inheritance
In subfolders or individual endpoints, you can also specify the Base URL.
Inherit from Parents: Follows the parent folder (Default).
Manually Specify: Override for specific items.
Endpoint settings
5
Send Requests
Once set up, just click Send. Apidog determines the proper Base URL based on module and environment settings.

Add Environment Variables#

When you add a variable to an environment, you can specify two values:
Initial value: Shared with the team.
Current value: Stored locally on your machine.
Learn more about Using Variables.

Switch Between Environments#

Apidog shows the current environment in the environment selector at the top right of the workbench. Whenever you make a request or execute a script, Apidog will use the current values for all variables in the selected environment.
To switch, simply choose a different environment from the selector.
TIP
Endpoints vs. Requests
In Apidog:
Endpoint: The API specification (path usually starts with /).
Request: The actual HTTP request sent (includes the full URL).
The services defined in an Environment apply to Endpoints. When using the Request tab for ad-hoc debugging (similar to Postman), you can use the {{Base_url}} syntax if needed.

Environment Migration#

In Apidog, the Initial value of variables is synchronized within the team, while the Current value is only stored locally. This means current values do not carry over to other devices.
Apidog provides export/import functionality to migrate environments (including local current values) between machines.
1
Export
In Environment Management, hover over the ... next to the environment, click Export to get a JSON file.
2
Import
On the target computer, open Environment Management, hover over ..., click Import, and select the JSON file.

Visibility Scope of Environments#

You can create Private Environments for variables you don't want to share.
In the top right corner of the environment settings, set the visibility scope.
Shared: Visible to the team (Default).
Private: Visible only to you.
TIP
Private Environments share the same Service list (Base URLs) as other environments. Adding or removing services in a Private Environment will affect all environments simultaneously.

FAQ#

How to get service Base URL in a custom script?
Use pm.request.getBaseUrl() to retrieve the Base URL of the current endpoint.
Modified at 2026-01-14 09:10:00
Previous
Overview
Next
Using Variables
Built with