Chastity Tracker API v2 Documentation: Games Changes

  1. πŸ” Authentication

    All API requests must be authenticated via HTTPS using a bearer token.

    Usage

    URL

    https://www.chastitytracker.org

    HEADER

    GET /api/v2/games_changes.php HTTP/2
    Host: www.chastitytracker.org
    Authorization: Bearer {YOUR_API_TOKEN}
    Content-Type: application/json
  2. πŸ“¦ Response Envelope

    All v2 endpoints return a unified JSON envelope.

    Success

    {
      "ok": true,
      "data": { ... },
      "meta": {"version":2}
    }

    Error

    {
      "ok": false,
      "error": {"code":"...", "message":"..."},
      "meta": {"version":2}
    }
  3. ℹ️ About Games Changes

    Games Changes are read-only records generated by the system to track any modification of a game rules configuration during a session (DICE, LINK, LUCK).

    This endpoint is meant for integrations that want to show an audit log like the website does (who changed what, when, and what exactly changed).

    Important Privacy Note

    • The API returns dom nickname only (dom_nick), never the dom email.

    Field Meaning

    • game: DICE | LINK | LUCK
    • action: INSERT | UPDATE | DELETE
    • happened: UTC datetime when the rule change occurred
    • before: JSON object with previous config (may be null for INSERT)
    • after: JSON object with new config (may be null for DELETE)
    • changes: array of human-readable differences (label, from, to)

    Game Config Shapes

    • DICE: dices, addunit, waitint, waitunit, minmultiplier, maxmultiplier, optional penalties
    • LINK: addint, addunit, subint, subunit, waitint (votes required), minmultiplier, maxmultiplier
    • LUCK: addint, addunit, subint, subunit, waitint, waitunit, minmultiplier, maxmultiplier, optional penalties
    • Penalties object (when present): min, addint, addunit, always
  4. πŸ“Œ Endpoint: GET /api/v2/games_changes.php (list)

    Returns game rule changes for a specific session (token owner only).

    Query Parameters

    • session: integer (required)
    • game: DICE | LINK | LUCK (optional)
    • action: INSERT | UPDATE | DELETE (optional)
    • from: UTC datetime (optional) β€” filter on happened >= from
    • to: UTC datetime (optional) β€” filter on happened <= to
    • limit: integer (default 50, max 200)
    • cursor: string (optional, cursor pagination)
    • include_raw: 0/1 (default 0) β€” include before/after
    • include_diff: 0/1 (default 1) β€” include changes

    Sorting

    • Always ordered by happened DESC, id DESC for stable pagination.

    Example Request

    GET /api/v2/games_changes.php?session=123&game=DICE&limit=50 HTTP/2
    Host: www.chastitytracker.org
    Authorization: Bearer {YOUR_API_TOKEN}

    Response Example

    {
      "ok": true,
      "data": {
        "count": 1,
        "total": 1,
        "limit": 50,
        "cursor_next": "eyJoIjoiMjAyNi0wMi0xMiAxNzoxMjo1MS4xMjMiLCJpZCI6NDJ9",
        "items": [
          {
            "session": 123,
            "game": "DICE",
            "action": "UPDATE",
            "dom_nick": "GF",
            "happened": "2026-02-12 17:12:51.123",
            "before": {
              "dices": 2,
              "addunit": "HOUR",
              "waitint": 30,
              "waitunit": "MINUTE",
              "minmultiplier": 1.0,
              "maxmultiplier": 2.0
            },
            "after": {
              "dices": 3,
              "addunit": "HOUR",
              "waitint": 15,
              "waitunit": "MINUTE",
              "minmultiplier": 2.0,
              "maxmultiplier": 3.0
            },
            "changes": [
              {"label":"# of dice(s)","from":2,"to":3},
              {"label":"Wait time","from":"30 MINUTE(S)","to":"15 MINUTE(S)"},
              {"label":"Min multiplier","from":1,"to":2},
              {"label":"Max multiplier","from":2,"to":3}
            ]
          }
        ]
      },
      "meta":{"version":2}
    }

    Status Codes

    • 200 OK β€” Returned
    • 400 Bad Request β€” Validation error
    • 401 Unauthorized β€” Missing/invalid token
    • 404 Not Found β€” Session not found / not owned
    • 500 Internal Server Error β€” Server error
  5. ⚠️ Notes

    • Games Changes are read-only in v2 (no insert/update/delete).
    • All timestamps are UTC (as stored in database).
    • before/after may be null depending on the action.
    • changes is a convenience field; clients can also diff raw JSON if desired.
    • If include_raw=0, before/after are omitted. If include_diff=0, changes is omitted.
  6. ⚠️ Security Notes

    • Tokens must be stored securely by third parties.
    • Users can revoke or regenerate tokens at any time.
    • Never share a user’s token or sensitive info.
  7. πŸ“… Changelog

    • 2026-02-14: initial v2 release

To go back to documentation index click here.