Skip to main content

Register User

curl -X POST https://api.example.com/auth/register/ \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "username": "johndoe",
    "password": "SecurePass123!"
  }'
{
  "message": "Registered successfully"
}
Create a new user account. Endpoint: POST /auth/register/ Authentication: None required

Request Body

email
string
required
User’s email address (must be valid email format)
username
string
required
Username for the account
password
string
required
Password (must meet security requirements)
phone
string
Optional phone number

Response

message
string
Success message

Login

curl -X POST https://api.example.com/auth/login/ \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "SecurePass123!"
  }'
{
  "message": "Logged in successfully",
  "user": {
    "uid": "user123",
    "email": "[email protected]",
    "username": "johndoe",
    "phone": null,
    "rol": "user"
  },
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Authenticate a user and receive an access token. Endpoint: POST /auth/login/ Authentication: None required

Request Body

email
string
required
User’s email address
password
string
required
User’s password

Response

message
string
Success message
user
object
User information
token
string
JWT access token (valid for 30 days). Include this token in the Authorization header for authenticated requests.

GitHub OAuth Login (Web)

curl -X GET https://api.example.com/auth/github/login/web
Initiate GitHub OAuth login flow for web applications. Endpoint: GET /auth/github/login/web Authentication: None required Behavior: Redirects to GitHub OAuth authorization page. After successful authentication, redirects back to the configured frontend origin with user data and token as query parameters.

GitHub OAuth Login (Mobile)

curl -X GET https://api.example.com/auth/github/login/mobile
Initiate GitHub OAuth login flow for mobile applications. Endpoint: GET /auth/github/login/mobile Authentication: None required Behavior: Redirects to GitHub OAuth authorization page. After successful authentication, redirects to the app deep link with token and code.

GitHub OAuth Callback

Endpoint: GET /auth/github/callback Authentication: None required Internal Use: This endpoint is called by GitHub after OAuth authorization. Do not call this endpoint directly.

Query Parameters

code
string
required
Authorization code from GitHub
state
string
State parameter for security verification

Request Password Reset

curl -X POST https://api.example.com/auth/request-password-reset/ \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]"
  }'
{
  "message": "Código de verificación enviado"
}
Request a password reset code to be sent via email. Endpoint: POST /auth/request-password-reset/ Authentication: None required

Request Body

email
string
required
Email address of the account to reset

Response

message
string
Confirmation message in Spanish

Verify Reset Code

curl -X POST https://api.example.com/auth/verify-reset-code/ \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "code": 123456
  }'
{
  "message": "Código de verificación válido",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Verify the password reset code sent to the user’s email. Endpoint: POST /auth/verify-reset-code/ Authentication: None required

Request Body

email
string
required
User’s email address
code
number
required
Verification code received via email

Response

message
string
Success message
token
string
Temporary token for password reset (use in next step)

Reset Password

curl -X POST "https://api.example.com/auth/reset-password/?token=RESET_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "new_password": "NewSecurePass123!"
  }'
{
  "message": "Contraseña actualizada con éxito",
  "user": {
    "uid": "user123",
    "email": "[email protected]",
    "username": "johndoe"
  }
}
Reset the user’s password using the verification token. Endpoint: POST /auth/reset-password/ Authentication: None required (uses reset token from verification step)

Query Parameters

token
string
required
Token received from verify-reset-code endpoint

Request Body

new_password
string
required
New password for the account

Response

message
string
Success message
user
object
Updated user information

Build docs developers (and LLMs) love