Anaconda Cloud User and Token Management with API (Anaconda Pro/Business)#

Manually onboarding individual team members through the Anaconda Cloud graphical user interface (GUI) can be time consuming. For large teams, Anaconda recommends using API calls for a streamlined process.

The Anaconda Cloud API provides various calls to enable you to add users to an Anaconda Cloud organization and change their seat and token permissions. You must be an admin of an Anaconda Cloud organization with an active paid subscription to use these API calls.

You can use API interfaces, such as Insomnia, Postman, or FastAPI, to work with these API calls, or create a script to run through a list of users that need to be added to your organization.

Note

Import the provided Insomnia or Postman collections for a quickstart of the process. The Postman zip file also contains an environment template.

This documentation outlines the endpoints and request and response variables for each API call you might need during this process.

Authenticating to the API#

The Anaconda Cloud API uses OAuth2 standard authentication with an organization admin’s anaconda.cloud username and password.

Create organization app#

Creating organization apps allows the admin user to specify credentials for a specific machine or machines (like a build server or other machine for pipeline automation) and manage those machines in a similar capacity to a user. This organization app can then allow the other API calls to be made directly to the organization the machine user is a part of. If you’d like apps for different environments or machines, you can create multiple apps per organization. Once an organization app is created, use its credentials to add other users via the API with the calls described below.

API call#

POST /organizations/ORG_NAME/service-accounts

  • Replace ORG_NAME with the name of your organization, which can be found in your Anaconda Cloud organization’s URL after “anaconda.cloud/organizations/”.

Request

{
    "name":"<APP_NAME>"
}

Request example

{
     "name":"CompanyCloudOrg"
}

Response

{
    "name": "<APP_NAME>",
    "client_id": "<GUID>",
    "org_id": "<GUID>",
    "client_secret": "<SECRET_ID>"
}

Response example

{
    "name": "CompanyCloudOrg",
    "client_id": "1234abcd-1a2b-3c4d-5e6f-123456abcdef",
    "org_id": "abcd1234-1234-abcd-1a2b-3c4d5e6f7g8h",
    "client_secret": "1234567890abcdefghij_abcdefghij1234567_1a2b"
}

Variables#

name:

The name of your organization app.

client_id:

A unique client ID for your organization app.

org_id:

A unique organization ID for your organization app.

client_secret:

A unique client secret for your organization app.

Add user to organization#

This call adds users to a given organization.

API call#

POST /organizations/ORG_NAME/users

  • Replace ORG_NAME with the name of your organization, which can be found in your Anaconda Cloud organization’s URL after “anaconda.cloud/organizations/”.

Request

{
    "email":"<EMAIL_ADDRESS>"
}

Request example

{
    "email":"[email protected]"
}

Response

{
    "first_name": null,
    "last_name": null,
    "email": "<EMAIL_ADDRESS>",
    "id": "<GUID>"
}

Response example

{
    "first_name": null,
    "last_name": null,
    "email": "[email protected]",
    "id": "1a2b3c4d-1a2b-3c4d-5e6f-1a2b3c4d5f"
}

Variables#

email:

The email of the user you want to add.

first_name:

The user’s first name. This will return null via the API and can be updated by the user when they log in to Anaconda Cloud.

last_name:

The user’s last name. This will return null via the API and can be updated by the user when they log in to Anaconda Cloud.

id:

The unique ID of the added user.

Assign seat to user#

This call adds a seat to a given user for the subscription associated with the organization the user is in.

API call#

POST /organizations/ORG_NAME/users/ID/seats

  • Replace ORG_NAME with the name of your organization, which can be found in your Anaconda Cloud organization’s URL after “anaconda.cloud/organizations/”.

  • Replace ID with the ID of the user that you want to assign a seat. This ID will be returned by the Add user to organization API call.

Request and response

There’s no request or response information for this call. You will receive a 201 status code if the request is successful.

Assign token to user#

This call assigns a token to a given user. Tokens are a unique security key that enable users to access the subscription seat they have been assigned.

API call#

POST /organizations/ORG_NAME/users/ID/token

  • Replace ORG_NAME with the name of your organization, which can be found in your Anaconda Cloud organization’s URL after “anaconda.cloud/organizations/”.

  • Replace ID with the ID of the user that you want to assign a token. This ID will be returned by the Add user to organization API call.

Request

{
    "expires_at": "<DATETIME>"
}

Request example

{
    "expires_at": "2022-07-29T00:00:00+00:00"
}

Response

{
    "token": "<TOKEN>",
    "expires_at": null
}

Response example

{
    "token": "1a2b34567c8d9101112e13f14g151617h18i19202122i23j",
    "expires_at": null
}

Variables#

expires_at:

The datetime at which the token will expire.

token:

The token assigned to the given user ID.

Revoke token from user#

This call revokes a token from a given user ID. It should be used when a user no longer needs access to their software subscription and can be used as the first part in a user removal process.

API call#

DELETE /organizations/ORG_NAME/users/ID/token

  • Replace ORG_NAME with the name of your organization, which can be found in your Anaconda Cloud organization’s URL after “anaconda.cloud/organizations/”.

  • Replace ID with the ID of the user whose token you want to revoke. This ID will be returned by the Add user to organization API call.

Remove seat from user#

This call removes a subscription seat from a given user and can be used as the second part in a user removal process.

API call#

DELETE /organizations/ORG_NAME/users/ID/seats

  • Replace ORG_NAME with the name of your organization, which can be found in your Anaconda Cloud organization’s URL after “anaconda.cloud/organizations/”.

  • Replace ID with the ID of the user whose seat you want to remove. This ID will be returned by the Add user to organization API call.

Remove user from organization#

This call removes a given user from a given organization and can be used as the final part in a user removal process.

API call#

DELETE /organizations/ORG_NAME/users/ID

  • Replace ORG_NAME with the name of your organization, which can be found in your Anaconda Cloud organization’s URL after “anaconda.cloud/organizations/”.

  • Replace ID with the ID of the user that you want to remove from the organization. This ID will be returned by the Add user to organization API call.