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). In this section:
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 How to Find Your API Key
For example, here's a basic example of a cURL request to our API.
curl -X GET \
-H 'X-API-Email: firstname.lastname@example.org' \
-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.
/performance/hits - This endpoint contains the same type of data from the performance endpoint, but here you’re able to get raw data at the page view level.
/resource - This endpoint contains the Web Content Detail (WCD) data, which includes performance timings for individual files and domains.
/revenue-opportunity - This endpoint allows you to pull the data from your revenue opportunity reports.
/content-security-policies - This endpoint returns the currently configured CSPs based on URL parameters.