Skip to main content
The users endpoint handles authentication. Submit your credentials to receive a JWT token that authorizes access to the rest of the API.

User roles

Every Rakcha account is assigned one of three roles:
RoleDescription
clientA regular end user who can browse content and purchase products.
adminA platform administrator with full access to manage users, cinemas, films, series, and products.
cinema_managerA cinema owner or manager responsible for managing their own cinema listings and schedules.

Authenticate a user

POST /api/users/auth
Validates credentials and returns a signed JWT token along with the authenticated user object.

Request body

email
string
required
The email address associated with the user’s account. Must be a valid email format.
password
string
required
The user’s account password.

Response — 200 OK

token
string
required
A signed JWT bearer token. Include this value in the Authorization: Bearer <token> header on all subsequent requests.
user
object
required
The authenticated user object.

Response — 401 Unauthorized

Returned when the email or password is incorrect.
message
string
A human-readable error message describing the authentication failure.

Example request

curl --request POST \
  --url https://rakcha.example.com/api/users/auth \
  --header 'Content-Type: application/json' \
  --data '{
    "email": "[email protected]",
    "password": "s3cur3P@ssword"
  }'

Example response — 200 OK

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjcsImVtYWlsIjoibWFuYWdlckByYWtjaGEuZXhhbXBsZS5jb20iLCJyb2xlIjoiY2luZW1hX21hbmFnZXIiLCJpYXQiOjE3MTE1MjgwMDB9.xyz789",
  "user": {
    "id": 7,
    "email": "[email protected]",
    "role": "cinema_manager"
  }
}

Example response — 401 Unauthorized

{
  "message": "Invalid credentials."
}
Passwords are transmitted over HTTPS and are never returned in any API response. Always store tokens securely and never expose them in client-side code or logs.

Build docs developers (and LLMs) love