Why and how to test your IEX Cloud implementation
If you’re new to IEX Cloud, we recommend that you start by using the sandbox environment to craft your first API requests and test out the platform. While API calls made to the production environment require the use of credits (previously known as messages) from your IEX Cloud plan, sandbox testing is free of charge and provides unlimited API calls.
Note that the IEX Cloud sandbox only returns randomized test data and is meant to mimic the results returned from the production API. The sandbox environment cannot be used to access real financial data.
When should I use sandbox testing?
The IEX Cloud sandbox is built to help you test out and integrate the API into your own applications. Use sandbox testing to learn how to use the platform, test out API requests before requesting production data, or integrate the IEX Cloud API into your project.
You can also use testing to estimate credit usage for a given endpoint. The number of credits that your sandbox API calls would make if you made the calls in production can be viewed in the IEX Cloud Console. This allows you to make test calls in line with your application’s use case and then better estimate usage costs.
Step One: Find your test token
Get started with sandbox testing by finding your test tokens. To access your test tokens, navigate to the IEX Cloud Console.
In the app navigation — on the bottom, left-hand side on a desktop computer collapsed in mobile — there is a toggle that reads “SANDBOX TESTING.”
If you click on the toggle, you will see the Console respond and show that you are viewing “Sandbox Test Data.” The toggle will also now read “SANDBOX TESTING ON.”
Toggle when not viewing test data
Toggle when viewing test data
Next, navigate to the IEX Cloud Console home page. The section listed under “API Tokens” will now display your test tokens. Note that all test tokens begin with the uppercase letter "T."
Use this test token in your test API calls for the sandbox environment.
Step Two: Make an API call with the sandbox environment
If you are new to the IEX Cloud API, check out our API Guide here for a step-by-step introduction to crafting API requests.
For sandbox testing, you will use your test token in the query string as your “token” parameter. You will also modify the base URL to “sandbox.iexapis” as opposed to “cloud.iexapis.”
Here is an example sandbox API call:
Sandbox testing can also be used for SSE Streaming:
curl --header 'Accept: text/event-stream' https://sandbox-sse.iexapis.com/stable/stocksUSNoUTP\?symbols\=spy\&token\=YOUR_TEST_TOKEN
Learn more about SSE streaming here.
To measure your test usage, navigate to the Usage Report while keeping the Console toggled to “SANDBOX TESTING ON.” This will show you test credit usage by day, token, and endpoint. You’ll also see how your anticipated usage will translate to real credits.
Legacy Launch, Grow, and Scale plans will show the dashboard above. Note that Individual and Business plans do not use pay-as-you-go credits.
Test data randomization
Data returned from sandbox API calls is scrambled and should not be used for purposes outside of testing. However, test calls return the same properties and data types as they will in production, which allows for full functionality testing.
Many endpoints that return a date — such as Historical Prices — will have the date accurately returned in the sandbox environment, so as to allow users to test out charting functionality within their application or project.