Customers
The Customer section in Treblle provides a comprehensive view of your API’s usage by individual customers.
It helps you understand how different customers interact with your API, identify trends in their usage patterns, and pinpoint potential issues or areas for improvement.
Steps to View the Customer Section
Click on “Customers” in the left navigation bar.
Overview of the Customer Section
The Customer Dashboard provides a comprehensive overview of all your customers and their API usage.
Here’s what you’ll find:
-
Customer Profiles: A list of all your customers, identified by their name or Customer ID.
-
Request Count: The total number of API requests each customer makes.
-
Overall Percentage: The percentage of total API requests attributed to each customer, giving you a sense of their impact on your API traffic.
-
Last Active: A timestamp indicating when each customer made their last API request.
Sorting Options
To help you find the information you need, you can sort the customer list by:
-
Customer ID: Organize customers alphabetically by their ID.
-
Request Count: See your most active customers first.
-
Most Recent Request: Identify the customers who recently interacted with your API.
Customer Profile
Click on a customer’s profile to access a detailed breakdown of their API usage.
The Customer Profile includes:
-
Request History: A complete list of all API requests made by that customer.
-
Request Graph: A visual representation of the customer’s API request activity over time. This graph helps you identify peak usage periods, trends, and potential anomalies.
Adding Customer/User ID to Requests
Treblle does not automatically add a Customer or User ID to API requests. If you want to track API usage by individual customers, you must modify the request headers to include one.
Steps to add the Customer ID in Treblle’s Express SDK
To ensure every API request contains a Customer ID, you can create a middleware that extracts the authenticated user’s ID and adds it to the request headers before Treblle processes it.
Here’s how you can modify your Express middleware to add the Customer ID
to the request headers:
Treblle Dashboard View of Customer ID
The image below shows how the customer ID will appear on the Treblle dashboard once you add it to the request.
Implementing Customer ID Tracking in Other SDKs
For other SDKs, the approach is similar. Here’s how you can implement it:
-
First, check the user authentication, and then you can retrieve the Customer ID from the authentication system.
-
After authentication, you can add the Customer ID to the request headers (typically as “X-Customer-ID”).
-
Apply middleware to track customer data in API requests.
For specific integration details for other SDKs, please refer to the Integration page.
The Customer section in Treblle gives valuable insights into how your customers use your API. It provides a clear view of each customer’s interactions, helping you spot patterns, monitor usage, and address performance or support issues early on.