This API uses the combination of a namespace and a key to identify a counter. The namespace is a string that identifies the application or service that is using it. This should be something like your domain or company name. The key is a string that identifies the counter within the namespace. This should be something memorable.
API key is required to create and access counters.
Include your API key in the request headers:
X-API-Key: your_api_key_here
If you need an API key, you can create one here.
Important: Keep your API key secret and secure. Anyone with your API key can access your counters.
Namespaces created before May 6th 2025 can be accessed without authentication
The base URL for all API calls is https://letscountapi.com
. All requests should be made to this URL followed by the specific endpoint paths as described in the documentation.
All API calls should be made using the JSON format. Ensure that your request headers include Content-Type: application/json
to correctly format the request body as JSON.
POST /<namespace>/<key>
Creates a new counter or resets an existing counter. If current_value
is provided in the request body, the counter is set to that value; otherwise, it defaults to 0. current_value
must be an integer. Negative values are permitted.
{ "current_value": 10 }
If you try to create a counter that already exists, it will instead return the existing counter.
GET /<namespace>/<key>
Returns the current value of the specified counter.
POST /<namespace>/<key>/increment
Increments the counter by 1.
POST /<namespace>/<key>/decrement
Decrements the counter by 1.
POST /<namespace>/<key>/update
Updates the counter to a new specified value. Requires current_value
in the request body.
{ "current_value": 5 }