How to Share Database Connection Settings with Team Members in Apidog

Apidog now supports secure, cloud-based database connection sharing using Vault and environment variables. This guide walks you through setup, testing, and collaborative use—boosting team efficiency while keeping sensitive data protected.

Oliver Kingsley

Oliver Kingsley

6 August 2025

How to Share Database Connection Settings with Team Members in Apidog

As a collaborative tool for API design, documentation, debugging, mocking, and testing, Apidog has a highly praised feature: supporting database operations when sending/receiving requests. This feature greatly facilitates users who need to prepare request data when calling an endpoint or insert data into a database upon receiving a response, making it a favorite among users.

However, as many users make extensive use of this feature daily, some areas for improvement have been identified. One of the most frequently raised points is:

Can the database connection configuration be set up by the team admin and then used collaboratively by other team members? It's really troublesome for everyone to re-enter the connection details.

From the initial design of this feature, we have already considered whether to allow database configurations to be used collaboratively. However, allowing users to save sensitive information such as database usernames and passwords on a cloud server is a matter that requires careful consideration. Therefore, data security was the core reason why the collaborative use of database connection configurations was not implemented at that time.

Today, Apidog has become the primary API collaboration and management tool for millions of developers, and Apidog's own foundational capabilities have become more powerful. Therefore, we have reconsidered this optimization requirement for collaborative use of database connection configurations, striving to balance data security and development efficiency to satisfy our users.

Storing Database Connection Configurations in the Cloud

Step 1: Create New Database Connection

When your Apidog version is updated to 2.6.50 or above, go to "Project Settings -> Database Connection" and click to create a new database connection. You will find that all connection fields guide you to use variable to fill in the field values.

Create new database connection using Apidog

Step 2: Set up Variables in Different Environments

In environment management, set up variables for database connections to be used in different environments. This way, these variables can be applied in database connection configurations.

set up variables in different environments

Step 3: Configure Database Connections Using Variables

Back to the database connection configuration page, you can manually fill in variables using variable format, or directly reference these variables through the dynamic value feature. We recommend using environment variables here so that the configuration automatically switches with the context of different environments. Except for the port number, all other fields are best filled in using variables.

configure database connections using variables

Step 4: Save and Use Database Connections

Save the database connection configuration that uses variables, and it can be used in database operations in API management, automated test, and other areas.

save and use database connections

When in use, the actual usage mechanism for database connection configurations saved locally versus those saved in the cloud is as follows:

Locally Saved Configuration (Without Using Variables)Cloud-Saved Configuration (Using Variables)
1. When an endpoint request triggers a database operation, the specified database configuration is read.1. When an endpoint request triggers a database operation, the specified database configuration is read.
2. The system reads the configuration details from a local file, using actual values directly.2. The configuration is fetched from the cloud and contains variables. The system resolves these variables based on their names and priority.
3. These values (e.g., host, username, password) are used to build a full database connection and initiate the connection.3. The variables are replaced with their actual values to form a complete database connection configuration, and the connection is initiated.
4. Once the connection is successful, the SQL statements defined in the database operation are executed, along with any operations like saving results to variables.4. Once the connection is successful, the SQL statements defined in the database operation are executed, along with any operations like saving results to variables.

PRO TIP: For other project members who need to use this database connection configuration, they now only need to go to environment management, find the corresponding variables and fill in local values, without having to configure in project management like before.

These are the detailed steps for configuring cloud database connections. Since using local values is recommended, and the actual configuration is still stored locally, so there’s no need to worry about data security risks. Variables simply make the process more convenient and manageable.

Apidog also continues to support entering actual values directly into the database connection settings. This ensures compatibility with existing configurations and supports users who prefer working with local data. However, a clear reminder will be shown, encouraging users to switch to variables and save them to the cloud for a better and more streamlined experience.

Precautions for Using Cloud Database Connections:

In database connection configurations, when variables are used, what is actually saved in the cloud is the variable name. When executing database connections, the complete connection configuration will be assembled according to variable usage rules to initiate the connection.

