At Treblle, we care about the quality of the APIs you are shipping to your API consumers.
But what does quality mean for APIs and how do you know if you are checking all the boxes as you build your APIs?
We created the Treblle API Score to aid with that. The Treblle API Score is graded across 3 categories that give you a score from 0(terrible) to 100(excellent).
Why is API Score important?
Your API performing well is as important as having a fast and responsive website.
There are many tools out there that can help you with insights to optimize your website like Google's Page Speed Insights, but unfortunately, there aren't many tools that can give you insights on how your APIs are performing.
If you are building a REST-based API, you want it to work as close to perfection as possible, especially if you know it is going to be consumed by 3rd parties.
Developer and user experience is a game that needs to be approached carefully and with care. This alone will give organic exposure and recommendations if done correctly.
That is one of the main reasons why it is important that you have an insight into your API's performance at all times. By grading your API with the Treblle API score on a scale from 0 to 100 over 3 categories, Treblle gives you the insights that you need to build quality APIs.
Score categories
As mentioned earlier, the Treblle API Score is graded across 3 categories which are:
- Performance
- Security
- Quality
Let's zoom in on these categories and see what's being measured by Treblle.
Performance
For performance, we measure how quickly and efficiently your API handles requests. To do this, within this category we measure the following:
Content encoding
Content encoding is an HTTP header that is essentially used to compress the payload size of the response sent from your APIs.
The most common encoding is gzip
, so we check if your API has set the Content-Encoding
HTTP header to gzip
HTTP 2/3 support
The newest version of HTTP comes with some performance gains and we check if your APIs are on either HTPP/2 or HTTP/3
Average response size
The average response size in Treblle represents the amount of data your API is returning for every request it gets.
The smaller the data your API is sending the faster your APIs. We recommend that your response size is below 100KB.
Average load time
The load time of your API is the most important performance metric as it directly impacts your API consumers.
In essence, the slower your API is perceived to load, the poorer the experience is for your API consumers.
We recommend having an average load time below 150ms for a great experience and of course, you can go lower for an even superb experience.
Security
Your API security is really important and we measure the security of your API using the following:
HTTPS support
We highly recommend you are using HTTPS for your API as it's the de facto standard to encrypt communication between your API and its consumers.
Authentication
Authentication allows you to know who is accessing your API and lets you easily revoke access to bad actors.
There are many different types of authentication you can implement for your APIs from Bearer Authentication to API tokens.
Quality
In this category we measure the following:
JSON response
JSON is the de facto standard for sending back responses from your API, we check if you are sending back JSON and also that the Content-Type
header is set to application/json
Version support
It's best practice to version your APIs and we automatically detect API versioning if it exists on your API.
Error ratio
It's important for your API to not have so many errors. We check for this in order to measure the error ratio of your API.
Conclusion
With the Treblle API Score, you get a benchmark for your API across standard categories of Performance, Security, and Quality so that you can part yourself on the back if you score 80 to 100 or see what to improve if your score is not that good.
Get started measuring the performance of your APIs today with a free Treblle account
Resources
- API Score on the Treblle Docs
- A walkthrough of the API Score tab