MonetizationOS Docs
Webscale APICounter Updates

Update Usage Counters

Updates usage counters without performing a full access check. This is useful for tracking usage after access has already been verified, or for batch counter updates.

Unlike access checks, this endpoint only updates counters and returns a simple success response.

User Identity

You can identify users in three ways (only one should be specified per request):

  • anonymousIdentifier: For anonymous/unauthenticated users
  • userJwt: JWT token for authenticated users
  • userIdentifier: Direct user ID (requires secret key)
POST
/api/v1/counter-updates
AuthorizationBearer <token>

API key authentication. Use secret keys (sk_*) for full access or public keys (pk_*) for limited access.

In: header

identityRequest Identity

Properties used to identify the user or session that the request is associated with

Request with direct user identifier

userIdentifierstring

Authenticated user identifier. Can only be used with an organization's secret keys. Use this when you have a direct user ID from your system.

Request with JWT token

userJwtstring

JWT token for user authentication. The JWT must be valid according to your configured JWT integrations.

Request with anonymous identifier

anonymousIdentifierstring

Identifier for anonymous/unauthenticated users. Use this for guest sessions or before user login.

resourceId?string

ID of the resource being tracked

update?number

Amount to add to the counter (can be negative)

Default1
counterIdstring

Unique identifier for the counter to update

cloudflare?Cloudflare Request Info

Request information specific to requests made from Cloudflare Workers. (requires secret key)

Response Body

curl -X POST "https://api.monetizationos.com/api/v1/counter-updates" \  -H "Content-Type: application/json" \  -d '{    "identity": {      "anonymousIdentifier": "anon_session_789"    },    "counterId": "default:feat_123456.requests",    "update": 1  }'

{
  "status": "success"
}

{
  "status": "error",
  "statusCode": 400,
  "message": "Invalid JSON body"
}

{
  "status": "error",
  "statusCode": 401,
  "message": "Invalid API key"
}

{
  "status": "error",
  "statusCode": 404,
  "message": "Organization not found"
}

{
  "status": "error",
  "statusCode": 500,
  "message": "Internal server error"
}