rateforge

Docs

Three endpoints total. The third one is the product.

Register an API

curl -s -X POST http://localhost:8114/api/apis \
  -H "Content-Type: application/json" \
  -d '{"email":"you@api.dev","name":"My API"}'

# creates default plans (free / pro) and returns your owner token

Issue user keys

curl -s -X POST "http://localhost:8114/api/keys?api_id=API_ID" \
  -H "Authorization: Bearer OWNER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"plan":"pro"}'

The user key is shown once and stored hashed. Hand it to your customer; they send it with every request.

The allow endpoint

GET http://localhost:8114/v1/allow?key=USER_KEY&cost=1

{ "allowed": true, "remaining": 999, "reset": 37 }

Call it at the top of your request handler. A denied call costs nothing: only successful decisions consume quota.

Usage and analytics

# a user checks their own consumption
curl "http://localhost:8114/v1/usage?key=USER_KEY"

# you check per-key rollups
curl http://localhost:8114/api/analytics/API_ID -H "Authorization: Bearer OWNER_TOKEN"

Plan limits

Free Pro $29/mo Scale $99/mo
Allow-calls / mo10k500k5M
APIs15unlimited
Analytics API-yesyes