Skip to content

Authentication

Identity System

All users are automatically assigned a 7-character alphanumeric ID and a cryptographic key on first visit. These are stored in httpOnly cookies.

No registration is required to chat.

Endpoints

GET /api/auth/me

Returns the current user's identity.

Response:

json
{
  "id": "A7B3F9X",
  "username": null,
  "displayName": null,
  "countryCode": "IL",
  "countryFlag": "🇮🇱",
  "postsToday": 2,
  "freePostsRemaining": 3,
  "createdAt": "2026-02-22T07:00:00.000Z"
}

POST /api/auth/register

Register a username and password for your existing identity.

Body:

json
{
  "username": "alice",
  "password": "securepassword",
  "email": "[email protected]"
}

Constraints:

  • Username: 3-32 chars, alphanumeric + _ and -
  • Password: 8-128 chars
  • Email: optional

Response (201):

json
{ "ok": true, "user": { "id": "A7B3F9X", "username": "alice" } }

POST /api/auth/login

Body:

json
{ "username": "alice", "password": "securepassword" }

Response:

json
{ "ok": true, "user": { "id": "A7B3F9X", "username": "alice", "countryCode": "IL" } }

POST /api/auth/logout

Clears the session. No body needed.

Response:

json
{ "ok": true }

Bantr — Say anything.