CountTogether Public API Help

Counters Endpoint

Retrieve all counters accessible to the authenticated user.

GET /v1/counters

Returns an array of Counter objects.

Request

Headers:

Authorization: Bearer YOUR_TOKEN Accept: application/json

Curl:

curl -H "Authorization: Bearer YOUR_TOKEN" https://developers.counttogether.app/v1/counters

Successful Response (200)

[ { "id": "018f5b54-9b11-7c33-b347-a2b4e2a6a111", "displayName": "Daily Steps", "type": "UpDown", "members": [ { "userId": "4f9b0c9d-9d3d-4f2b-9c97-5d6c3f0e4c11", "displayName": "You", "isAdmin": true } ], "data": { "value": 12450, "mode": "UpAndDown" } } ]

Empty Result

If the user owns or shares no counters, the endpoint returns [].

Authentication Errors

  • Missing / invalid token → 401 Unauthorized

Error Body (Business Errors)

Errors generated inside the pipeline use the structure documented in Errors.

Notes

  • No pagination yet (the typical number of counters per user is expected to be small). Pagination may be introduced later; treat additional unknown top-level fields as forward-compatible.

  • The endpoint is idempotent and safe.

Field Reference (Counter)

Field

Type

Description

id

string (UUID v7)

Unique counter identifier

displayName

string

Human readable name (5..40 chars)

type

enum UpDown \|FromDate \|ToDate

Counter category controlling data shape

members

array

Current member list (see Data Models)

data

object or null

Type-specific payload

See Counter Data Models for data shapes.

Mutating Endpoints for UpDown Counters

POST /v1/counters/{counterId}/increment

Increment the value of an UpDown counter by 1. Returns the new numeric value as a plain number.

Request example:

curl -X POST -H "Authorization: Bearer YOUR_TOKEN" \ https://developers.counttogether.app/v1/counters/018f5b54-9b11-7c33-b347-a2b4e2a6a111/increment

Response (200):

12501

POST /v1/counters/{counterId}/decrement

Decrement the value by 1 (only if the counter mode permits decrement operations). Returns the new value.

curl -X POST -H "Authorization: Bearer YOUR_TOKEN" \ https://developers.counttogether.app/v1/counters/018f5b54-9b11-7c33-b347-a2b4e2a6a111/decrement

Response (200):

12500

Possible Errors

HTTP

Code

Reason

400

InvalidOperationForCounterType

Counter type not UpDown or mode disallows operation

401

(auth)

Missing or invalid token

403

(authz)

User not a member / lacks permission

404

NotFound

Counter does not exist or not visible

Realtime Integration

Successful mutations emit a JSON-RPC notification with method: "counterUpdated" containing the updated state.

Idempotency

Not idempotent. Repeating the same POST increments/decrements again.

Rate Limiting

These requests count towards the same sliding window user limit. Excessive mutation may lead to 429 responses.

Last modified: 01 October 2025