Authentication
Introduction
The Authentication API provides endpoints for user login and token refresh operations. These endpoints are part of the Public API and handle user authentication using JWT tokens.
Login
Authenticate a user by their credentials and return a JWT token.
Endpoint
POST /v1/login
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
email |
string | Yes | Valid email address |
password |
string | Yes | Password |
code |
string | No | Two factor authentication code (6 digits, required if 2FA enabled) |
Example Request Body
{ "email": "user@example.com", "password": "mySecur€Password!", "code": "534323"}
Responses
Success Response
- Status Code:
200 OK - Description: Successful login
- Headers:
access_token: JWT token for the requested user
- Body:
{ "id": "AJ6EJQCF", "email": "user@example.com"}
Error Responses
401 Unauthorized
Invalid credentials provided.
{ "timestamp": "2025-12-01T16:14:53+00:00", "message": "Unauthenticated.", "path": "/v1/login", "request_id": "e942428f-2a98-47a6-be74-db072206f0a2"}
400 Bad Request
Validation errors.
{ "timestamp": "2025-12-01T16:14:54+00:00", "message": "The password field is required.", "path": "/v1/login", "request_id": "c3222d4c-1f0c-4084-9908-df626110a63b", "details": {
"password": [ { "message": "The password field is required." } ] } }
Refresh Token
Refresh the JWT token for an authenticated user.
Endpoint
POST /v1/refresh-token
Request Parameters
| Parameter | Location | Required | Description |
|---|---|---|---|
Authorization |
Header | Yes | Bearer token (the current JWT token) |
Example Request
curl -X POST https://api.raidboxes.io/v1/refresh-token \ -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
Responses
Success Response
- Status Code:
200 OK - Description: Refresh successful
- Headers:
access_token: JWT token for the requested user
- Body:
{ "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."}
Error Responses
401 Unauthorized
Invalid credentials provided.
{ "timestamp": "2025-12-01T16:37:11+00:00", "message": "Authentication credentials are required.", "path": "/v1/refresh-token", "request_id": "req_5450b035"}
500 Internal Server Error
Server error during token refresh.
{ "timestamp": "2025-12-01T16:37:11+00:00", "message": "An internal server error occurred. Please try again later.", "path": "/v1/refresh-token", "request_id": "req_d6761ebd"}