Skip to main content

API Reporting

Sapling's API endpoint for retrieving API usage analytics.

API Quota Usage POST

This endpoint allows users to get API usage for a given time period as well as check their current quota.

Request Parameters

https://api.sapling.ai/api/v1/reporting/api_quota_usage

HTTP method: POST

key: String
32-character API key

start_days_back: Integer
Starting number of days ago (7 would consider usage starting 1 week ago).

end_days_back: Integer
Ending number of days ago (0 would mean up until current date).

Response Parameters

JSON structure with API usage reporting information. There may be additional metadata that is subject to change.

{
"quota": <int>, // Quota allocated to API key per month
"usage": <int>, // Usage volume during time period
"last_updated": <float>, // Timestamp that usage information was last updated (Unix epoch seconds)
}

API Endpoint Usage

This endpoint allows users to get API usage for each endpoint over a given time period.

Request Parameters

https://api.sapling.ai/api/v1/reporting/api_endpoint_usage

HTTP method: POST

key: String
32-character API key

start_days_back: Integer
Starting number of days ago (7 would consider usage starting 1 week ago).

end_days_back: Integer
Ending number of days ago (0 would mean up until current date).

interval: String
Interval to report usage by. Can be Daily, Weekly, or Monthly.

Response Parameters

JSON structure with API endpoint usage reporting information. For each endpoint, e.g. EDIT or SPELLCHECK, the usage is reported for each interval range in the time period.

{
"data": {
"<endpoint_name>": {
"<day_number>": <int>,
...
}
},
"last_updated": "<ISO timestamp>"
}

Example:

{
"data": {
"EDIT": {
"0": 0,
"1": 16000,
"2": 0,
"3": 0,
},
"SPELLCHECK": {
"0": 0,
"1": 0,
"2": 20000,
"3": 0,
}
},
"last_updated": "2025-03-14T17:06:15.416190"
}

API User Activity

This endpoint allows users to get recorded user actions over a given time period. The current actions recorded are:

  • Edits shown
  • Edits accepted
  • Edits ignored Please note these require that the accept and reject API endpoints have been used.

The endpoint also returns active users.

Request Parameters

https://api.sapling.ai/api/v1/reporting/api_user_activity

HTTP method: POST

key: String
32-character API key

start_days_back: Integer
Starting number of days ago (7 would consider usage starting 1 week ago).

end_days_back: Integer
Ending number of days ago (0 would mean up until current date).

Response Parameters

JSON structure with activity reporting information.

{
"edits_shown": <int>,
"edits_accepted": <int>,
"edits_ignored": <int>,
"active_users": {
"logged_in": <int>,
"anonymous": <int>
}
"last_updated": "<ISO timestamp>"
}