📘 Vibio API Documentation

Last updated: June 26, 2025

🔐 Authentication

POST /api/login

Authenticates a user and returns a token.

POST /api/register

Registers a new user.

Request:
{
  "username": "new_user",
  "email": "user@example.com",
  "password": "your_password"
}
Response:
{
  "message": "Registered successfully.",
  "token": "Bearer xxxxx",
  "user": { "id": 2, "role": "user" }
}

📧 Email Confirmation

POST /api/verify-email

Verifies user email with a 6-digit code.

Request:
{
  "email": "user@example.com",
  "code": "123456"
}
Response:
{
  "message": "Email verified successfully."
}

🧑 Profile Setup

POST /api/profile/setup

Set profile type and username.

Request:
{
  "profile_type": "user",
  "username": "vibio_user"
}
Response:
{
  "message": "Profile set up successfully.",
  "user": {
    "username": "vibio_user",
    "profile_type": "user"
  }
}

📝 Posts

GET /api/posts

Retrieves public posts.

Headers:
Authorization: Bearer {token}
Response:
[
  {
    "id": 1,
    "author": "user1",
    "content": "Hello world!",
    "created_at": "2025-06-12"
  }
]

🚪 Logout

POST /api/logout

Logs the user out and invalidates the token.

Headers:
Authorization: Bearer {token}