Self-Hosted APIs
Create an admin JWT
Sign in with email and password on self-hosted Databrain and get a short-lived access token.
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
The user's email.
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.
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.code | Why |
|---|---|
Invalid credentials | The email or password is wrong, or no user has this email |
ACCOUNT NOT VERIFIED | The user has not verified their email |
INVITATION_NOT_ACCEPTED | The user has not accepted the invitation |
LICENSE_EXPIRED | Trial or License Key is Expired! |
ACCOUNT_DISABLED | The organization is disabled |
SELFHOSTED_APP_ERROR | You called it on Databrain cloud |
INTERNAL_SERVER_ERROR | No token was made. This is also the answer when multi-factor sign-in is on |
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>"}'{ "data": { "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }}