Enterprise User Management API
The Enterprise User Management API enables organization “owners” programmatically add, delete, show, or update users from their account. (“Admins” can add users). By making a simple request with parameters to the API, administrators can easily manage large amounts of users without having to use the Account options. For example, suppose your organization has a large CSV or JSON file containing various employee information (such as username, email, passwords, and so on). Instead of manually adding details of each employee with the CARTO Enterprise account options, the organization owner can use this API to program a script to request this information directly from this CSV or JSON file.
Tip: See this Use Case example for how to program a script to import users into a CARTO organization from a CSV or JSON file.
Currently, you can add, delete, show, or update organization users with the Enterprise User Management API.
Create Users with the Enterprise API
To create new users, make a POST
request with the following parameters. The web service endpoint URL for running scripts with the POST command is:
<org>.carto.com/u/<org_owner>/api/v2/organization/<org>/users
Arguments
Name | Description | Required |
---|---|---|
username | the username of the new organization user. | Required |
viewer | each user can be assigned write and read access (Builder) or read-only access (Viewer) to shared datasets and maps. | Optional Tip: If not specified, the new user will automatically have Builder (write and read access), viewer: false . To assign read-only access to a new user, apply viewer: true . |
org_admin | assign admin access to a Builder user by applying org_admin: true . |
Optional If not specified, the default is ‘false’ (no admin privileges). |
email of the new organization user. Only the organization owner can see this parameter. | Required | |
password | password of the new organization user. | Required Note: If the organization owner enabled the Auth settings Strong Passwords through the dashboard, then all organization users created through the API are required to create strong passwords for login. |
api_key | the organization owner API Key. Tip: The organization owner can copy their API Key from their Account settings. |
Required |
soft_geocoding_limit | determines the geocoding limit imposed for the organization user. If not specified, this is set to false by default and enables the user to exceed the geocoding limit. You can only use this option if you have it enabled. Contact support for more information. |
Optional |
quota_in_bytes | assigns the data usage quota to the organization user. If not specified, the default quota specified by the organization is applied. | Optional |
Returns
A success message representing the newly created user(s) (code 200).
Example
The following example request and return describes how to add new organization users with the Enterprise API.
Request
Returns
Update Users with the Enterprise API
To update existing organization users, make a PUT
request with the following parameters. The web service endpoint URL for running scripts with the PUT command is:
<org>.carto.com/u/<org_owner>/api/v2/organization/<org>/users/org-user
Note: Only Enterprise owners have access to run the update command.
Arguments
Name | Description | Required |
---|---|---|
new email for the modified user. | Optional | |
password | new password for the modified organization user. | Optional |
api_key | the organization owner API Key. Tip: The organization owner can copy their API Key from their Account settings. |
Required |
soft_geocoding_limit | determines the geocoding limit imposed for the organization user. If not specified, this is set to false by default and enables the user to exceed the geocoding limit. |
Optional |
quota_in_bytes | assigns the data usage quota to the organization user. If not specified, the default quota specified by the organization is applied. | Optional |
viewer | Updates the access role of an existing user. To assign write-access, apply viewer: false . To assign read-only access, apply viewer: true .Tip: If not specified, the user access role remains the same and is not updated. |
Optional |
org_admin | assign admin access to a Builder user by applying org_admin: true . |
Optional If not specified, the default is ‘false’ (no admin privileges). |
Returns
A success message representing the modified user(s) (code 200).
Example
The following example request and return describes how to modify existing organization users with the Enterprise API.
Request
Returns
Show Users with the Enterprise API
To display and show an organization user with the Enterprise API, make a GET
request with the following parameters. The web service endpoint URL for running scripts with the GET command is:
<org>.carto.com/u/<org_owner>/api/v2/organization/<org>/users/org-user
Note: Only Enterprise owners have access to run the show command.
Arguments
Name | Description | Required |
---|---|---|
api_key | the organization owner API Key. Tip: The organization owner can copy their API Key from their Account settings. |
Required |
Returns
A success message representing the displayed user(s) (code 200).
Example
The following example request and return describes how to show existing organization users with the Enterprise API.
Request
Returns
Delete Users with the Enterprise API
To delete existing organization users, make a DELETE
request with the following parameters. The web service endpoint URL for running scripts with the DELETE command is:
<org>.carto.com/u/<org_owner>/api/v2/organization/<org>/users/org-user
Arguments
Name | Description | Required |
---|---|---|
api_key | the organization owner API Key. Tip: The organization owner can copy their API Key from their Account settings. |
Required |
Returns
A success message confirming the organization user(s) (code 200) has been deleted.
Example
Configure multi-factor authentication with the Enterprise API
To configure multi-factor authentication for an existing organization user, make a POST request to this service endpoint URL:
<org>.carto.com/u/<org_owner>/api/v2/organization/<org>/users/org-user/mfa/<type>
Arguments
Name | Description | Required |
---|---|---|
type | The multi-factor authentication type to enable. The only supported type is totp |
Required |
api_key | the organization owner API Key. Tip: The organization owner can copy their API Key from their Account settings. |
Required |
Returns
A success message confirming the multi-factor authentication has been configured (code 201).
Example
Disable multi-factor authentication with the Enterprise API
To disable multi-factor authentication for an existing organization user, make a DELETE request to this service endpoint URL:
<org>.carto.com/u/<org_owner>/api/v2/organization/<org>/users/org-user/mfa/<type>
Arguments
Name | Description | Required |
---|---|---|
type | The multi-factor authentication type to enable. The only supported type is totp |
Required |
api_key | the organization owner API Key. Tip: The organization owner can copy their API Key from their Account settings. |
Required |
Returns
A success message confirming the multi-factor authentication has been disabled (code 204).
Example
Use Case: Importing Users into a CARTO Organization from a CSV or JSON file
This is an example of how a program can use the Enterprise Users Management API to create, update, or delete users from a CSV or a JSON file.
We use two python files: secrets.py
containing the owners credentials (name, API Key and org name) and manage_users.py
with the code to be run.
Additionally, include a CSV file with the users’ information:
Alternatively, you can use a JSON file containing the users’ information:
Here are some examples of program scripts: