Pascal logo

Pascal

Let Pascal do the math.

A free, public counting API. Create counters, increment them, embed badges — all with simple HTTP requests. No sign up required.

Quick Start

Three steps. No sign up. No API keys needed for basic usage.

1

Create a counter

terminalbash
curl https://pascal.yourdomain.com/api/create/myapp/page-views
response.jsonjson
1{
2  "namespace": "myapp",
3  "key": "page-views",
4  "value": 0,
5  "admin_key": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
6}
Save your admin_key! You'll need it to delete, reset, or set the counter value.
2

Increment it

terminalbash
curl https://pascal.yourdomain.com/api/hit/myapp/page-views
response.jsonjson
{ "value": 1 }
3

Read the value

terminalbash
curl https://pascal.yourdomain.com/api/get/myapp/page-views
response.jsonjson
{ "value": 1 }

All code examples below will update automatically.

API Reference

All available endpoints. Click any endpoint to expand its documentation.

Public Endpoints

Admin Endpoints

All admin endpoints require an Authorization: Bearer <admin_key> header. You receive the admin key when creating a counter.

SVG Shields / Badges

Embed live counter badges in your README, website, or anywhere that supports images.

Available on both /hit/.../shield and /get/.../shield routes.

ParameterDefaultDescription
textpascalLabel text on the left side
bgcolor#4c1Background color of the value side
textcolor#fffText color
styleflatflat flat-square plastic
fontsize11Font size in pixels

Example

README.mdhtml
<!-- In your README.md -->
![views](https://pascal.yourdomain.com/api/hit/myapp/readme-views/shield?text=views&bgcolor=%23007ec6&style=flat)

Rate Limiting

To prevent abuse, Pascal enforces rate limits on all API endpoints.

Limit: 30 requests per IP address per 10-second window (sliding window algorithm).

Rate limit headers are included in every response:

headersbash
RateLimit-Limit: 30
RateLimit-Remaining: 27
RateLimit-Reset: 1700000000
RateLimit-Policy: 30;w=10

If you exceed the limit, you'll receive a 429 Too Many Requests response with a Retry-After header.

JSONP Support

All GET endpoints support JSONP for cross-domain compatibility.

Pass a callback query parameter:

jsonp-example.jsjavascript
1curl "https://pascal.yourdomain.com/api/get/myapp/views?callback=handleCount"
2
3// Response:
4/**/ typeof handleCount === 'function' && handleCount({"value":42});

FAQ

Do counters expire?

Yes. Counters expire after 6 months of inactivity. Every time a counter is accessed (read, hit, or modified), the expiration resets. If nobody touches a counter for 6 months, it will be automatically deleted.

What are namespaces?

Namespaces let you organize counters by project or category. For example, myapp/downloads and myapp/visits share the namespace myapp.

What are the naming rules?

Both namespaces and keys must be 3-64 characters and match [A-Za-z0-9_-.]. Letters, numbers, underscores, hyphens, and dots only.

Is there a cost?

Pascal is completely free to use. No sign up, no API keys for basic usage.

What if I lose my admin key?

Admin keys cannot be recovered. If you lose your admin key, you won't be able to delete, reset, or set the counter value. The counter will still work for reading and incrementing.