Authentication
Overview
This page covers authentication endpoints used to sign up, log in, refresh tokens and log out.
Endpoints
- POST
/api/v1/auth/signup— Create a new user (body:SignupRequest) - POST
/api/v1/auth/login— Login and receive JWTs (body:LoginRequest) - POST
/api/v1/auth/refresh— Refresh tokens - POST
/api/v1/auth/logout— Revoke tokens (requires bearer auth)
Examples
Curl example: login
curl -X POST "{{baseUrl}}/api/v1/auth/login" \
-H 'Content-Type: application/json' \
-d '{"email":"[email protected]","password":"secret"}'
Common Notes
- All endpoints that require authentication return
401when unauthorized. - Successful login returns a JSON object with
access_tokenandrefresh_token(see OpenAPI schema).
See also
POST /api/v1/auth/signup
Summary: Create a new user account.
Request
- Content-Type:
application/json - Body schema:
SignupRequest(see OpenAPI)
Responses
200— User created (returnsSignupResponse)400— Bad request (returnsErrorResponse)
Example
curl -X POST "{{baseUrl}}/api/v1/auth/signup" \
-H 'Content-Type: application/json' \
-d '{"email":"[email protected]","password":"S3cureP@ss","name":"Jane Doe"}'
POST /api/v1/auth/login
Summary: Authenticate and obtain JWT tokens.
Request
- Content-Type:
application/json - Body schema:
LoginRequest
Responses
200— ReturnsJwtLoginResponsewithaccess_tokenandrefresh_token401— Unauthorized (invalid credentials)
Example
curl -X POST "{{baseUrl}}/api/v1/auth/login" \
-H 'Content-Type: application/json' \
-d '{"email":"[email protected]","password":"secret"}'
Notes
- Store
access_tokensecurely and use it inAuthorization: Bearer <token>headers. - Use
refresh_tokenonly to obtain new access tokens via/api/v1/auth/refresh.
POST /api/v1/auth/refresh
Summary: Exchange a refresh token for new tokens.
Request
- Content-Type:
application/json - Body:
{ "refresh_token": "..." }
Responses
200— ReturnsJwtLoginResponsewith new tokens
Example
curl -X POST "{{baseUrl}}/api/v1/auth/refresh" \
-H 'Content-Type: application/json' \
-d '{"refresh_token":"<refresh-token>"}'
POST /api/v1/auth/logout
Summary: Revoke tokens / logout the current user.
Security
- Requires
Authorization: Bearer <access_token>header.
Responses
200— Logged out (SuccessResponse)
Example
curl -X POST "{{baseUrl}}/api/v1/auth/logout" \
-H 'Authorization: Bearer <access_token>'