Skip to Content

Self-Hosted APIs

Create the admin account

Make the first organization and admin user on a new self-hosted Databrain.

POST
/api/v2/admin-account

Call it once, on a new self-hosted install. It makes the organization, its admin user and a demo workspace, and returns an access token for that admin.

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

Before you start

  • Self-hosted only. On Databrain cloud the call returns SELFHOSTED_APP_ERROR.
  • No organization exists on the install yet. After the first call, the endpoint refuses.

Auth

None. Run it from your own network, before you open the install to users.

Body

firstNamestringrequired

3 to 30 characters.

lastNamestring

Last name.

Default: ""
emailstringrequired

A work email. Free mail domains such as Gmail, Yahoo and Outlook are refused.

passwordstringrequired

At least 8 characters, with an upper-case letter, a lower-case letter, a number and a special character, and no spaces.

companyNamestringrequired

Organization name. Saved in lower case.

Get product update emails. Default false

Response

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

accessToken is a JWT for the admin. It lasts 10 minutes, unless you set ACCESS_TOKEN_TTL. Use it to create a service token. For a new one later, create an admin JWT.

Errors

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

{ "error": { "code": "INVALID_REQUEST", "message": "Your company account is already created, please sign in" } }
error.codeWhy
INVALID_REQUESTAn organization already exists. Sign in with an admin JWT
INVALID REQUEST BODYA field is missing or wrong. The message names it, for example "password" should contain at least 1 special character or Please use a valid email address.
SELFHOSTED_APP_ERRORThis feature is only available for self-hosted instances
COMPANY_EXISTS or USER_EXISTSThe organization or user could not be created
INTERNAL_SERVER_ERRORThe account was not created. Try again
Example Request
curl -X POST 'https://databrain-api.example.com/api/v2/admin-account' \  -H 'Content-Type: application/json' \  -d '{  "firstName": "Alex",  "lastName": "Morgan",  "email": "alex@example.com",  "password": "<password>",  "companyName": "Example Inc"}'
Example Response200
{  "data": {    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."  }}