> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Provisioning API (Classic)


{reading New reference now available}

This reference describes how to use the Provisioning API with our classic [backend SDKs](backend_sdks). You should use this reference only if you've already implemented Provisioning in your app using the classic backend SDKs, or if the language you need is not available via the new Provisioning SDKs. 

For a more modern experience with OpenAPI generated documentation and SDKs, take a look at our new [API reference](provisioning_api).

{/reading}

Accounts with provisioning API access can create and manage their **product environments**, **users** and **user groups** using the RESTful Provisioning API. 

Provisioning API access is available [upon request](https://cloudinary.com/contact?plan=enterprise) for accounts on an [Enterprise plan](https://cloudinary.com/pricing#pricing-enterprise).
[Cloudinary's backend SDKs](backend_sdks) wrap these REST APIs, handle authentication, and enable you to perform these methods using your preferred programming language or framework. This reference provides both SDK and REST/cURL syntax and examples for each endpoint method.
> **TIP**: If you just want to use your SSO for login and don’t need provisioning, you can set up SAML login in the [Account Security](https://console.cloudinary.com/app/settings/account-security) page of your Console Settings.

## Overview

By default, the API endpoint uses the following format:

`https://api.cloudinary.com/v1_1/provisioning/accounts/:account_id/:action`

For example, to get all product environments (sub_accounts) in the account with ID `16a8ff3b-736b-49a6-85c0-03b69d5a357b`:

```
GET https://api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/sub_accounts
```

The API uses **Basic Authentication** over HTTPS. Your Cloudinary **Account ID**, **Account API Key** and **Account API Secret** are used for the authentication. These ID's are located in the Cloudinary Console under **Settings > Account API Keys**. You can either pass these values individually or you can use an environment variable composed of those three values in the form: `CLOUDINARY_ACCOUNT_URL=account://<Account_API_KEY>:<ACCOUNT_API_SECRET>@<ACCOUNT_ID>`. As with all [configuration parameters](cloudinary_sdks#configuration_parameters), you can either set these values globally, or pass them with each call.

You can experiment with returning a list of users in your own Cloudinary account by replacing the `ACCOUNT_API_KEY`, `ACCOUNT_API_SECRET`, and `ACCOUNT_ID` in the cURL command below:

```
curl https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/<ACCOUNT_ID>/sub_accounts
```

> **NOTE**:
>
> **Account API keys** were previously referred to as **provisioning API keys**.

For most actions, request parameters are passed as JSON objects and the response is a JSON snippet. The response includes information about the action that was performed as well as any new relevant data. For example, the response from a request to get all product environments (sub_accounts):

```json
{
  "sub_accounts": [
    {
      "cloud_name": "product1",
      "name": "Product1 Application",
      "enabled": true,
      "id": "abcde1fghij2klmno3pqrst4uvwxy5z",
      "api_access_keys": [
        {
          "key": "123456789012345",
          "secret": "asdf1JKL2xyz3ABc4s3c5reT01DfaKe"
        }
      ],
      "created_at": "2019-03-15T11:44:48Z"
    },
    {
      "cloud_name": "product2",
      "name": "Product2 Application",
      "enabled": true,
      "id": "0aaaaa1bbbbb2ccccc3ddddd4eeeee5f",
      "api_access_keys": [
        {
          "key": "543210987654321",
          "secret": "T415i5mYs3cr3TkeYN0tR3a77y0o0"
        }
      ],
      "created_at": "2019-04-27T08:00:16Z"
    }
  ]
}
```

The following sections provide additional details on working with the Provisioning API:

* [Using SDKs with the Provisioning API](#using_sdks_with_the_provisioning_api)
* [Error handling](#error_handling)

### Using SDKs with the Provisioning API

In addition to the base REST API, our client libraries provide an easy to use wrapper for the Provisioning API. Request building and authentication are done automatically, and the JSON response is parsed and returned.

For example, the following Java SDK method gets a list of enabled product environments that have a name starting with 'prod':

```java
account.getSubAccounts(true, null, "prod");
```

To access the Provisioning API via and SDK, configure your **Account ID**, **Provisioning Key** and **Provisioning Secret**, located in the Cloudinary Console under **Settings > Account > Provisioning API Access**. You can: 

* Use the `CLOUDINARY_ACCOUNT_URL` environment variable, substituting the placeholders with your credentials:
  
```
export CLOUDINARY_ACCOUNT_URL=account://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@<ACCOUNT_ID>
```

* Globally configure the Provisioning API using **Account ID**, **Provisioning Key** and **Provisioning Secret** defined separately:
  
```multi
|csharp
using CloudinaryDotNet.Provisioning;

new AccountProvisioning("<AccountId>", "<ProvisioningApiKey>", <"ProvisioningApiSecret">);

|ruby
require 'cloudinary'
require 'cloudinary/account_api'

Cloudinary.account_config do |config|
  config.provisioning_api_key = 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
  config.provisioning_api_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
  config.account_id = 'xxxxxxxxxxx'
end

|java 
cloudinary = new Cloudinary(ObjectUtils.asMap(
                "account_id", "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                "provisioning_api_key", "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                "provisioning_api_secret", "xxxxxxxxxxx"));        
AccountConfiguration configuration = new AccountConfiguration("accountId", "provisioningApiKey", "provisioningApiSecret");
Account account = new Account(configuration, cloudinary);

|nodejs
const cloudinary = require('cloudinary').v2;

cloudinary.config({ 
  account_id: 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 
  provisioning_api_key: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx', 
  provisioning_api_secret: 'xxxxxxxxxxx'
});

|php_2
use Cloudinary\Api\Provisioning\AccountApi;
use Cloudinary\Configuration\Provisioning\ProvisioningConfiguration;

$provConf = new ProvisioningConfiguration([
    'provisioning_account' => [
        'account_id' => 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
        'provisioning_api_key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
        'provisioning_api_secret' => 'xxxxxxxxxxx'],
]);

$account = new AccountApi($provConf);

|python
import cloudinary
import cloudinary.provisioning

# config
cloudinary.provisioning.account_config(
  account_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  provisioning_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  provisioning_api_secret = "xxxxxxxxxxx"
)
```

> **INFO**: When writing your own applications, follow your organization's policy on storing secrets and don't expose your Provisioning secret.

### Error handling

The API returns the status of requests using the HTTP status codes:

* **200** - OK. Successful.
* **400** - Bad request.
* **401** - Authorization required.
* **403** - Not allowed.
* **404** - Not found.
* **409** - Already exists.
* **420** - Max usage rate exceeded.

The API wrapping of Cloudinary's client libraries report errors by raising applicative exception.
In addition, a JSON response with an informative message is returned. For example:

```json
{ "error": { "message": "User not found" } }
```

## access_keys

Manage the access keys, which include an API key and secret pair, for your product environment (sub-account):

Method | Description
---|---
GET<code class="code-method">/accounts/:account\_id/sub\_accounts/:sub\_account\_id/access\_keys | [Get access keys](#get_access_keys)
POST<code class="code-method">/accounts/:account\_id/sub\_accounts/:sub\_account\_id/access\_keys | [Generate an access key](#generate_an_access_key)
PUT<code class="code-method">/accounts/:account\_id/sub\_accounts/:sub\_account\_id/access\_keys/:key | [Update an access key](#update_an_access_key)
PUT<code class="code-method">/accounts/:account\_id/sub\_accounts/:sub\_account\_id/access\_keys/:key | [Update an access key](#update_an_access_key)
DELETE<code class="code-method">/accounts/:account\_id/sub\_accounts/:sub\_account\_id/access\_keys/:key | [Delete an access key by API key](#delete_an_access_key_by_api_key)
DELETE<code class="code-method">/accounts/:account\_id/sub\_accounts/:sub\_account\_id/access\_keys?name= | [Delete an access key by name](#delete_an_access_key_by_name)

---

### Get access keys

Return an array of all access keys for a particular product environment.

#### Syntax
`GET /accounts/:account_id/sub_accounts/:sub_account_id/access_keys`

```multi
|csharp
account.ListAccessKeys(ListAccessKeysParams parameters);

|ruby
Cloudinary::AccountApi.access_keys(sub_account_id, options = {})

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->accessKeys(string $subAccountId, $options = []);

|java
account.getAccessKeys(String subAccountID, Map options);

|python
cloudinary.provisioning.account.access_keys(sub_account_id, page_size=0, page=None, sort_by=None, sort_order=None, **options)

|cli
cld provisioning access_keys [$sub_account_id] [$page_size] [$page] [$sort_by] [$sort_order] [$options]

|nodejs
cloudinary.provisioning.account.access_keys(string sub_account_id, object options);
```

#### Optional parameters
Parameter | Type | Description
---|---|---
page_size  | Integer | How many entries to display on each page.
page | Integer | Which page to return (maximum pages: 100). **Default**: All pages are returned.
sort_by | String | Which response parameter to sort by. **Possible values**: `api_key`, `created_at`, `name`, `enabled`.
sort_order | String | Control the order of returned keys. **Possible values**: `desc` (default), `asc`. 
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
Retrieve the access keys in your product environment, sorted by creation date in ascending order (oldest keys first).

```multi
|csharp
var listAccessKeysParams = new ListAccessKeysParams{
  SortBy = "created_at",
  SortOrder = "asc" };
account.ListAccessKeys(listAccessKeysParams);

|ruby
Cloudinary::AccountApi.access_keys("aksdvnklsR1234890", :sort_by => "created_at", :sort_order => "asc")

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->accessKeys("aksdvnklsR1234890", ["sort_by" => "created_at", "sort_order" => "asc"]);

|python
cloudinary.provisioning.account.access_keys('aksdvnklsR1234890', sort_by='created_at', sort_order='asc')

|java
account.getAccessKeys("aksdvnklsR1234890", ObjectUtils.asMap("created_at", "sort_order"));

|curl
curl \
  -H "Content-Type: application/json" \
  
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/<ACCOUNT_ID>/sub_accounts/<SUB_ACCOUNT_ID>/access_keys?sort_by=created_at&sort_order=asc

|cli
cld provisioning access_keys "aksdvnklsR1234890" sort_by="created_at" sort_order="asc"

|nodejs
cloudinary.provisioning.account.access_keys("aksdvnklsR1234890")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });
```

#### Sample response
```json
{
  "access_keys": [
    {
      "name": "first_key",
      "api_key": "814814814814814",
      "api_secret": "QcsQcsQcsQcsQcsQcsQcsQcsQcs",
      "created_at": "2022-03-15T11:44:48Z",
      "updated_at": "2023-08-10T09:23:45Z",
      "enabled": true
    },
  ...
  ]
  "total": 10
}
```

---

### Generate an access key

Generate a new access key.

#### Syntax
`POST /accounts/:account_id/sub_accounts/:sub_account_id/access_keys`

```multi
|csharp
account.GenerateAccessKey(GenerateAccessKeyParams parameters);

|ruby
Cloudinary::AccountApi.generate_access_key(sub_account_id, options = {})

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->generateAccessKey(string $subAccountId, array $options = []);

|python
cloudinary.provisioning.account.generate_access_key(sub_account_id, name=None, enabled=None, **options)

|java
account.createAccessKey(String subAccountID, String name, Boolean enabled, Map options);

|cli
cld provisioning generate_access_key [$sub_account_id] [$name] [$enabled] [$options]

|nodejs
cloudinary.provisioning.account.generate_access_key(string sub_account_id, string name, object options);
```

#### Optional parameters
Parameter | Type | Description
---|---|---
name | String |  The name of the new access key. 
enabled | Boolean | Whether the new access key is enabled or disabled.
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
Generate an access key in the sub account with ID `aksdvnklsR1234890` called `main_key`.

```multi
|csharp
var generateAccessKeyParams = new GenerateAccessKeyParams{
    Name = "main_key"};
account.GenerateAccessKey(generateAccessKeyParams);

|ruby
Cloudinary::AccountApi.generate_access_key("aksdvnklsR1234890", "main_key", true)

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->generateAccessKey('aksdvnklsR1234890', [
    'enabled' => true,
    'name' => 'main_key'
]);

|python
cloudinary.provisioning.account.generate_access_key("aksdvnklsR1234890", name='main_key')

|curl \
  -H "Content-Type: application/json" \
  -d '{ 
    "name": "main_key"
    }' \
  -X POST \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/<ACCOUNT_ID>/sub_accounts/<SUB_ACCOUNT_ID>/access_keys

|java
account.createAccessKey("aksdvnklsR1234890", "main_key", null, ObjectUtils.emptyMap());

|cli
cld provisioning generate_access_key "aksdvnklsR1234890" name="main_key"

|nodejs
cloudinary.provisioning.account.generate_access_key("aksdvnklsR1234890", "main_key")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });
```

#### Sample response
```json
{
  "name": "main_key",
  "api_key": "418418418418418",
  "api_secret": "scQscQscQscQscQscQscQscQscQ",
  "created_at": "2023-09-10T09:23:45Z",
  "updated_at": "2023-09-10T09:23:45Z",
  "enabled": true
}
```

---

### Update an access key

Update the name and/or status of an existing access key.

> **NOTE**: If an access key is dedicated for signing webhook notifications, it can't be disabled. You'll need to replace it with a different dedicated access key for webhook signing via the [update](#update_an_access_key) method before deletion.

#### Syntax
`PUT /accounts/:account_id/sub_accounts/:sub_account_id/access_keys/:key`

```multi
|csharp
account.UpdateAccessKey(UpdateAccessKeyParams parameters);

|ruby
Cloudinary::AccountApi.update_access_key(sub_account_id, api_key, options = {})

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->updateAccessKey(string $subAccountId, string $apiKey, $options = []);

|python
cloudinary.provisioning.account.update_access_key(sub_account_id, api_key, name=None, enabled=None, dedicated_for=None, **options)

|cli
cld provisioning update_access_key [$sub_account_id] [$name] [$enabled] [$dedicated_for] [$options]

|java
account.updateAccessKey(String subAccountID, String accessKey, String name, Boolean enabled, Map options);

|nodejs
cloudinary.provisioning.account.update_access_key(string sub_account_id, string api_key, boolean enabled, object options);
```

#### Optional parameters
Parameter | Type | Description
---|---|---
name | String |  The updated name of the access key. 
enabled | Boolean | Enable or disable the access key.
dedicated_for | String | Designates the access key for a specific purpose while allowing it to be used for other purposes, as well. This action replaces any previously assigned key. **Possible values**: `webhooks`
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
Disable and rename the access key in the sub account with ID `aksdvnklsR1234890`, whose API key is `418418418418418`, to `secondary_key`.

```multi
|csharp
var updateAccessKeyParams = new UpdateAccessKeyParams("418418418418418"){
    Name = "secondary_key",
    Enabled = false };
account.UpdateSubAccount(updateSubAccountParams);

|ruby
Cloudinary::AccountApi.update_access_key("aksdvnklsR1234890", "418418418418418", :name => "secondary_key", :enabled => true)

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->updateAccessKey('aksdvnklsR1234890', '418418418418418', [
    'enabled' => false,
    'name' => 'secondary_key'
]);

|python
cloudinary.provisioning.account.update_access_key('aksdvnklsR1234890', '418418418418418', enabled=False, name='secondary_key')

|curl \
  -H "Content-Type: application/json" \
  -d '{ 
    "name": "secondary_key", 
    "enabled": false
      }' \
  -X PUT \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/<ACCOUNT_ID>/sub_accounts/<SUB_ACCOUNT_ID>/access_keys/418418418418418

|cli
cld provisioning update_access_key "aksdvnklsR1234890" "418418418418418" enabled=false name="secondary_key"

|java
account.updateAccessKey("aksdvnklsR1234890", "418418418418418", "secondary_key", false, ObjectUtils.emptyMap());

|nodejs
cloudinary.provisioning.account.update_access_key("aksdvnklsR1234890", "418418418418418", "secondary_key", false)
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });
```

#### Sample response
```json
{
  "name": "secondary_key",
  "api_key": "418418418418418",
  "api_secret": "scQscQscQscQscQscQscQscQscQ",
  "created_at": "2023-09-10T09:23:45Z",
  "updated_at": "2023-09-10T09:45:57Z",
  "enabled": false
}
```
---

### Delete an access key by API key

Delete an access key with a specified API key from your product environment. You'll no longer be able to access your product environment using the deleted key. This action can't be undone.

> **NOTE**:
>
> An access keys can't be deleted if:

> * It's the only active one in the product environment.

> * It's dedicated for signing webhook notifications. You'll need to replace it with a different dedicated access key for webhook signing via the [update](#update_an_access_key) method before deletion.

#### Syntax
`DELETE /accounts/:account_id/sub_accounts/:sub_account_id/access_keys/:key`

```multi
|java
account.deleteAccessKey(String subAccountID, String accessKey, Map options);

|nodejs
cloudinary.provisioning.account.delete_access_key(string sub_account_id, string api_key, object options);
```

#### Example
Delete the access key with API key `418418418418418` in the sub account with ID `aksdvnklsR1234890`:

```multi
|curl \
  -H "Content-Type: application/json" \
  -X DELETE \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/<ACCOUNT_ID>/sub_accounts/aksdvnklsR1234890/access_keys/418418418418418

|java
account.deleteAccessKey("aksdvnklsR1234890", "418418418418418", ObjectUtils.emptyMap());

|nodejs
cloudinary.provisioning.account.delete_access_key("aksdvnklsR1234890", "418418418418418")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });
```

#### Sample response
```json
{
  "message": "ok"           
}
```

---

### Delete an access key by name

Delete an access key with a specified name from your product environment. You'll no longer be able to access your product environment using the deleted key. This action can't be undone.

> **NOTE**:
>
> An access keys can't be deleted if:

> * It's the only active one in the product environment.

> * It's dedicated for signing webhook notifications. You'll need to replace it with a different dedicated access key for webhook signing via the [update](#update_an_access_key) method before deletion.

#### Syntax
```multi
|nodejs
cloudinary.provisioning.account.delete_access_key(string sub_account_id, string name, object options);


```

#### Example
Delete the access key named `secondary_key`:

```multi
|curl \
  -H "Content-Type: application/json" \
  -X DELETE \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/<ACCOUNT_ID>/sub_accounts/<SUB_ACCOUNT_ID>/access_keys?name=secondary_key

|nodejs
cloudinary.provisioning.account.delete_access_key("aksdvnklsR1234890", "secondary_key")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });
```

#### Sample response
```json
{
  "message": "ok"           
}
```

---

## sub_accounts (product environments)

> **NOTE**: 'Product environments' in Cloudinary were previously known as 'sub-accounts'. The Provisioning API endpoints have not changed, and thus all Provisioning API operations relating to product environments are still performed using the `sub_accounts` endpoints, parameters, response keys, etc.

Manage the product environments (sub-accounts) of your main account:

Method | Description
---|---
GET<code class="code-method">/accounts/:account\_id/sub\_accounts | [Get product environments](#get_product_environments)
GET<code class="code-method">/accounts/:account\_id/sub\_accounts/:sub\_account\_id | [Get product environment](#get_product_environment)
POST<code class="code-method">/accounts/:account\_id/sub\_accounts | [Create product environment](#create_product_environment)
PUT<code class="code-method">/accounts/:account\_id/sub\_accounts/:sub\_account\_id | [Update product environment](#update_product_environment) 
DELETE<code class="code-method">/accounts/:account\_id/sub\_accounts/:sub\_account\_id | [Delete product environment](#delete_product_environment)

---

### Get product environments

Return an array of all product environments, or if conditions are specified, return the relevant product environments.

#### Syntax
`GET /accounts/:account_id/sub_accounts`

```multi
|csharp
account.SubAccounts(ListSubAccountsParams parameters);

|ruby
Cloudinary::AccountApi.sub_accounts(enabled = nil, ids = [], prefix = nil, options = {})

|java 
account.subAccounts(Boolean enabled, List<String> ids, String prefix, Map options); 

|nodejs
cloudinary.provisioning.account.sub_accounts(boolean enabled, string[] ids, string prefix, object options);

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->subAccounts(bool $enabled = null, array $ids = [], string $prefix = null);

|python
cloudinary.provisioning.account.sub_accounts(enabled=None, ids=None, prefix=None, **options)

|cli
cld provisioning sub_accounts [$enabled] [$ids] [$prefix] [$options]

```

#### Optional parameters
Parameter | Type | Description
---|---|---
enabled  | Boolean | Whether to only return enabled product environments (true) or disabled product environments (false). **Default**: all product environments are returned (both enabled and disabled).
ids | Array of Strings | A list (SDKs wrap as an array) of up to 100 product environment IDs. When provided, other parameters are ignored.
prefix | String | Returns accounts where the name begins with the specified case-insensitive string.
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
Return all enabled product environments with a name that begins with 'product':

```multi
|csharp
var listSubAccountsParams = new ListSubAccountsParams{
  Enabled = true,
  Prefix = "product" };
account.SubAccounts(listSubAccountsParams);

|ruby
Cloudinary::AccountApi.sub_accounts(true, [], "product")

|java 
account.subAccounts(true, null, "product");

|nodejs
cloudinary.provisioning.account.sub_accounts(true, null, "product")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->subAccounts(true, [], "product");

|python
cloudinary.provisioning.account.sub_accounts(True, prefix = "product")

|curl
curl \
  -H "Content-Type: application/json" \
  -d '{
        "enabled": "true",
        "prefix": "product"
      }' \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/sub_accounts

|cli
cld provisioning sub_accounts enabled=true prefix="product"
```

#### Sample response
```json
{
  "sub_accounts": [
    {
      "cloud_name": "product2",
      "name": "Product2 Application",
      "enabled": true,
      "id": "0aaaaa1bbbbb2ccccc3ddddd4eeeee5f",
      "api_access_keys": [
        {
          "key": "543210987654321",
          "secret": "T415i5mYs3cr3TkeYN0tR3a77y0o0"
        }
      ],
      "created_at": "2016-03-15T11:44:48Z"
    },
    {
      "cloud_name": "product1",
      "name": "Product1 Application",
      "enabled": true,
      "id": "abcde1fghij2klmno3pqrst4uvwxy5z",
      "api_access_keys": [
        {
          "key": "123456789012345",
          "secret": "asdf1JKL2xyz3ABc4s3c5reT01DfaKe"
        }
        ],
        "created_at": "2016-09-27T08:00:16Z"
    }
  ]
}
```

---

### Get product environment

Return the specified product environment.

#### Syntax
`GET /accounts/:account_id/sub_accounts/:sub_account_id`

```multi
|csharp
account.SubAccount(string subAccountId);

|ruby
Cloudinary::AccountApi.sub_account(sub_account_id, options = {})


|java 
account.subAccount(String subAccountID, Map options); 

|nodejs
cloudinary.provisioning.account.sub_account(string sub_account_id, object options);

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->subAccount(string $subAccountId);

|python
cloudinary.provisioning.account.sub_account(sub_account_id, **options)

|cli
cld provisioning sub_account $sub_account_id [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
sub\_account\_id  | String | The ID of the product environment to get.

#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
Return the product environment with the id of '7f08f1f1fc910bf1f25274aef11d27':

```multi
|csharp
account.SubAccount("7f08f1f1fc910bf1f25274aef11d27");

|ruby
Cloudinary::AccountApi.sub_account("7f08f1f1fc910bf1f25274aef11d27")

|java 
account.subAccount("7f08f1f1fc910bf1f25274aef11d27");

|nodejs
cloudinary.provisioning.account.sub_account("7f08f1f1fc910bf1f25274aef11d27")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->subAccount("7f08f1f1fc910bf1f25274aef11d27");

|python
cloudinary.provisioning.account.sub_account("7f08f1f1fc910bf1f25274aef11d27")

|curl
curl \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/sub_accounts/7f08f1f1fc910bf1f25274aef11d27

|cli
cld provisioning sub_account "7f08f1f1fc910bf1f25274aef11d27"
```

#### Sample response
```json
{
  "cloud_name": "product1",
  "name": "Product1 Application",
  "enabled": true,
  "id": "7f08f1f1fc910bf1f25274aef11d27",
  "api_access_keys": [
    {
      "key": "123456789012345",
      "secret": "asdf1JKL2xyz3ABc4s3c5reT01DfaKe"
    }
  ],
  "created_at": "2016-09-27T08:00:16Z"
}
```

---

### Create product environment

Create a new product environment. Any users that have access to all product environments will also automatically have access to the new product environment.

#### Syntax
`POST /accounts/:account_id/sub_accounts`

```multi
|csharp
account.CreateSubAccount(CreateSubAccountParams parameters);

|ruby
Cloudinary::AccountApi.create_sub_account(name, cloud_name = nil, custom_attributes = {}, base_account = nil, options = {})

|java 
account.createSubAccount(String name, String cloudName, Map customAttributes, String baseAccount, Map options);

|nodejs
cloudinary.provisioning.account.create_sub_account(string name, string cloud_name, object custom_attributes, string base_account, object options); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->createSubAccount(string $name, string $cloudName = null, array $customAttributes = null, bool $enabled = null, string $baseAccount = null);

|python
cloudinary.provisioning.account.create_sub_account(name, cloud_name=None, custom_attributes=None, base_account=None, **options)

|cli
cld provisioning create_sub_account $name [$cloud_name] [$custom_attributes] [$base_account] [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
name  | String | The display name as shown in the Cloudinary Console.

#### Optional parameters
Parameter | Type | Description
---|---|---
cloud\_name  | String | A case-insensitive cloud name comprised of 2-128 alphanumeric and hyphen characters, starting with a letter. Cloud names must be unique across all Cloudinary accounts.**Default**: a unique string automatically generated by Cloudinary.
base\_sub\_account\_id | String |  The ID of another product environment, from which to copy all of the following settings: Size limits, Timed limits, and Flags. The parameter is called `base_account` in some SDKs.
folder_mode | String | Sets the [folder mode](folder_modes) of the new product environment. **Possible values**: `dynamic`, `fixed` **Default**: `dynamic`
custom\_attributes | Object | Any custom attributes you want to associate with the product environment, as a map/hash of key/value pairs.
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
Create a new product environment called 'demo account':

```multi
|csharp
var createSubAccountParams = new CreateSubAccountParams("demo account");
account.CreateSubAccount(createSubAccountParams);

|ruby
Cloudinary::AccountApi.create_sub_account("demo account")

|java 
account.createSubAccount("demo account", null, ObjectUtils.emptyMap(), null);

|nodejs
cloudinary.provisioning.account.create_sub_account("demo account")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->createSubAccount("demo account", null, null, false, null);

|python
cloudinary.provisioning.account.create_sub_account("demo account")

|curl
curl \
  -H "Content-Type: application/json" \
  -d '{
        "name": "demo account"
      }' \
  -X POST \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/sub_accounts

|cli
cld provisioning create_sub_account "demo account"

```

#### Sample response
```json
{
  "cloud_name": "product3",
  "name": "Product3 Application",
  "enabled": false,
  "id": "555asdf0000zxcvb3456qwerty",
  "api_access_keys": [
    {
      "key": "135792468054321",
      "secret": "w4aTi5Y0u6k3YN0773lL1nGyUt0Da8"
    }
  ],
  "created_at": "2016-09-27T11:15:35Z"
}
```

---

### Update product environment

Update the specified details of the product environment.

#### Syntax
`PUT /accounts/:account_id/sub_accounts/:sub_account_id`

```multi
|csharp
account.UpdateSubAccount(UpdateSubAccountParams parameters);

|ruby
Cloudinary::AccountApi.update_sub_account(sub_account_id, name = nil, cloud_name = nil, custom_attributes = nil, enabled = nil, options = {})

|java 
account.updateSubAccount(String subAccountId, String name, String cloudName, Map customAttributes, Boolean enabled, Map options);

|nodejs
cloudinary.provisioning.account.update_sub_account(string sub_account_id, string name, string cloud_name, object custom_attributes, boolean enabled, object options);

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->updateSubAccount(string $subAccountId, string $name = null, string $cloudName = null, array $customAttributes = null, bool $enabled = null);

|python
cloudinary.provisioning.account.update_sub_account(sub_account_id, name=None, cloud_name=None, custom_attributes=None, enabled=None, **options)

|cli
cld provisioning update_sub_account $sub_account_id [$name] [$cloud_name] [$custom_attributes] [$enabled] [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
sub\_account\_id  | String | The ID of the product environment to update.

#### Optional parameters
Parameter | Type | Description
---|---|---
name  | String | The display name as shown in the Cloudinary Console.
cloud\_name  | String | A case-insensitive cloud name comprised of 2-128 alphanumeric and hyphen characters, starting with a letter. Cloud names must be unique across all Cloudinary accounts.**Note**: You can only change a cloud name (without special handling from customer support) for product environments with fewer than 1000 assets.
custom\_attributes | Object | Any custom attributes you want to associate with the product environment, as a map/hash of key/value pairs.
enabled | Boolean | Whether the product environment is enabled. **Default**: `true`
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
To disable the product environment with id '7f08f1f1fc910bf1f25274aef11d27':

```multi
|csharp
var updateSubAccountParams = new UpdateSubAccountParams("7f08f1f1fc910bf1f25274aef11d27"){
    Enabled = false };
account.UpdateSubAccount(updateSubAccountParams)

|ruby
Cloudinary::AccountApi.update_sub_account("7f08f1f1fc910bf1f25274aef11d27", nil, nil, nil, false)

|java 
account.updateSubAccount("7f08f1f1fc910bf1f25274aef11d27", null, null, {ObjectUtils.emptyMap()}, false);

|nodejs
cloudinary.provisioning.account.update_sub_account("7f08f1f1fc910bf1f25274aef11d27", null, null, {}, false)
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); }); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->updateSubAccount("7f08f1f1fc910bf1f25274aef11d27", null, null, null, false);

|python
cloudinary.provisioning.account.update_sub_account("7f08f1f1fc910bf1f25274aef11d27", enabled = False)

|curl
curl \
  -H "Content-Type: application/json" \
  -d '{
        "enabled": "false"
      }' \
  -X PUT \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/sub_accounts/7f08f1f1fc910bf1f25274aef11d27


|cli
cld provisioning update_sub_account "7f08f1f1fc910bf1f25274aef11d27" enabled=false
```

#### Sample response
```json
{
  "cloud_name": "product1",
  "name": "Product1 Application",
  "enabled": false,
  "id": "7f08f1f1fc910bf1f25274aef11d27",
  "api_access_keys": [
    {
      "key": "123456789012345",
      "secret": "asdf1JKL2xyz3ABc4s3c5reT01DfaKe"
    }
  ],
  "created_at": "2016-09-27T08:00:16Z"
}
```

---

### Delete product environment

Delete the specified product environment. Supported only for accounts with fewer than 1000 assets.

#### Syntax
`DELETE /accounts/:account_id/sub_accounts/:sub_account_id`

```multi
|csharp
account.DeleteSubAccount(string subAccountId);

|ruby
Cloudinary::AccountApi.delete_sub_account(sub_account_id, options = {})

|java 
account.deleteSubAccount(String subAccountID, Map options); 

|nodejs
cloudinary.provisioning.account.delete_sub_account(string sub_account_id, object options); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->deleteSubAccount(string $subAccountId);

|python
cloudinary.provisioning.account.delete_sub_account(sub_account_id, **options)

|cli
cld provisioning delete_sub_account $sub_account_id [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
sub\_account\_id  | String | The ID of the product environment to delete.

#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
To delete the product environment with id '7f08f1f1fc910bf1f25274aef11d27':

```multi
|csharp
account.DeleteSubAccount("7f08f1f1fc910bf1f25274aef11d27");

|ruby
Cloudinary::AccountApi.delete_sub_account("7f08f1f1fc910bf1f25274aef11d27")

|java 
account.deleteSubAccount("7f08f1f1fc910bf1f25274aef11d27");

|nodejs
cloudinary.provisioning.account.delete_sub_account("7f08f1f1fc910bf1f25274aef11d27")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->deleteSubAccount("7f08f1f1fc910bf1f25274aef11d27");

|python
cloudinary.provisioning.account.delete_sub_account("7f08f1f1fc910bf1f25274aef11d27")

|curl
curl \
  -X DELETE \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/sub_accounts/7f08f1f1fc910bf1f25274aef11d27

|cli
cld provisioning delete_sub_account "7f08f1f1fc910bf1f25274aef11d27"
```

#### Sample response
```json
{
  "message": "ok"
}
```

## users 

Manage the users for your account:

Method | Description
---|---
GET<code class="code-method">/accounts/:account\_id/users | [Get users](#get_users)
GET<code class="code-method">/accounts/:account\_id/users/:user\_id | [Get user](#get_user)
POST<code class="code-method">/accounts/:account\_id/users | [Create user](#create_user)
PUT<code class="code-method">/accounts/:account\_id/users/:user\_id | [Update user](#update_user) 
DELETE<code class="code-method">/accounts/:account\_id/users/:user\_id | [Delete user](#delete_user)

---

### Get users

Returns an array of all users in the account, or if conditions are specified, returns the relevant users.

#### Syntax
`GET /accounts/:account_id/users`

```multi
|csharp
account.Users(ListUsersParams parameters);

|ruby
Cloudinary::AccountApi.users(pending = nil, user_ids = [], prefix = nil, sub_account_id = nil, options = {})

|java 
account.users(Boolean pending, List<String> ids, String prefix, String subAccountId, Map options); 

|nodejs
cloudinary.provisioning.account.users(boolean pending, string[] ids, string prefix, string sub_account_id, object options);

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->users(bool $pending = null, array $userIds = [], string $prefix = null, string $subAccountId = null);

|python
cloudinary.provisioning.account.users(user_ids=None, sub_account_id=None, pending=None, prefix=None, **options)

|cli
cld provisioning users [$user_ids] [$sub_account_id] [$pending] [$prefix] [$options]
```

#### Optional parameters
Parameter | Type | Description
---|---|---
pending  | Boolean | Whether to only return pending users. **Default**: `false` (all users)
ids | Array of Strings | A list (SDKs wrap as an array) of up to 100 user IDs. When provided, other parameters are ignored.
prefix | String | Returns users where the name begins with the specified case-insensitive string.
sub\_account\_id | String | Only returns users who have access to the specified account.
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).
last_login | Boolean | Specifies a date range for last login.
from | String | All last logins after this date, given in the format: yyyy-mm-dd
to | String | All last logins before this date, given in the format: yyyy-mm-dd
union_type | String | Whether to return users who last logged in within the specified date range (`include`), or those who didn't last log in within the range (`exclude`). **Possible values**: `include`, `exclude` **Default**: `include`

#### Example
Return all users with a name that begins with 'john':

```multi
|csharp
var listUsersParams = new ListUsersParams{
  Prefix = "john" };
account.Users(listUsersParams);

|ruby
Cloudinary::AccountApi.users(nil, [], "john")

|java 
account.users(null, null, "john", null);

|nodejs
cloudinary.provisioning.account.users(null, null, "john")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->users(null, [], "john", null);

|python
cloudinary.provisioning.account.users(prefix = "john")

|curl
curl \
  -H "Content-Type: application/json" \
  -d '{
        "prefix": "john"
      }' \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/users

|cli
cld provisioning users prefix="john"
```

#### Sample response
```json
{
  "users": [
    {
      "id": "139147faa12ce11f22cfaffa84b307",
      "name": "john_smith",
      "role": "media_library_user",
      "email": "john_smith@example.com",
      "pending": true,
      "enabled": true,
      "created_at": "2020-01-13T05:16:06Z",
      "last_login": "2022-01-11T15:11:04Z",
      "all_sub_accounts": true
    },
    {
      "id": "28c84b2aa7924a5e64f949b5403981",
      "name": "john_jones",
      "role": "master_admin",
      "email": "john_jones@example.com",
      "pending": true,
      "enabled": true,
      "created_at": "2019-01-13T05:16:05Z",
      "last_login": "2021-11-12T15:11:02Z",
      "all_sub_accounts": true
    }
  ]
}
```

---

### Get user 

Return the user with the specified ID.

> **NOTE**: The `user_id` value is not displayed in the Cloudinary Console, but it is returned when [creating a user](#create_user). You can also retrieve it based on the user's name or email, using the [get users](#get_users) operation to return a user by prefix.

#### Syntax
`GET /accounts/:account_id/users/:user_id`

```multi
|csharp
account.User(string userId);

|ruby
Cloudinary::AccountApi.user(user_id, options = {})

|java 
account.user(String userID, Map options); 

|nodejs
cloudinary.provisioning.account.user(string user_id, object options);

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->user(string $userId);

|python
cloudinary.provisioning.account.user(user_id, **options)

|cli
cld provisioning user $user_id [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
user\_id  | String | The ID of the user to get.

#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
Return the user with id '7f08f1f1fc910bf1f25274aef11d27':

```multi
|csharp
account.User("7f08f1f1fc910bf1f25274aef11d27");

|ruby
Cloudinary::AccountApi.user("7f08f1f1fc910bf1f25274aef11d27")

|java 
account.user("7f08f1f1fc910bf1f25274aef11d27");

|nodejs
cloudinary.provisioning.account.user("7f08f1f1fc910bf1f25274aef11d27")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->user("7f08f1f1fc910bf1f25274aef11d27");

|python
cloudinary.provisioning.account.user("7f08f1f1fc910bf1f25274aef11d27")

|curl
curl \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/users/7f08f1f1fc910bf1f25274aef11d27

|cli
cld provisioning user "7f08f1f1fc910bf1f25274aef11d27"
```

#### Sample response
```json
{
  "id": "7f08f1f1fc910bf1f25274aef11d27",
  "name": "foobar",
  "role": "master_admin",
  "email": "email@domain.com",
  "pending": true,
  "enabled": true,
  "created_at": "2019-09-12T11:53:57Z",
  "last_login": "2022-01-11T15:11:04Z",
  "all_sub_accounts": false,
  "groups": [],
  "sub_account_ids": "555asdf0000zxcvb3456qwerty"
}
```

---

### Create user

Create a new, enabled user for the account with the status `pending`.

#### Syntax
`POST /accounts/:account_id/users`

```multi
|csharp
account.CreateUser(CreateUserParams parameters);

|ruby
Cloudinary::AccountApi.create_user(name, email, role, sub_account_ids = [], options = {})

|java 
account.createUser(String name, String email, String role, List<String> subAccountsIds, Map options); 

|nodejs
cloudinary.provisioning.account.create_user(string name, string email, string role, string[] sub_account_ids, object options); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->createUser(string $name, string $email, string $role, array $subAccountIds = []);

|python
cloudinary.provisioning.account.create_user(name, email, role, sub_account_ids=None, **options)

|cli
cld provisioning create_user $name $email $role [$sub_account_ids] [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
name  | String | The user's name.
email | String | A unique email address, which serves as the login name and notification address.
role | String | The role to assign. **Possible values**: `master_admin`, `admin`, `billing`, `technical_admin`, `reports`, `media_library_admin`, `media_library_user`

#### Optional parameters
Parameter | Type | Description
---|---|---
sub\_account\_ids  | Array of Strings |   A comma-separated list (SDKs wrap as an array) of product environment IDs that this user can access. **Note**: This parameter is ignored if the role is specified as `master_admin`. **Default**: all product environments. 
enabled | Boolean | Whether the user is enabled. **Default**: `true`
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
Create a new user named 'John', with an email address of 'john@example.com' and a role of 'technical_admin':

```multi
|csharp
var createUserParams = new CreateUserParams("John", "john@example.com", "technical_admin");
account.CreateUser(createUserParams);

|ruby
Cloudinary::AccountApi.create_user("John", "john@example.com", "technical_admin")

|java 
account.createUser("John", "john@example.com", "technical_admin", null);

|nodejs
cloudinary.provisioning.account.create_user("John", "john@example.com", "technical_admin")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->createUser("John", "john@example.com", "technical_admin", []);

|python
cloudinary.provisioning.account.create_user("John", "john@example.com", "technical_admin")

|curl
curl \
  -H "Content-Type: application/json" \
  -d '{
        "name": "John",
        "email": "john@example.com",
        "role": "technical_admin"
      }' \
  -X POST \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/users

|cli
cld provisioning create_user "John" "john@example.com" "technical_admin"

```

#### Sample response
```json
{
  "id": "0abed8dfcc039ea05e2a1d494fd442",
  "name": "John",
  "role": "technical_admin",
  "email": "john@example.com",
  "pending": true,
  "enabled": true,
  "created_at": "2020-09-03T13:33:25Z",
  "all_sub_accounts": true,
  "groups": []
}
```

---

### Update user

Update the details of a specified user.

#### Syntax
`PUT /accounts/:account_id/sub_accounts/:user_id`

```multi
|csharp
account.UpdateUser(UpdateUserParams parameters);

|ruby
Cloudinary::AccountApi.update_user(user_id, name = nil, email = nil, role = nil, sub_account_ids = nil, options = {})

|java 
account.updateUser(String userId, String name, String email, String role, List<String> subAccountsIds, Map options); 

|nodejs
cloudinary.provisioning.account.update_user(string user_id, string name, string email, string role, string[] sub_account_ids, object options);

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->updateUser(string $userId, string $name = null, string $email = null, string $role = null, array $subAccountIds = []);

|python
cloudinary.provisioning.account.update_user(user_id, name=None, email=None, role=None, sub_account_ids=None, **options)

|cli
cld provisioning update_user $user_id [$name] [$email] [$role] [$sub_account_ids] [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
user\_id  | String | The ID of the user to update.

#### Optional parameters
Parameter | Type | Description
---|---|---
name  | String | The user's name.
email | String | A unique email address, which serves as the login name and notification address.
role | String | The role to assign. **Possible values**: `master_admin`, `admin`, `billing`, `technical_admin`, `reports`, `media_library_admin`, `media_library_user`
sub\_account\_ids  | String |   A comma-separated list (SDKs wrap as an array) of product environment IDs that this user can access. **Note**: This parameter is ignored if the role is specified as `master_admin`. 
enabled | Boolean | Whether the user is enabled.
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
To update the role of a user with id '7f08f1f1fc910bf1f25274aef11d27' to 'admin':

```multi
|csharp
var updateUserParams = new UpdateUserParams("7f08f1f1fc910bf1f25274aef11d27"){
  Role = "admin" };
account.UpdateUser(updateUserParams);

|ruby
Cloudinary::AccountApi.update_user("7f08f1f1fc910bf1f25274aef11d27", nil, nil, "admin")

|java 
account.updateUser("7f08f1f1fc910bf1f25274aef11d27", null, null, "admin", null);

|nodejs
cloudinary.provisioning.account.update_user("7f08f1f1fc910bf1f25274aef11d27", null, null, "admin")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->updateUser("7f08f1f1fc910bf1f25274aef11d27", null, null, "admin", []);

|python
cloudinary.provisioning.account.update_user("7f08f1f1fc910bf1f25274aef11d27", role = "admin")

|curl
curl \
  -H "Content-Type: application/json" \
  -d '{
        "role": "admin"
      }' \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/users/7f08f1f1fc910bf1f25274aef11d27

|cli
cld provisioning update_user "7f08f1f1fc910bf1f25274aef11d27" role="admin"

```

#### Sample response
```json
{
  "id": "7f08f1f1fc910bf1f25274aef11d27",
  "name": "John",
  "role": "admin",
  "email": "john@example.com",
  "pending": true,
  "enabled": true,
  "created_at": "2019-09-12T11:53:57Z",
  "all_sub_accounts": false,
  "groups": [],
  "sub_account_ids": "555asdf0000zxcvb3456qwerty"
}
```

---

### Delete user

Delete a user with the specified ID.

> **NOTE**: When you delete a user from your system, they are deactivated and no longer count against your account's user quota. Nevertheless, specific types of information related to that user are still displayed in the Media Library and Activity Reports where relevant, for example when a comment is identified as having been made by the deleted user. For more information, see [Deleting users](user_provisioning#deleting_users).

#### Syntax
`DELETE /accounts/:account_id/users/:user_id`

```multi
|csharp
account.DeleteUser(string userId);

|ruby
Cloudinary::AccountApi.delete_user(user_id, options = {})

|java 
account.deleteUser(String userId, Map options); 

|nodejs 
cloudinary.provisioning.account.delete_user(string user_id, object options); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->deleteUser(string $userId);

|python
cloudinary.provisioning.account.delete_user(user_id, **options)

|cli
cld provisioning delete_user $user_id [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
user\_id  | String | The ID of the user to delete.

#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
Delete the user with id '7f08f1f1fc910bf1f25274aef11d27':

```multi
|csharp
account.DeleteUser("7f08f1f1fc910bf1f25274aef11d27");

|ruby
Cloudinary::AccountApi.delete_user("7f08f1f1fc910bf1f25274aef11d27")

|java 
account.deleteUser("7f08f1f1fc910bf1f25274aef11d27");

|nodejs
cloudinary.provisioning.account.delete_user("7f08f1f1fc910bf1f25274aef11d27")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->deleteUser("7f08f1f1fc910bf1f25274aef11d27");

|python
cloudinary.provisioning.account.delete_user("7f08f1f1fc910bf1f25274aef11d27")

|curl
curl \
  -X DELETE \
  https://<PROVISIONING_KEY>:<PROVISIONING_SECRET>@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/users/7f08f1f1fc910bf1f25274aef11d27

|cli
cld provisioning delete_user "7f08f1f1fc910bf1f25274aef11d27"
```

#### Sample response
```json
{
  "message": "ok"
}
```

## user_groups

Manage the groups for the users in your account:

Method | Description
---|---
GET<code class="code-method">/accounts/:account\_id/user\_groups | [Get user groups](#get_users)
GET<code class="code-method">/accounts/:account\_id/user\_groups/:group\_id | [Get a user group](#get_user)
GET<code class="code-method">/accounts/:account\_id/user\_groups/:group\_id/users | [Get the users in a user group](#get_user_group_users)
POST<code class="code-method">/accounts/:account\_id/user\_groups | [Create a user group](#create_user_group)
POST<code class="code-method">/accounts/:account\_id/user\_groups/:group\_id/users/:user\_id | [Add a user to a group](#add_user_to_group)
PUT<code class="code-method">/accounts/:account\_id/user\_groups/:group\_id | [Update a user group](#update_user_group)
DELETE<code class="code-method">/accounts/:account\_id/user\_groups/:group\_id | [Delete a user group](#delete_user_group)
DELETE<code class="code-method">/accounts/:account\_id/user\_groups/:group\_id/users/:user\_id | [Remove a user from a group](#remove_user_from_group)

---

### Get user groups

Return an array of all user groups in the account.

#### Syntax
`GET /accounts/:account_id/user_groups`

```multi
|csharp
account.UserGroups();

```multi 
|ruby
Cloudinary::AccountApi.user_groups(options = {})

|java 
account.userGroups(Map options);

|nodejs
cloudinary.provisioning.account.user_groups(object options); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->userGroups();

|python
cloudinary.provisioning.account.user_groups(**options)

|cli
cld provisioning user_groups [$options]
```

#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).


#### Example
Return all user groups:

```multi
|csharp
account.UserGroups();

|ruby
Cloudinary::AccountApi.user_groups()

|java 
account.userGroups();

|nodejs
cloudinary.provisioning.account.user_groups()
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->userGroups();

|python
cloudinary.provisioning.account.user_groups()

|curl
curl https://:@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/user_groups

|cli
cld provisioning user_groups
```

#### Sample response
```json
{
  "user_groups": [
    {
      "id": "63a12e42952d888d9cabe7fb38888885",
      "name": "user_group_1"
    },
    {
      "id": "1cc3808888154263ac1e5eb2e5c52d61",
      "name": "user_group_1"
    }
  ]
}
```


---

### Get user group

Return a user group with the specified ID.


#### Syntax
`GET /accounts/:account_id/user_groups/:group_id`

```multi
|csharp
account.UserGroup(string groupId);

|ruby
Cloudinary::AccountApi.user_group(group_id, options = {})

|java 
account.userGroup(String groupId, Map options);

|nodejs
cloudinary.provisioning.account.user_group(string group_id, object options);

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->userGroup(string $groupId);

|python
cloudinary.provisioning.account.user_group(user_group_id, **options)

|cli
cld provisioning user_group $user_group_id [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
group\_id  | String | The ID of the user group to get.

#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).


#### Example
Return the user group with id '7f08f1f1fc910bf1f25274aef11d27':

```multi
|csharp
account.UserGroup("7f08f1f1fc910bf1f25274aef11d27");

|ruby
Cloudinary::AccountApi.user_group("7f08f1f1fc910bf1f25274aef11d27")

|java 
account.userGroup("7f08f1f1fc910bf1f25274aef11d27");

|nodejs
cloudinary.provisioning.account.user_group("7f08f1f1fc910bf1f25274aef11d27")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->userGroup("7f08f1f1fc910bf1f25274aef11d27");

|python
cloudinary.provisioning.account.user_group("7f08f1f1fc910bf1f25274aef11d27")

|curl
curl https://:@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/user_groups/7f08f1f1fc910bf1f25274aef11d27

|cli
cld provisioning user_group "7f08f1f1fc910bf1f25274aef11d27"
```


#### Sample response
```json
{
  "id": "7f08f1f1fc910bf1f25274aef11d27",
  "name": "user_group_1"
}
```


---

### Get user-group users

Return the users in the group with the specified ID.


#### Syntax
`GET /accounts/:account_id/user_groups/:group_id/users`

```multi
|csharp
account.UsersGroupUsers(string groupId);

|ruby
Cloudinary::AccountApi.user_group_users(group_id, options = {})

|java 
account.userGroupUsers(String groupId, Map options);

|nodejs 
cloudinary.provisioning.account.user_group_users(string group_id, object options); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->userGroupUsers(string $groupId);

|python
cloudinary.provisioning.account.user_group_users(user_group_id, **options)

|cli
cld provisioning user_group_users $user_group_id [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
group\_id  | String | The ID of the user group.

#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).


#### Example
Return the users in the group with id '7f08f1f1fc910bf1f25274aef11d27':

```multi
|csharp
account.UsersGroupUsers("7f08f1f1fc910bf1f25274aef11d27");

|ruby
Cloudinary::AccountApi.user_group_users("7f08f1f1fc910bf1f25274aef11d27")

|java 
account.userGroupUsers("7f08f1f1fc910bf1f25274aef11d27");

|nodejs
cloudinary.provisioning.account.user_group_users("7f08f1f1fc910bf1f25274aef11d27")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->userGroupUsers("7f08f1f1fc910bf1f25274aef11d27");

|python
cloudinary.provisioning.account.user_group_users("7f08f1f1fc910bf1f25274aef11d27")

|curl
curl https://:@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/user_groups/7f08f1f1fc910bf1f25274aef11d27/users

|cli
cld provisioning user_group_users "7f08f1f1fc910bf1f25274aef11d27"
```


#### Sample response
```json
{
  "users": [
    {
      "id": "7f08f1f1fc910bf1f25274aef11d27",
      "name": "John",
      "email": "john@example.com"
    }
  ]
}
```

---

### Create user group

Create a new user group for the account.


#### Syntax
`POST /accounts/:account_id/user_groups`

```multi
|csharp
account.CreateUserGroup(CreateUserGroupParams parameters);

|ruby
Cloudinary::AccountApi.create_user_group(name, options = {})

|java 
account.createUserGroup(String name, Map options);

|nodejs 
cloudinary.provisioning.account.create_user_group(string name, object options); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->createUserGroup(string $name);

|python
cloudinary.provisioning.account.create_user_group(name, **options)

|cli
cld provisioning create_user_group $name [$options]
```


#### Required parameters
Parameter | Type | Description
---|---|---
name  | String | The name for the user group.


#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).


#### Example
Create a new user group named 'Designers':

```multi
|csharp
account.CreateUserGroup("Designers");

|ruby
Cloudinary::AccountApi.create_user_group("Designers")

|java 
account.createUserGroup("Designers");

|nodejs
cloudinary.provisioning.account.create_user_group("Designers")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->createUserGroup("Designers");

|python
cloudinary.provisioning.account.create_user_group("Designers")

|curl
curl \
  -H "Content-Type: application/json" \
  -d '{
        "name": "Designers"
      }' \
  -X POST \
  https://:@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/user_groups

|cli
cld provisioning create_user_group "Designers"

```

#### Sample response
```json
{
  "id": "7f08f1f1fc910bf1f25274aef11d27",
  "name": "Designers"
}
```

---

### Add user to group

Add a user to a group with the specified ID.


#### Syntax
`POST /accounts/:account_id/user_groups/:group_id/users/:user_id`

```multi
|csharp
account.AddUserToGroup(string groupId, string userId);

|ruby
Cloudinary::AccountApi.add_user_to_group(group_id, user_id, options = {})

|java 
account.addUserToGroup(String groupId, String userId, Map options); 

|nodejs 
cloudinary.provisioning.account.add_user_to_group(string group_id, string user_id, object options); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->addUserToGroup(string $groupId, string $userId);

|python
cloudinary.provisioning.account.add_user_to_group(user_group_id, user_id, **options)

|cli
cld provisioning add_user_to_group $user_group_id $user_id [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
group\_id  | String | The ID of the user group.
user\_id | String | The ID of the user.

#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).


#### Example
Add the user with id '230df1d1fa913bf1f35e74a1f41e25' to the group with id '7f08f1f1fc910bf1f25274aef11d27':

```multi
|csharp
account.AddUserToGroup("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25");

|ruby
Cloudinary::AccountApi.add_user_to_group("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25")

|java 
account.addUserToGroup("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25");

|nodejs
cloudinary.provisioning.account.add_user_to_group("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->addUserToGroup("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25");

|python
cloudinary.provisioning.account.add_user_to_group("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25")

|curl
curl \
  -X POST \
  https://:@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/user_groups/7f08f1f1fc910bf1f25274aef11d27/users/230df1d1fa913bf1f35e74a1f41e25

|cli
cld provisioning add_user_to_group "7f08f1f1fc910bf1f25274aef11d27" "230df1d1fa913bf1f35e74a1f41e25"
```


#### Sample response
```json
{
  "users": [
    {
      "id": "230df1d1fa913bf1f35e74a1f41e25",
      "name": "John",
      "email": "john@example.com"
    }
  ]
}
```






---

### Update user group

Update the name of a specified user group.

#### Syntax
`PUT /accounts/:account_id/user_groups/:group_id`

```multi
|csharp
account.UpdateUserGroup(UpdateUserGroupParams parameters);

|ruby
Cloudinary::AccountApi.update_user_group(group_id, name, options = {})

|java 
account.updateUserGroup(String groupId, String name, Map options);

|nodejs 
cloudinary.provisioning.account.update_user_group(string group_id, string name, object options); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->updateUserGroup(string $groupId, string $name);

|python
cloudinary.provisioning.account.update_user_group(group_id, name, **options)

|cli
cld provisioning update_user_group $group_id $name [$options]
```


#### Required parameters
Parameter | Type | Description
---|---|---
group\_id  | String | The ID of the user group to update.
name  | String | The name for the user group.


#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
To update the name of a group with id '7f08f1f1fc910bf1f25274aef11d27' to 'Designers':

```multi
|csharp
var updateUserGroupParams = new UpdateUserGroupParams("7f08f1f1fc910bf1f25274aef11d27", "Designers");
account.UpdateUserGroup(updateUserGroupParams);

|ruby
Cloudinary::AccountApi.update_user_group("7f08f1f1fc910bf1f25274aef11d27", "Designers")

|java 
account.updateUserGroup("7f08f1f1fc910bf1f25274aef11d27", "Designers");

|nodejs
cloudinary.provisioning.account.update_user_group("7f08f1f1fc910bf1f25274aef11d27", "Designers")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->updateUserGroup("7f08f1f1fc910bf1f25274aef11d27", "Designers");

|python
cloudinary.provisioning.account.update_user_group("7f08f1f1fc910bf1f25274aef11d27", "Designers")

|curl
curl \
  -H "Content-Type: application/json" \
  -d '{
        "name": "Designers"
      }' \
  https://:@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/user_groups/7f08f1f1fc910bf1f25274aef11d27

|cli
cld provisioning update_user_group "7f08f1f1fc910bf1f25274aef11d27" "Designers"
```


#### Sample response
```json
{
  "id": "7f08f1f1fc910bf1f25274aef11d27",
  "name": "Designers"
}
```


---

### Delete user group

Delete a user group with the specified ID.

#### Syntax
`DELETE /accounts/:account_id/user_groups/:group_id`

```multi
|csharp
account.DeleteUserGroup(string groupId);

|ruby
Cloudinary::AccountApi.delete_user_group(group_id, options = {})

|java 
account.deleteUserGroup(String groupId, Map options); 

|nodejs 
cloudinary.provisioning.account.delete_user_group(string group_id, object options); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->deleteUserGroup(string $groupId);

|python
cloudinary.provisioning.account.delete_user_group(group_id, **options)

|cli
cld provisioning delete_user_group $group_id [$options]
```


#### Required parameters
Parameter | Type | Description
---|---|---
group\_id  | String | The ID of the user group to delete.


#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
Delete the user group with id '7f08f1f1fc910bf1f25274aef11d27':

```multi
|csharp
account.DeleteUserGroup("7f08f1f1fc910bf1f25274aef11d27");

|ruby
Cloudinary::AccountApi.delete_user_group("7f08f1f1fc910bf1f25274aef11d27")

|java 
account.deleteUserGroup("7f08f1f1fc910bf1f25274aef11d27");

|nodejs
cloudinary.provisioning.account.delete_user_group("7f08f1f1fc910bf1f25274aef11d27")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->deleteUserGroup("7f08f1f1fc910bf1f25274aef11d27");

|python
cloudinary.provisioning.account.delete_user_group("7f08f1f1fc910bf1f25274aef11d27")

|curl
curl \
  -X DELETE \
  https://:@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/user_groups/7f08f1f1fc910bf1f25274aef11d27

|cli
cld provisioning delete_user_group "7f08f1f1fc910bf1f25274aef11d27"
```

#### Sample response
```json
{
  "message": "ok"
}
```

---

### Remove user from group

Remove a user from a group with the specified ID.


#### Syntax
`DELETE /accounts/:account_id/user_groups/:group_id/users/:user_id`

```multi
|csharp
account.RemoveUserFromGroup(string groupId, string userId);

|ruby
Cloudinary::AccountApi.remove_user_from_group(group_id, user_id, options = {})

|java 
account.removeUserFromGroup(String groupId, String userId, Map options); 

|nodejs 
remove_user_from_group(string group_id, string user_id, object options); 

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->removeUserFromGroup(string $groupId, string $userId);

|python
cloudinary.provisioning.account.remove_user_from_group(group_id, user_id, **options)

|cli
cld provisioning remove_user_from_group $group_id $user_id [$options]
```

#### Required parameters
Parameter | Type | Description
---|---|---
group\_id  | String | The ID of the user group.
user\_id | String | The ID of the user.


#### Optional parameters
Parameter | Type | Description
---|---|---
options | Object | See [Configuration parameters](cloudinary_sdks#configuration_parameters).

#### Example
Remove the user with id '230df1d1fa913bf1f35e74a1f41e25' from the group with id '7f08f1f1fc910bf1f25274aef11d27':

```multi
|csharp
account.RemoveUserFromGroup("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25");

|ruby
Cloudinary::AccountApi.Cloudinary::AccountApi.remove_user_from_group("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25")

|java 
account.removeUserFromGroup("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25");

|nodejs
cloudinary.provisioning.account.remove_user_from_group("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25")
  .then((response) => { console.log(response); })
  .catch((err) => { console.log(err); });

|php_2
$account = new \Cloudinary\Api\Provisioning\AccountApi();
$account->removeUserFromGroup("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25");

|python
cloudinary.provisioning.account.remove_user_from_group("7f08f1f1fc910bf1f25274aef11d27", "230df1d1fa913bf1f35e74a1f41e25")

|curl
curl \
  -X DELETE \
  https://:@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/user_groups/7f08f1f1fc910bf1f25274aef11d27/users/230df1d1fa913bf1f35e74a1f41e25

|cli
cld provisioning remove_user_from_group "7f08f1f1fc910bf1f25274aef11d27" "230df1d1fa913bf1f35e74a1f41e25"
```


#### Sample response
```json
{
  "users": []
}
```

