Access to the Usage REST API is available as part of the Premium plan or as an Enterprise add-on.
For more information, see Pricing.
https://usage.algolia.com
domain.
You can find the APPLICATION_ID
variable in your dashboard,
and the API_KEY
variable on the API Keys page,
under the Usage section.
/1/
indicates that it’s version 1 of the API.
Request format
Authentication is done by HTTP headers. TheX-Algolia-Application-Id
header identifies which app you are accessing,
and the X-Algolia-API-Key
header authenticates the endpoint.
Response format
The response format for all requests is a JSON object. Whether a request succeeded is indicated by the HTTP status code. A2xx
status code indicates success, whereas a 4xx
status code indicates failure.
When a request fails, the response body is still JSON, but contains a message
field which you can use for debugging.
Errors
In case of errors (such as authentication, validation, or rate limit errors), the API returns a payload in the following format:Migration from the Monitoring API
Theusage
endpoints of the Monitoring API are now deprecated.
You should migrate to the new Usage API.
While Algolia always strives to keep these APIs backwards-compatible,
there are some changes you must take into account.
Time range
The Monitoring API relies on theperiod
parameter to derive the time range.
With the Usage API, you can use the startDate
, endDate
, and granularity
parameters, which are more flexible.
Here’s a list of period
values supported on the Monitoring API and their Usage API equivalents, using startDate
, endDate
, and granularity
(assuming that NOW()
is July 15, 2020 at 12:30 AM UTC).
last_day
(last day with one data point)
day
(last 24 hours with one data point per hour)
month
(last 30 days with one data point per day)
year
(last 365 days with one data point per day)
Error response
Error code422
is now used instead of 400
.
While the Monitoring API provides a reason
property in case of an error payload,
the Usage API returns a message
:
Empty response
The empty response[]
is now {}
.
Note that calls which request several metrics now only return metrics that contain data, and omits others.
Usage endpoints
Quick reference
Verb | Path | Method |
---|---|---|
GET | /1/usage/{statistic} | Get usage |
GET | /1/usage/{statistic} /{index} | Get usage for an index |
Get usage
GET /1/usage/{statistic}
This method gets one or more statistics over a time range.
Parameters
The lower bound timestamp (a string like “2006-01-02T00:00:00.000Z”) of the time range to query.
The upper bound timestamp (a string like “2006-01-02T23:23:59.999Z”) of the time range to query.
Possible values:
hourly
: 1 point per hour. The maximum time range with this granularity is 7 days.daily
: 1 point per day. The maximum time range with this granularity is 365 days.
The statistics to retrieve. You can include one or multiple comma-separated values.Search operationsOther
To avoid unnecessary calls, you can request all or some of the following metrics with the different grouping statistics listed below.
queries_operations
: number of single queriesmulti_queries_operations
: number of multiple queries (batched queries)
get_api_key_operations
: number of Get API key operationsget_api_keys_operations
: number of Get API keys operationsadd_api_key_operations
: number of Add API key operationsupdate_api_key_operations
: number of Update API key operationsdelete_api_key_operations
: number of Delete API key operationslist_api_key_operations
: number of List API Keys operations
browse_operations
: number of Browse operationsclear_index_operations
: number of Clear index operationscopy_move_operations
: number of Copy or move index operationsdelete_index_operations
: number of Delete index operationsget_log_operations
: number of Get logs operationsget_settings_operations
: number of Get settings operationsset_settings_operations
: number of Set settings operationslist_indices_operations
: number of List indices operationswait_task_operations
: number of Wait task operations
add_record_operations
: number of Add object operationsbatch_operations
: number of Batch operationsdelete_by_query_operations
: number of Delete by query operationsdelete_record_operations
: number of Delete object operationsget_record_operations
: number of Get object operationspartial_update_record_operations
: number of Partial update object operationsupdate_record_operations
: number of Update object operations
batch_synonym_operations
: number of Batch synonyms operationsclear_synonym_operations
: number of Clear synonyms operationsdelete_synonym_operations
: number of Delete synonym operationsget_synonym_operations
: number of Get synonym operationsquery_synonym_operations
: number of Search synonyms operationsupdate_synonym_operations
: number of Update synonym operations
batch_rules_operations
: number of Batch rules operationsclear_rules_operations
: number of Clear rules operationsdelete_rules_operations
: number of Delete rule operationsget_rules_operations
: number of Get rule operationssave_rules_operations
: number of Save rule operationssearch_rules_operations
: number of Search rules operations
total_search_operations
: sum of all Search operations metricstotal_search_requests
: sum of all Search requests . The number of billed search requests is equal to this value minus querysuggestions_total_search_requeststotal_recommend_requests
: sum of all Recommend requeststotal_acl_operations
: sum of all ACL operations metricstotal_indexing_operations
: sum of all indexing operations metricstotal_records_operations
: sum of all record operations metricstotal_synonym_operations
: sum of all synonym operations metricstotal_rules_operations
: sum of all rule operations metricstotal_write_operations
: sum of all write operationstotal_read_operations
: sum of all read operationstotal_operations
: sum of all operations
querysuggestions_total_search_operations
: sum of all Query Suggestions search operationsquerysuggestions_total_search_requests
: sum of all search requests generated to build up query suggestionsquerysuggestions_total_acl_operations
: sum of all Query Suggestions ACL operations metricsquerysuggestions_total_indexing_operations
: sum of all Query Suggestions indexing operations metricsquerysuggestions_total_records_operations
: sum of all Query Suggestions record operations metricsquerysuggestions_total_synonym_operations
: sum of all Query Suggestions synonym operations metricsquerysuggestions_total_rules_operations
: sum of all Query Suggestions rule operations metricsquerysuggestions_total_write_operations
: sum of all Query Suggestions write operationsquerysuggestions_total_read_operations
: sum of all Query Suggestions read operationsquerysuggestions_total_operations
: sum of all Query Suggestions operations
avg_processing_time
: average processing time (in milliseconds)90p_processing_time
: 90th percentile of processing time (in milliseconds)99p_processing_time
: 99th percentile of processing time (in milliseconds)queries_above_last_ms_processing_time
: number of queries processed in 1 second or more
records
: total number of recordsdata_size
: total size of all the indices’ records (in byte)file_size
: total size of all the indices’ records and metadata (in byte)
max_qps
: maximum queries per second over the time range (per server)region_max_qps
: maximum queries per second over the time range (per region)total_max_qps
: maximum queries per second across all servers
used_search_capacity
: max used search capacity in percentage (per server)avg_used_search_capacity
: average used search capacity in percentage (per server)region_used_search_capacity
: max used search capacity in percentage (per region)region_avg_used_search_capacity
: average used search capacity in percentage (per region)total_used_search_capacity
: max used search capacity in percentage across all serverstotal_avg_used_search_capacity
: average used search capacity in percentage across all servers
degraded_queries_ssd_used_queries_impacted
: percentage of queries that made the Algolia search engine read from the SSD.degraded_queries_ssd_used_seconds_impacted
: percentage of seconds impacted by assd_used
degradation.degraded_queries_max_capacity_queries_impacted
: percentage of queries degraded because all threads available for search were used.degraded_queries_max_capacity_seconds_impacted
: percentage of seconds impacted by amax_capacity
degradation.
You can retrieve the
degraded_queries_*
statistics to monitor the impact of degraded queries
when the server is overloaded.
Some statistics provide the “percentage of seconds impacted.”
This refers to the percentage of seconds that queries were affected by a particular degradation for a given time range.For instance, if degraded_queries_max_capacity_seconds_impacted
returns 50% for one hour,
it means that 1800 out of 3600 seconds were affected by a max_capacity
.
The impacted seconds need not be contiguous.insights_operations
: number of operations on the Insights API
*
: all metrics in the same responsesearch_operations
: all Search operations metrics in the same responseacl_operations
: all ACL operations metrics in the same responseindexing_operations
: all Indexing operations metrics in the same responserecord_operations
: all Record operations metrics in the same responsesynonym_operations
: all Synonym operations metrics in the same responserule_operations
: all Rule operations metrics in the same response
t
: Timestamp in millisecondsv
: Value of the metric
degraded_queries_*
max_qps
region_*
used_search_capacity
JSON
Get usage for an index
GET /1/usage/{statistic}/{index}
This method gets one or more statistics for a given index over a time range.
Parameters
The lower bound timestamp (a string like “2006-01-02T00:00:00.000Z”) of the time range to query.
The upper bound timestamp (a string like “2006-01-02T23:23:59.999Z”) of the time range to query.
Possible values:
hourly
: 1 point per hour. The maximum time range with this granularity is 7 days.daily
: 1 point per day. The maximum time range with this granularity is 365 days.
Index name
The statistics to retrieve.
You can include one or multiple comma-separated values.Search operations
To avoid unnecessary calls, you can request all or some of the following metrics with the different
grouping statistics.
queries_operations
: number of single queriesmulti_queries_operations
: number of multiple queries (queries within batches)
get_api_key_operations
: number of Get API key operations i.e./1/indexes/:idx/keys/:key
get_api_keys_operations
: number of Get API keys operations i.e./1/indexes/:idx/keys
add_api_key_operations
: number of Add API key operationsupdate_api_key_operations
: number of Update API key operationsdelete_api_key_operations
: number of Delete API key operations
browse_operations
: number of Browse operationsclear_index_operations
: number of Clear index operationscopy_move_operations
: number of Copy or move index operationsdelete_index_operations
: number of Delete index operationsget_log_operations
: number of Get logs operationsget_settings_operations
: number of Get settings operationslist_indices_operations
: number of List indices operationsset_settings_operations
: number of Set settings operationswait_task_operations
: number of Wait task operations
add_record_operations
: number of Add object operationsbatch_operations
: number of Batch operationsdelete_by_query_operations
: number of Delete by query operationsdelete_record_operations
: number of Delete object operationsget_record_operations
: number of Get object operationspartial_update_record_operations
: number of Partial update object operationsupdate_record_operations
: number of Update object operations
batch_synonym_operations
: number of Batch synonyms operationsdelete_synonym_operations
: number of Delete synonym operationsget_synonym_operations
: number of Get synonym operationsquery_synonym_operations
: number of Search synonym operationsupdate_synonym_operations
: number of Update synonym operations
batch_rules_operations
: number of Batch rules operationsclear_rules_operations
: number of Clear rules operationsdelete_rules_operations
: number of Delete rule operationsget_rules_operations
: number of Get rule operationssave_rules_operations
: number of Save rule operationssearch_rules_operations
: number of Search rules operations
total_search_operations
: sum of all Search operations metricstotal_acl_operations
: sum of all ACL operations metricstotal_indexing_operations
: sum of all Indexing operations metricstotal_records_operations
: sum of all Record operations metricstotal_synonym_operations
: sum of all Synonym operations metricstotal_rules_operations
: sum of all Rule operations metricstotal_write_operations
: sum of all write metricstotal_read_operations
: sum of all read operationstotal_operations
: sum of all operations
querysuggestions_total_search_operations
: sum of all Search operationsquerysuggestions_total_acl_operations
: sum of all ACL operations metricsquerysuggestions_total_indexing_operations
: sum of all Indexing operations metricsquerysuggestions_total_records_operations
: sum of all Record operations metricsquerysuggestions_total_synonym_operations
: sum of all Synonym operations metricsquerysuggestions_total_rules_operations
: sum of all Rule operations metricsquerysuggestions_total_write_operations
: sum of all write metricsquerysuggestions_total_read_operations
: sum of all read operationsquerysuggestions_total_operations
: sum of all operations
avg_processing_time
: average processing time (in milliseconds)90p_processing_time
: 90 th percentile of processing time (in milliseconds)99p_processing_time
: 99 th percentile of processing time (in milliseconds)queries_above_last_ms_processing_time
: number of queries processed in 1 second or more
records
: total number of recordsdata_size
: total size of all the indices’ records (in byte)file_size
: total size of all the indices’ records and metadata (in byte)
*
: all metrics in the same responsesearch_operations
: all Search operations metrics in the same responseacl_operations
: all ACL operations metrics in the same responseindexing_operations
: all Indexing operations metrics in the same responserecord_operations
: all Record operations metrics in the same responsesynonym_operations
: all Synonym operations metrics in the same responserule_operations
: all Rule operations metrics in the same response
t
: Timestamp in millisecondsv
: Value of the metric
degraded_queries_*
max_qps
region_*
used_search_capacity
JSON