The Loader.io API
Loader.io provides a RESTful API at api.loader.io. Before you use the API, you will need to find your API Key. This is located in your account settings page. You can reset your API key at any time to get a new one and expire your old one.
Using the API, you can register and verify testing domains, create and run tests, view summary result data, and access a list of IP addresses that loader might send requests to your app from during a test. Integrate loader.io into your building and testing workflows using the API.
Authentication
To authenticate with the loader.io API, add the special loaderio-auth
header to your request, and add your API key as the value for that header. Alternatively, you can add an api_key
parameter to the request, in either the body or query string of the request.
About This Documentation
In this documentation, examples are displayed in the form of curl commands, meant to be typed at a command prompt.
A typical example API call might look something like this:
curl -H 'loaderio-auth: API_KEY' https://api.loader.io/v2/tests
Let's break that down and explain each part:
curl
: curl is a command-line tool for accessing URLs over HTTP (and other protocols)-H 'loaderio-auth: API_KEY'
: the-H
option tells curl to add a header to the request. In this case, we add theloaderio-auth
header and give it the value of our API key (replace "API_KEY" with the key obtained from your account settings page on loader.io)https://api.loader.io/v2/tests
: this is the URL to the API resource we are accessing. In this case it's a list of all our tests (note: to keep your API key secure, always access the API overhttps
, nothttp
)
Our API returns JSON that isn't formatted for viewing by humans, so you may also want to pretty-print the response. Many tools can do this for you, but an easy way that you might already have is python's json.tool
module. Just pipe the curl response to python -mjson.tool
:
curl ... | python -mjson.tool
This will format the response nicely if you're testing API calls from the command line. For even less typing, configure an alias in your shell, e.g. "alias json="python -mjson.tool".
ID Placeholders
When you see a url with a section prefixed with a colon (":"), that section is a placeholder for a test ID or app ID. For example, in the URL
https://api.loader.io/v2/tests/:test_id`
:test_id
is a placeholder for a test id, e.g. f133e9e3691e405eefd3e1b7c351cb18
. If you used :test_id
there, you will get an error from the API.