Skip to content

Quick Start

This document provides a complete reference for all available endpoints in the FactuStorm API.

Authentication Endpoints

Register User

POST /api/v1/auth/register
Content-Type: application/json
{
"email": "user@example.com",
"password": "secure_password",
"name": "John Doe"
}

Response:

{
"id": "user_id",
"email": "user@example.com",
"name": "John Doe",
"created_at": "2024-03-20T12:00:00Z"
}

Login

POST /api/v1/auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "secure_password"
}

Response:

{
"access_token": "jwt_token",
"refresh_token": "refresh_token",
"expires_in": 3600,
"token_type": "Bearer"
}

Refresh Token

POST /api/v1/auth/refresh
Content-Type: application/json
{
"refresh_token": "refresh_token"
}

Response:

{
"access_token": "new_jwt_token",
"expires_in": 3600,
"token_type": "Bearer"
}

Logout

POST /api/v1/auth/logout
Authorization: Bearer <jwt_token>

Response:

{
"message": "Successfully logged out"
}

User Management Endpoints

Get User Profile

GET /api/v1/users/me
Authorization: Bearer <jwt_token>

Response:

{
"id": "user_id",
"email": "user@example.com",
"name": "John Doe",
"created_at": "2024-03-20T12:00:00Z",
"updated_at": "2024-03-20T12:00:00Z"
}

Update User Profile

PUT /api/v1/users/me
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"name": "John Updated",
"email": "john@example.com"
}

Response:

{
"id": "user_id",
"email": "john@example.com",
"name": "John Updated",
"updated_at": "2024-03-20T12:30:00Z"
}

Error Responses

All endpoints may return the following error responses:

400 Bad Request

{
"error": "Bad Request",
"message": "Invalid input data",
"details": {
"field": "email",
"message": "Invalid email format"
}
}

401 Unauthorized

{
"error": "Unauthorized",
"message": "Invalid or expired token"
}

403 Forbidden

{
"error": "Forbidden",
"message": "Insufficient permissions"
}

404 Not Found

{
"error": "Not Found",
"message": "Resource not found"
}

500 Internal Server Error

{
"error": "Internal Server Error",
"message": "An unexpected error occurred"
}