Counter API
The Counter API provides a integer counter service for your application. The counters are stored in our database and can be accessed via IDs unique to the provided API key.
For free users, counters are kept for 14 days.
For premium users, counters are retained indefinitely until it becomes inactive for 180 days, at which point it gets deleted.
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 215ms | 239ms | 302ms | 490ms | 1159ms |
Didn't find what you were looking for? Suggest an improvement
/v1/counter GET
https://api.api-ninjas.com/v1/counter
Fetch and possibly update a counter.
Parameters
idrequiredID to specify the counter. Use a new
idto create a new counter.hitoptionalWhether to increase the count by 1. If used, must be set to
true.valueoptionalSet the count to a specific integer value. Setting the value to 0 resets the counter.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Sample Request Live Demo!
https://api.api-ninjas.com/v1/counter?id=test_id&hit=trueHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
{
"id": "test_id",
"value": 38
}Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/counter" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.