Skip to main content
Data Sources

Use a test data source to not affect your live data

Xano Support avatar
Written by Xano Support
Updated over a week ago

Data sources refer to the different types of data environments available throughout a Xano workspace. For example, the Scale plan supports two environments for data sources: live (production) and test. Your live data source is the data that is live for your application. Test data source allows you to create test data with the same schema set up so that you can run tests without affecting your users' data.

Plans with data source environments: Scale and Enterprise

The Scale plan supports two data source environments: live and test. Enterprise supports multiple data source environments. To see more about each plan please visit pricing. In order to upgrade, navigate to billing within your account.

Adding and navigating a new data source environment

You can add a new data source from the database section of your workspace. Easily see which data source is currently active. Next to that, select change to add a new data source or to navigate to a different environment.

The database shows the active data source. Select change to add a test environment or navigate between existing environments.

Once you select '+ Add Test Data Source' you will be taken to the data source manager panel where you can add a new test environment.

Important: Editing and Schema of Data Sources

It's important to note that a test data source will have exactly the same data schema and structure as your live environment. You cannot change, edit, or delete the schema or database tables in your test data source environment. The test environment allows you to use different data or records so that you can perform tests in your API without affecting your live data.

A test data source does not copy your live data. It has only the same schema so that you can add test or dummy data.

You are able to delete your test data source to easily start over. However, you cannot delete your live data source or change which data source is live and test.

When in a test data source environment, Xano will notify you throughout your workspace with a banner at the top of the page. You can easily switch back to live data at any time by select 'switch back' or 'change' in the database.

Xano will notify you throughout your workspace when you have a test data source active.

How to use the test Data Source with your API requests

Set Header Method

By default all API requests use the live data source, however, you can change that with the following HTTP header below. Use the HTTP Header function to define:

X-Data-Source: test

For Enterprise users that have multiple data sources available, you would change the word test with the correct name for your data source you want to use with your API request.

URL Argument Method

The other method to make API requests use the test data source is through a URL argument. You can append the argument to your API endpoint URL.

?x-data-source=test

https://x1xx-abcd-efgh.a1.xano.io/api:x123abc/user?x-data-source=test

This method is especially helpful for sending webhooks to your test data source when the webhook doesn't support additional headers.

Did this answer your question?