Skip to Content

Self-Hosted APIs

Create an admin JWT

Sign in with email and password on self-hosted Databrain and get a short-lived access token.

POST
/api/v2/admin-account/jwt

Use the token to create a service token, rotate a token or reset your password.

curl --request POST https://databrain-api.example.com/api/v2/admin-account/jwt \  --header "Content-Type: application/json" \  --data '{ "email": "alex@example.com", "password": "<password>" }'

Before you start

  • Self-hosted only.
  • Multi-factor sign-in is off for your organization. With it on, this endpoint cannot return a token.

Auth

None. Any verified user of the install can sign in. The token has that user's own role, so use an admin for token work.

Body

emailstringrequired

The user's email.

passwordstringrequired

The user's password.

The password, encrypted with the install's public password key (RSA-OAEP-256, base64). Send it with keyId instead of password when the install refuses plain passwords.

keyIdstring

The id of the key that encrypted passwordCiphertext.

Response

{ "data": { "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." } }

The token lasts 10 minutes, unless you set ACCESS_TOKEN_TTL. No refresh token is returned: call this endpoint again for a new one. Send it as Authorization: Bearer <accessToken>.

Errors

This endpoint returns HTTP 200 for errors too. Check for error in the body.

error.codeWhy
Invalid credentialsThe email or password is wrong, or no user has this email
ACCOUNT NOT VERIFIEDThe user has not verified their email
INVITATION_NOT_ACCEPTEDThe user has not accepted the invitation
LICENSE_EXPIREDTrial or License Key is Expired!
ACCOUNT_DISABLEDThe organization is disabled
SELFHOSTED_APP_ERRORYou called it on Databrain cloud
INTERNAL_SERVER_ERRORNo token was made. This is also the answer when multi-factor sign-in is on
Example Request
curl -X POST 'https://databrain-api.example.com/api/v2/admin-account/jwt' \  -H 'Content-Type: application/json' \  -d '{  "email": "alex@example.com",  "password": "<password>"}'
Example Response200
{  "data": {    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."  }}