🔐 Authentication API

Authentication

Secure user authentication and authorization for the AURA API.

Overview
AURA uses JWT (JSON Web Tokens) for secure authentication

JWT Tokens

Secure token-based authentication

HTTPS Only

All requests over secure connection

User Management

Complete user lifecycle management

API Endpoints

POST
/api/auth/signup
Create a new user account

Parameters

email
string
Required
User email address
password
string
Required
User password (min 8 characters)
name
string
User full name

Example Request

curl -X POST "/api/auth/signup" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "password123"}'

Response

Success
Status: 201
Response:
{
  "user": {
    "id": "uuid",
    "email": "user@example.com"
  },
  "token": "jwt_token"
}
Error
Status: 400
Response:
{
  "error": "Email already exists"
}
POST
/api/auth/signin
Authenticate existing user

Parameters

email
string
Required
User email address
password
string
Required
User password

Example Request

curl -X POST "/api/auth/signin" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "password123"}'

Response

Success
Status: 200
Response:
{
  "user": {
    "id": "uuid",
    "email": "user@example.com"
  },
  "token": "jwt_token"
}
Error
Status: 401
Response:
{
  "error": "Invalid credentials"
}
POST
/api/auth/signout
Sign out user and invalidate token

Example Request

curl -X POST "/api/auth/signout" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "password123"}'

Response

Success
Status: 200
Response:
{
  "message": "Successfully signed out"
}
GET
/api/auth/me
Get current user information

Headers

AuthorizationBearer <token>
Required

Example Request

curl -X GET "/api/auth/me" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "password123"}'

Response

Success
Status: 200
Response:
{
  "user": {
    "id": "uuid",
    "email": "user@example.com",
    "name": "John Doe"
  }
}
Error
Status: 401
Response:
{
  "error": "Unauthorized"
}
Error Codes
Common HTTP status codes and their meanings
400
Bad Request
401
Unauthorized
403
Forbidden
404
Not Found
422
Validation Error
500
Internal Server Error