API Documentation

Getting Started

The VisitCount API allows you to programmatically access your counter data. You can use the API to retrieve counter values, increment counters, and more.

Authentication

No authentication is required to use the API. However, you must know your counter ID to access your specific counter data.

Endpoints

Get Counter Value

GET /api/count?id=your_counter_id

Returns the current value of a counter without incrementing it.

Example response:

{
  "count": 1234
}

Increment Counter

POST /api/count?id=your_counter_id

Increments the counter by 1 and returns the new value.

Example response:

{
  "count": 1235
}

Get Counter Stats

GET /api/stats?id=your_counter_id

Returns detailed statistics about a counter.

Example response:

{
  "id": "example_com_12345678",
  "count": 1235,
  "retrieved": "2023-04-15T21:25:30.000Z"
}

Embedding the Counter

To display a counter on your website, add the following script tag to your HTML:

<script src="https://visitcount.vercel.app/counter.js" data-id="your_counter_id" data-style="minimal"></script>

Replace your_counter_id with your actual counter ID, and minimal with your preferred style.

Available styles:

Rate Limits

To prevent abuse, the API has the following rate limits:

If you exceed these limits, the API will return a 429 Too Many Requests response.

Support

If you have any questions or need help, please contact us at support@visitcount.com.