Recommended Actions:

Not Recommended Actions:

Using Vault Variables to Save Database Connection Configurations

For database connection settings, we recommend using Vault variables. These variables are fetched from an external secrets management service and stored in encrypted form on your local machine. This approach offers the best of both worlds—secure data protection and efficient team collaboration through cloud storage.

💡
Vault Secrets are available exclusively for Apidog Enterprise users.

Step 1: Configure Vault Variables

Set up a Vault provider and store the plaintext of the database connection credentials in it. For database connection configurations in different environments, you need to create different Vault Keys in your provider. For specific methods, refer to the help documentation.

vault secrets settings in Apidog

Step 2: Create Environment Variables

For each environment, create environment variables with the same name—such as dbHost. Then, set the Initial Value to reference the appropriate Vault variable for that environment, and let the Current Value follow the initial one.

Why do this?

  1. It wraps the Vault variable in an environment variable. So when you configure the database connection later, you just need to select the environment variable. Apidog will automatically use the correct value based on the current environment.
  2. Storing the data in an initial value ensures all project members can use it without manually setting it up again—boosting team efficiency.

Step 3: Set up Database Connections Using Vault Secret

When setting up a database connection, use the environment variables you've defined in Environment Management (e.g., dbHost, dbUser, dbPassword). To reference these variables quickly, use the dynamic value feature.

configure database connections using vault secret

Step 4: Test the Database Connection

Click "Test Connection". You'll be prompted to choose an environment for the test.

Make sure the variables used in the connection (like host, port, username, etc.) are properly configured for that environment. Once confirmed, the system will test the connection:

test the database connection

Step 5: Use Database Operations in Endpoint Requests

In the Pre Processors or Post Processors of an endpoint request, you can add a database operation using the saved cloud database configuration.

Example:

Let’s say you want to:

  1. Look up the id of a pet named "Nancy" from the database.
  2. Use that ID to fetch detailed info through an endpoint request.

Apidog will then:

Once the database configuration is set up in the cloud as described above:

Final Takeaway

The above practice shows how to use Vault variables to securely store and apply database connection configurations. Here’s a quick summary of the steps:

The table below illustrates how to set up these environment variables for both testing and production. You can set the current value to match the initial value.

EnvironmentEnvironment Variable NameInitial ValueDescription
Test EnvironmentdbHost{{vault:testDbHost}}References the Vault variable for the database address in test environment
dbUsername{{vault:testDbUsername}}References the Vault variable for the database username in test environment
dbPwd{{vault:testDbPwd}}References the Vault variable for the database password in test environment
dbTablestoreNo data security concerns, so it's entered directly. Vault variable is optional
Production EnvironmentdbHost{{vault:prodDbHost}}References the Vault variable for the database address in production environment
dbUsername{{vault:prodDbUsername}}References the Vault variable for the database username in production environment
dbPwd{{vault:prodDbPwd}}References the Vault variable for the database password in production environment
dbTablestoreNo data security concerns, so it's entered directly. Vault variable is optional

Explore more

How to Pass Data between Test Steps in Apidog?

How to Pass Data between Test Steps in Apidog?

Discover how to pass and reuse data across endpoint, database, loop, and script steps in Apidog. This guide explains how to use dynamic values and variables to build flexible, data-driven automated test workflows that are easier to maintain and scale.

6 August 2025

How to Run GPT-OSS for Free Using Ollama?

How to Run GPT-OSS for Free Using Ollama?

Learn how to run GPT-OSS (OpenAI’s open-weight models) for free using Ollama. This technical guide covers installation, model setup, API integration, and debugging with Apidog. Optimize your local AI workflow with privacy and cost savings.

5 August 2025

How to Use JSON Format to Write Shockingly Accurate Prompts?

How to Use JSON Format to Write Shockingly Accurate Prompts?

Discover how to use JSON format to write shockingly accurate AI prompts with this technical guide. Learn step-by-step methods, best practices, and examples to enhance outputs using tools like Apidog. Perfect for developers and AI enthusiasts!

5 August 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs