Skip to main content

Login

Authenticate and receive an access token.

Endpoint

POST /api/auth/login

Request Body

{
"email": "user@example.com",
"password": "yourpassword"
}

Response

{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "bearer",
"user": {
"id": "507f1f77bcf86cd799439011",
"email": "user@example.com",
"full_name": "John Doe",
"role": "user",
"email_verified": true
}
}

Usage

Include the token in subsequent requests:

curl http://localhost:8000/api/protected \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Errors

CodeMessage
401Invalid credentials
403Email not verified