API REST
The Block-Auth API is for your backend. Use it to log users in without a backend SDK, or to read your app's users, roles and activity.
If your stack has an SDK, you don't need this section to log users in: follow the SDK Quickstart. Use the API directly when you work in another language or need data the SDKs don't expose.
Before you start
You need an active app in the Dashboard and its two keys. If you don't have them yet, follow the Integration Quickstart.
| Base URL | https://wss.block-auth.io/api |
| Format | JSON in and out (Content-Type: application/json) |
| Credentials | Your apiKey and the SHA-256 hash of your apiSecret |
Call the API only from your backend. The apiSecret and its hash give full access to your app: never send them to the browser, a mobile app or a public repository.
Hash your API secret
The API never receives your apiSecret in clear text. Send its SHA-256 hash, in lowercase hexadecimal. Compute it in your backend from an environment variable:
SHA-256 of the API secret
printf '%s' "$BLOCKAUTH_API_SECRET" | sha256sum | cut -d' ' -f1
In the rest of this section, apiSecret always means this hash.
Two kinds of endpoints
- User login (
/api/auth/*): you sendapiKeyandapiSecretin the body of each request. See User login. - Data (
/api/app,/api/user,/api/users,/api/roles,/api/logs): you send an access token in theAuthorizationheader. See Data.
Every endpoint has a cURL example. To try them in Postman or Insomnia, import the example with Import → Raw text.
Get an access token
Exchanges your credentials for an access token, valid for 1 hour, and a refresh token, valid for 2 hours. Send the access token in every data request:
Authorization: Bearer <accessToken>
Body
- Name
apiKey- Type
- string
- Description
Your app's API key.
- Name
apiSecret- Type
- string
- Description
SHA-256 hash (hex) of your API secret.
Request
curl -X POST https://wss.block-auth.io/api/signin \
-H 'Content-Type: application/json' \
-d '{
"apiKey": "your_api_key",
"apiSecret": "sha256_of_your_api_secret"
}'
Response
{
"success": true,
"message": {
"accessToken": "eyJhbGciOi…",
"refreshToken": "eyJhbGciOi…"
}
}
Refresh the access token
Returns a new pair of tokens before the refresh token expires. When it has expired, call /api/signin again.
Body
- Name
refreshToken- Type
- string
- Description
The
refreshTokenfrom your last/api/signinor/api/refresh.
Request
curl -X POST https://wss.block-auth.io/api/refresh \
-H 'Content-Type: application/json' \
-d '{ "refreshToken": "your_refresh_token" }'
Response
{
"success": true,
"message": {
"accessToken": "eyJhbGciOi…",
"refreshToken": "eyJhbGciOi…"
}
}
Responses and errors
Every response has the same shape. On success, message holds the data; on failure, it holds the reason as text.
{ "success": false, "message": "App not active, contact your admin" }
| Status | When |
|---|---|
200 | The request worked. |
400 | Wrong credentials, missing or invalid parameter, or any other failure. Read message. |
401 | Data endpoint without a valid access token: Unauthorized, valid token required. |
403 | The app is not active yet, its account is blocked for billing, or the user is not signed into your app. |
429 | Too many failed credential attempts from your IP. Wait the seconds in the Retry-After header. |
Pagination
List endpoints accept page (from 1) and limit (1 to 100, default 100) and answer:
{
"success": true,
"message": {
"pages": 1,
"items": [],
"total": 0
}
}
items: the results of the requested page.total: how many results match, across all pages.pages: the page you received, not the number of pages. Compute the number of pages asceil(total / limit).

