Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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_id is a derived ID unique to your application

Errors:

StatusError
400Invalid or expired code
401Invalid 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:

  • success indicates whether the API request itself succeeded (valid API key, no server errors)
  • valid indicates whether the token is valid
  • A request can have success: true with valid: false (e.g., expired token)
  • Banned users return valid: false
  • If reconsent is true, redirect the user to reconnect

Errors:

StatusError
401Invalid or missing API key
403Domain not verified
403App 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 id field is always present (scope openid)

Errors:

StatusError
401Invalid or missing API key
403User has not granted permission
403User 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 - webp or jpg (required)

Response:

  • Content-Type: image/webp or image/jpeg
  • Cache-Control: private, max-age=3600

Returns the binary image data.

Errors:

StatusError
400Invalid format
400Missing format parameter
403App has no ‘avatar’ scope
404User has no avatar
404Avatar 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, reconsent will be true
  • The user will see the updated scopes when they reconnect

Errors:

StatusError
404User has no existing permission

Common Error Responses

StatusErrorDescription
401Invalid or missing API keyCheck your Authorization header
403Domain not verifiedVerify your domain in the Developer Dashboard
403App bannedYour application has been suspended
403Origin not allowedRequest origin not in allowed_origins
403User has not granted permissionUser hasn’t connected your app
500Internal server errorServer-side error, try again later