AlgoPattern API

Beta. The API is rolling out gradually; the token screen appears in the app as it reaches your account.

Read-only access to your own progress, for personal integrations such as dashboards, scripts and widgets.

Browse the endpoints →

Quick start

  1. In the app, open Settings → Advanced and create a token. Copy it right away: it is shown once.
  2. Call the API with it:
curl https://api.algopattern.app/v1/me/streak \
  -H "Authorization: Bearer ap_pat_…"

Authentication

Personal access tokens

The API uses personal access tokens: long, random strings starting with ap_pat_, created in the app.

  • Tokens need a linked account (email, Apple or Google). Guest accounts can't create them.
  • You can have up to 5 tokens. Name each one after where it's used, so you know which to revoke.
  • A token can only read your progress. It can't change anything, and it can't sign in to the app.
  • Treat a token like a password. If one leaks, revoke it in the app; it stops working on its next request.

Using a token

Send the token in the Authorization header of every request:

Authorization: Bearer ap_pat_…

Check a token with GET /v1/me, which says whose it is and what it's called. It's a good first call for an integration's setup screen.

Usage

Endpoints

Each endpoint answers one question, so you only ask for what you show:

Endpoint Answers
GET /v1/me/streak Is my streak alive, and have I practised today?
GET /v1/me/xp How much XP do I have, and where do I rank?
GET /v1/me/activity What did I do on each day?
GET /v1/me Whose token is this?

Fields, examples and code samples are in the endpoint reference.

Response format

Every response is a JSON object with one of two shapes. A success has the resource under a key named after it, next to as_of, the time the response was computed:

{
  "streak": { "current": 42, "active_today": true, … },
  "as_of": "2026-10-30T19:05:12Z"
}

An error has error instead (see Errors), so check for error first, then read the resource.

Fields with no value are null, never left out.

Days and time zones

Streaks and activity count your local days, in the time zone of the device you last used the app on. Responses say which one in timezone, and today is your current local date.

The weekly leaderboard is different: its week starts Monday 00:00 UTC for everyone, so this_week in /v1/me/xp can split near midnight differently from your local days.

Dates are YYYY-MM-DD; timestamps are ISO 8601 in UTC.

Polling

Your progress changes a few times a day at most. Poll every 5 minutes at most, and only the endpoints you display: an integration showing your streak and XP makes two requests per poll.

Past days of activity never change. Fetch them once and keep them, then poll only a short recent range.

Responses carry Cache-Control: private, max-age=…: 60 seconds for streak and XP, 5 minutes for activity. A browser or caching HTTP client may reuse a response for that long; the API itself always answers with live data.

Rate limiting

Each token may make 60 requests a minute. Every response says where you stand:

Header Meaning
X-RateLimit-Limit Requests allowed per minute
X-RateLimit-Remaining Requests left this minute
X-RateLimit-Reset Unix time when the minute resets

Over the limit, you get 429 with a Retry-After header.

Errors

Errors have an HTTP status and a JSON body with a stable code:

{
  "error": {
    "code": "invalid_token",
    "message": "The token is missing, invalid or revoked."
  }
}
Status Code What to do
400 invalid_request Fix the query parameters
401 invalid_token Check the token, or create a new one
404 not_found Check the path
429 rate_limited Wait for Retry-After seconds
500 internal_error Retry with backoff

Rely on code, not message. New codes may be added; handle unknown ones by HTTP status.

Versioning

Within /v1, changes only add fields and endpoints; ignore fields you don't recognise. A breaking change means /v2, with at least 90 days when both work, announced in the changelog.

Legal

Permitted use

Personal, non-commercial integrations with your own account are welcome. You may not:

  • build an app or website that replaces or replicates AlgoPattern
  • share your token or use someone else's
  • work around the rate limit
  • use the app's internal endpoints instead of this API

Terms of Service

Using the API means agreeing to the AlgoPattern Terms of Service, which this page doesn't replace.

Help

Support

Changelog

v1.0.0

November 2026

Initial release of the AlgoPattern API.