API Reference
All API endpoints are under https://id.fabi-sc.com/api/v1/.
Authentication
All requests require an API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Most endpoints also require a user token in the X-User-Token header:
X-User-Token: USER_TOKEN
Response Format
All responses follow this format:
{
"success": true|false,
"data": { ... } | null,
"error": "Error message" | null,
"reconsent": true|false
}
The reconsent flag indicates whether the user needs to reconnect your application. If true, redirect the user to the login page.
POST /exchange
Exchange a one-time code for an access token.
Headers:
Authorization: Bearer API_KEY(required)
Request Body:
{
"code": "authorization-code"
}
Response:
{
"success": true,
"data": {
"token": "user-access-token",
"user_id": "derived-user-uuid",
"scopes": ["openid", "username", "email"]
},
"reconsent": false
}
Notes:
- The code is single-use and expires after 5 minutes
- The token lifetime is configured in your application settings
- The
user_idis a derived ID unique to your application
Errors:
| Status | Error |
|---|---|
| 400 | Invalid or expired code |
| 401 | Invalid or missing API key |
POST /validate
Check if a user token is still valid.
Headers:
Authorization: Bearer API_KEY(required)
Request Body:
{
"token": "user-access-token"
}
Response (valid token):
{
"success": true,
"data": {
"valid": true,
"user_id": "derived-user-uuid"
},
"reconsent": false
}
Response (invalid/expired token):
{
"success": true,
"data": {
"valid": false,
"user_id": null
},
"reconsent": false
}
Response (re-consent needed):
{
"success": false,
"error": "Re-consent required",
"reconsent": true
}
Notes:
successindicates whether the API request itself succeeded (valid API key, no server errors)validindicates whether the token is valid- A request can have
success: truewithvalid: false(e.g., expired token) - Banned users return
valid: false - If
reconsentistrue, redirect the user to reconnect
Errors:
| Status | Error |
|---|---|
| 401 | Invalid or missing API key |
| 403 | Domain not verified |
| 403 | App banned |
GET /user
Get user data for the authenticated user.
Headers:
Authorization: Bearer API_KEY(required)X-User-Token: USER_TOKEN(required)
Response:
{
"success": true,
"data": {
"id": "derived-user-uuid",
"username": "johndoe",
"display_name": "John Doe",
"avatar_url": "https://...",
"locale": "en",
"email": "john@example.com",
"email_verified": true,
"date_of_birth": "1990-01-15",
"first_name": "John",
"last_name": "Doe",
"bio": "Software developer",
"website_links": ["https://johndoe.com"],
"timezone": "Europe/Berlin"
},
"reconsent": false
}
Notes:
- Only fields for granted scopes are returned
- Fields the user hasn’t filled in are
null - The
idfield is always present (scopeopenid)
Errors:
| Status | Error |
|---|---|
| 401 | Invalid or missing API key |
| 403 | User has not granted permission |
| 403 | User profile incomplete. Missing data: … |
GET /avatar
Download the authenticated user’s avatar image.
Headers:
Authorization: Bearer API_KEY(required)X-User-Token: USER_TOKEN(required)
Query Parameters:
format: Image format -webporjpg(required)
Response:
- Content-Type:
image/webporimage/jpeg - Cache-Control:
private, max-age=3600
Returns the binary image data.
Errors:
| Status | Error |
|---|---|
| 400 | Invalid format |
| 400 | Missing format parameter |
| 403 | App has no ‘avatar’ scope |
| 404 | User has no avatar |
| 404 | Avatar file not found in format |
POST /revoke
Revoke a user token. Use this when a user logs out of your application.
Headers:
Authorization: Bearer API_KEY(required)
Request Body:
{
"token": "user-access-token"
}
Response:
{
"success": true,
"data": {
"revoked": true
},
"reconsent": false
}
POST /force-reconsent
Force a user to reconnect your application. Use this when you’ve added new optional scopes and want the user to see them.
Headers:
Authorization: Bearer API_KEY(required)X-User-Token: USER_TOKEN(required)
Response:
{
"success": true,
"data": {
"triggered": true
},
"reconsent": false
}
Notes:
- The next time you validate the user’s token,
reconsentwill betrue - The user will see the updated scopes when they reconnect
Errors:
| Status | Error |
|---|---|
| 404 | User has no existing permission |
Common Error Responses
| Status | Error | Description |
|---|---|---|
| 401 | Invalid or missing API key | Check your Authorization header |
| 403 | Domain not verified | Verify your domain in the Developer Dashboard |
| 403 | App banned | Your application has been suspended |
| 403 | Origin not allowed | Request origin not in allowed_origins |
| 403 | User has not granted permission | User hasn’t connected your app |
| 500 | Internal server error | Server-side error, try again later |