Authentication API
Login
Authenticate and receive an access token.
Endpoint: POST /api/auth/login
Request Body:
{
"email": "user@example.com",
"password": "your-password"
}
Response:
{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 1,
"email": "user@example.com",
"role": "admin"
}
}
}
Error Response:
{
"success": false,
"error": "Invalid credentials"
}
Get Current User
Get information about the currently authenticated user.
Endpoint: GET /api/auth/me
Headers:
Authorization: Bearer YOUR_TOKEN_HERE
Response:
{
"success": true,
"data": {
"id": 1,
"email": "user@example.com",
"role": "admin"
}
}
Error Response (Unauthorized):
{
"success": false,
"error": "Unauthorized"
}
Using the Token
Include the token in the Authorization header for all authenticated requests:
curl -H "Authorization: Bearer YOUR_TOKEN_HERE" \
https://your-domain.com/api/sync/status