Self-Hosted APIs
Create the admin account
Make the first organization and admin user on a new self-hosted Databrain.
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
3 to 30 characters.
A work email. Free mail domains such as Gmail, Yahoo and Outlook are refused.
At least 8 characters, with an upper-case letter, a lower-case letter, a number and a special character, and no spaces.
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.code | Why |
|---|---|
INVALID_REQUEST | An organization already exists. Sign in with an admin JWT |
INVALID REQUEST BODY | A 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_ERROR | This feature is only available for self-hosted instances |
COMPANY_EXISTS or USER_EXISTS | The organization or user could not be created |
INTERNAL_SERVER_ERROR | The account was not created. Try again |
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"}'{ "data": { "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }}