Counter

Atomic, namespace-isolated hit counter. Perfect for tracking page views, downloads, or any event that needs counting.

Get API Key

Overview

Use Cases

  • Track page views and visits
  • Count downloads or clicks
  • Monitor API endpoint usage
  • Track user actions and events
  • Analytics and metrics collection

Features

Namespace isolation for multiple counters
Atomic increments (no race conditions)
Redis-backed for speed
PostgreSQL persistence for durability
RESTful API design

API Endpoints

Increment Counter

Atomically increment a counter in the specified namespace and return the new value

POST
https://api.requiems.xyz/v1/misc/counter/{namespace}

Parameters

Name Type Required Description
namespace string Required Counter namespace (1-64 chars: alphanumeric, hyphen, underscore)

Try it out

Live Demo
Request

Counter namespace (1-64 chars: alphanumeric, hyphen, underscore)

Response Fields

Field Type Description
namespace string The counter namespace
value integer The new counter value after increment

Code Examples

curl -X POST https://api.requiems.xyz/v1/misc/counter/page-views \
  -H "requiems-api-key: YOUR_API_KEY"

Error Responses

400

bad_request

Invalid namespace: must be 1–64 chars, alphanumeric, hyphen or underscore only

500

internal_error

Internal server error

Get Counter Value

Get the current value of a counter without incrementing it

GET
https://api.requiems.xyz/v1/misc/counter/{namespace}

Parameters

Name Type Required Description
namespace string Required Counter namespace (1-64 chars: alphanumeric, hyphen, underscore)

Try it out

Live Demo
Request

Counter namespace (1-64 chars: alphanumeric, hyphen, underscore)

Response Fields

Field Type Description
namespace string The counter namespace
value integer The current counter value (returns 0 if counter doesn't exist)

Code Examples

curl https://api.requiems.xyz/v1/misc/counter/page-views \
  -H "requiems-api-key: YOUR_API_KEY"

Error Responses

400

bad_request

Invalid namespace: must be 1–64 chars, alphanumeric, hyphen or underscore only

500

internal_error

Internal server error

Frequently Asked Questions