Organizations and Users#

By default, a new organization, “My Organization” is created by the installer for convenience. You can also create new organizations using the API with the superadmin user.

Log in with superadmin credentials#

The first thing you will need is a superadmin authorization token. To obtain this, you will need to make a POST request to your organization’s /login endpoint with the password set in the Admin Console Config page.

POST /login
{
   "login": "superadmin",
   "password": "<superadmin-password>"
}

The response will look like this:

{
    "id": "ed1dcb56-352a-4130-8f52-1fd1225196b1",
    "first_name": "Super",
    "last_name": "Admin",
    "email": "superadmin@arthur.ai",
    "username": "superadmin",
    "roles": null,
    "active": true,
    "show_intro_sequence": true,
    "help_mode_enabled": false,
    "created_at": "2021-08-09T19:57:44.92047Z"
}

The response will also include a set-cookie HTTP header with an authorization token.` Copy the authorization token value and use it in subsequent requests as your auth token.

set-cookie: Authorization=<authorization-token>; Path=/; Expires=Mon, 30 Aug 2021 16:51:07 GMT; Secure;

cURL example#

curl --location --request POST 'https://<your-domain>/api/v3/login' --header 'Content-Type: application/json' --data-raw '{ "login": "superadmin", "password": "<superadmin-password>" }' -v

Create a New Organization#

To create a new organization, you will need to make a POST request to /organizations with the body specifying the name. Ensure you are using a super admin authentication token to make this request.

POST /organizations
{
  "name": "my-new-organization"
}

The response will look like this:

{
    "id": "38faff8b-4edf-44c5-b103-aeca4ea71110",
    "name": "my-new-organization",
    "plan": "enterprise",
    "created_at": "2021-08-18T19:51:22.291504554Z"
}

Remember to save the id; you will need this to add users to your organization.

cURL Example#

curl --location --request POST '<your-domain>/api/v3/organizations' --header 'Content-Type: application/json' --header 'Authorization: <your-superadmin-access-control-token>' --data-raw '{ "name": "my-new-organization" }' -v

Create The First User in an Organization#

To create a new user in the new organization, you will need to make a POST request to /users?organization_id=<your_organization_id> using a super admin authentication token. You can set the role of the new user to Administrator, Model Owner, or User. Refer to the authorization page for the description of the roles.

POST /users?organization_id=<your_organization_id>
{
    "username": "newuser",
    "email": "newuser@email.com",
    "password": "G00dP@$$w0rd!",
    "first_name": "New",
    "last_name": "User",
    "roles": [
        "Administrator"
    ],
    "alert_notifications_enabled": true
}

The response will look like this.

{
    "id": "b6554927-9ac4-4531-bf76-fe640b8223b7",
    "first_name": "New",
    "last_name": "User",
    "email": "newuser@email.com",
    "username": "newuser",
    "roles": null,
    "active": true,
    "show_intro_sequence": true,
    "help_mode_enabled": true,
    "created_at": "2021-08-18T20:20:18.535137592Z"
}

You can now log in to the dashboard as this user.

cURL Example#

This action can be performed as either super administrator or organization administrator. If you’d like to use an organization administrator, repeat the /login API call performed earlier with the credentials for that user and save the returned authorization token.

curl --location --request POST 'https://<your-domain>/api/v3/users?organization_id=<your-organization-id>' --header 'Content-Type: application/json' --header 'Authorization: <your-superadmin-token>' --data-raw '{ "username": "<username>", "email": "<email-address>", "password": "<password>", "first_name": "<first-name>", "last_name": "<last-name>", "roles": [ "Administrator" ], "alert_notifications_enabled": true }'

Adding Additional Users#

Although you can continue to create users through the API, it is generally easier to create an Administrator user and then invite additional users from the UI. To add additional users this way, log in to Arthur AI with an Administrator user on a web browser and follow these steps:

  1. In the top right corner, you will see a series of icons. Click on the Organization icon that looks like a tree with three nodes.

    My Organization Panel

  2. You will see a dropdown menu. Click on Manage Members

  3. Under the heading, Invite Members, you can type in the email address of the person you wish to invite. That person will receive instructions for how to create a user in the organization via email.

    Invite Members Section

  4. Once the new user follows the emailed instructions, they will be able to log in with their newly created username and password. You will then be able to view that new user on this Manage Members page.

  5. As an Administrator, you can continue to use this page to manage users and roles.

Adding Existing Users To Existing Organizations via API:#

To add an existing user to an existing organization create a PATCH request to /organizations/<org_id>/users. Supplying in the body a json object defining the role (Administrator, Model Owner, or User) you want to add the user with. Any attributes other than roles that are supplied in the body will effect the user across all organizations that user is a part of.

PATCH /organizations/<org_id>/users
[
    {
      "user_id": "b6554927-9ac4-4531-bf76-fe640b8223b7",
      "role": "Model Owner"
    } ,
    {
      "user_id": "b6554927-9ac4-4531-bf76-fe640b8223b7",
      "role": "Model Owner"
    } 
]

The response will look like this.

{
  "updated_user_count": 10
}