Skip to content

POST /authorize/totp

For standard users: the people who sign in to the portal. Send your email, password and current authenticator code in one call, and get a bearer token you can use on /api/v1/infer.

API users don’t use this endpoint: they call POST /authorize with a username and password.

The token is opaque. Your application stores it as a string and replays it as a header on every subsequent call. Treat it like a session cookie: don’t log it, don’t share it, and reissue when it expires.

Before you start

You need to have set up an authenticator app (TOTP) for your account in the portal. This endpoint doesn’t enrol you, and it uses the same authenticator as your portal sign-in.

Agent-only users sign in with an emailed code rather than an authenticator app, so they can’t use this endpoint.

Endpoint

POST /api/v1/authorize/totp

Headers

HeaderValue
Content-Typeapplication/json

No Authorization header on this call — this is how you obtain one.

Request body

{
"username": "you@example.com",
"password": "<your password>",
"code": "123456"
}
FieldTypeRequiredNotes
usernamestringyesThe email you sign in to the portal with.
passwordstringyesYour portal password.
codestringyesThe current 6-digit code from your authenticator. One of your backup codes also works, and is used up.

Successful response

200 OK

{
"token": "AT1...<opaque base64url string>...",
"expires_at": 1746838800,
"token_type": "Bearer",
"user_id": 123,
"user_kind": "app_user",
"customer_id": 45
}
FieldTypeNotes
tokenstringBearer token. Reuse it for /api/v1/infer calls.
expires_atintegerUnix timestamp (seconds, UTC) when the token stops working. Always 24 hours after the call.
token_typestringAlways "Bearer". Use it as the Authorization scheme.
user_idintegerYour RebelCore™ user ID.
user_kindstringThe type of account: app_user, super_admin, dpo or security_officer. IDs can repeat across types, so use user_kind and user_id together to identify someone.
customer_idintegerYour RebelCore™ customer ID.

The token itself is encrypted and can’t be read by your application, so use these fields rather than trying to decode it.

Responses carry Cache-Control: no-store.

What the token can see

The token acts as you. /api/v1/infer only uses datasets from projects you can access in the portal, and your account is checked again on every call. If you’re deactivated, the token stops working straight away rather than when it expires.

Errors

StatusBodyWhenWhat to do
401{ "detail": "invalid credentials" }Wrong email, password or code, or an inactive account. The API doesn’t say which.Fix the credentials and retry with a fresh code. Don’t retry in a tight loop.
403{ "detail": "totp_not_enrolled" }The password is right, but the account has no authenticator set up.Set one up in the portal.
403{ "detail": "password_change_required" }The account has to change its password first.Sign in to the portal and change it.
403{ "detail": "no_app_access" }The account has no RebelCore™ permissions.Ask your Customer Super Admin for a role.
403{ "detail": "customer_blocked" }Your customer’s access is suspended or disabled.Contact your Customer Super Admin.
429{ "detail": "account locked" }Five wrong passwords or codes in a row. Further attempts are refused for 15 minutes, even with correct details. This is the same account lock as the portal.Wait for the Retry-After header (seconds).
422validation errorThe request body is missing a field or has the wrong type.Fix the request.

A 403 with error code: 1010 means the request was blocked before reaching the API because of its User-Agent. Python’s built-in urllib default triggers this: use an HTTP library such as httpx, or set your own User-Agent.

Token lifetime

  • Duration: 24 hours from issue.
  • Renewal: there is no refresh token. When a call returns 401 token expired, call this endpoint again with a fresh code.
  • Revocation: deactivating the account in the portal stops the token on its next call.

Example

curl

Terminal window
curl https://api.rebelcore.ai/api/v1/authorize/totp \
-H "Content-Type: application/json" \
-d '{"username":"you@example.com","password":"...","code":"123456"}'

Python (httpx)

import httpx
r = httpx.post(
"https://api.rebelcore.ai/api/v1/authorize/totp",
json={"username": "you@example.com", "password": PASSWORD, "code": code},
)
r.raise_for_status()
token = r.json()["token"]

Node.js (fetch)

const r = await fetch("https://api.rebelcore.ai/api/v1/authorize/totp", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ username: "you@example.com", password: PASSWORD, code }),
});
const { token } = await r.json();

Next