The Blue Triangle API can be used to access all of your real user and synthetic data. In addition to standard data queries, with the API you can create and manage Site Event Markers, and access your Content Security Policy (CSP).
How to Connect to the API
You can connect to the API using any tool that can send and receive HTTP messages. All requests require the following 2 headers:
- X-API-Email - The email address associated with your Blue Triangle profile.
- X-API-Key - See below
For example, here's a basic example of a cURL request to our API.
curl -X GET \
'https://api.bluetriangletech.com/content-security-policies?prefix=demosports' \
-H 'X-API-Email: artificial_user@bluetriangle.com' \
-H 'X-API-Key: 4598b7a1dd50023bedd44c83c792d051'
In this example we're asking the API for a list of all Content Security Policies under the "Demo Sports" site. To find your site "prefix," check out your profile > Default Site.
How to Find Your API Key
- Log into the Blue Triangle Portal.
- Click your Profile in the top right.
- Click View Profile.
- Find your API Key in the table.
Overview of API Endpoints
The public server hostname for all endpoints is https://api.bluetriangletech.com. Each supports certain HTTP methods, but the most common methods are GET and POST. Data is either passed via the GET URI/Path or via the POST body in JSON format. Data is returned in JSON format.
/performance - This endpoint contains page-level performance data, as well as high-level business metrics such as revenue and orders.
/resource - This endpoint contains the Web Content Detail (WCD) data, which includes performance timings for individual files and domains.
/error - This endpoint contains JavaScript error data, including error time and the error message.
/event-markers - This endpoint helps you view, configure, and update event markers. Site Event Markers are lined annotations that display on graphs for your site or account.
/content-security-policies - This endpoint returns the currently configured CSPs based on URL parameters.