# Manage & Operate › Identity & Access Management › Policies › Resource Groups API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Manage & Operate product's sections: https://developers.eu.ovhcloud.com/reference/manage-operate/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 5 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/manage-operate/identity-access-management/policies/resource-groups/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/manage-operate/identity-access-management/policies/resource-groups.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/manage-operate/identity-access-management/policies/resource-groups.json?format=openapi3

## Operations

- `GET /iam/resourceGroup` — List resource groups
- `GET /iam/resourceGroup/{groupId}` — Get a resource group
- `POST /iam/resourceGroup` — Create a resource group
- `DELETE /iam/resourceGroup/{groupId}` — Delete a resource group
- `PUT /iam/resourceGroup/{groupId}` — Update a resource group

## List resource groups

`GET /v2/iam/resourceGroup`

Link: https://developers.eu.ovhcloud.com/reference/manage-operate/identity-access-management/policies/resource-groups/#get-iam-resourcegroup

**Status:** Stable production version  
**IAM actions:** `account:apiovh:iam/resourceGroup/get`

Returns the resource groups of the account. Set `details` to true to expand resource information.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `details` | query | boolean |  | Add extra information about resources in output |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | iam.group.Response[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `createdAt` | string (date-time) | read-only | Creation time |
| `id` | string (uuid) | read-only | Unique identifier of the group |
| `name` | string | read-only | Name of the group |
| `owner` | string | read-only | Owner of the group |
| `readOnly` | boolean | read-only | Whether you can add or remove resources |
| `resources` | iam.group.Resource[] | read-only | Resources included in the group |
| `resources[].displayName` | string | read-only | Resource display name |
| `resources[].id` | string (uuid) |  | Unique identifier of the resource |
| `resources[].name` | string | read-only | Resource name |
| `resources[].owner` | string | read-only | Resource owner |
| `resources[].tags` | object | read-only | Resource tags. Tags that were internally computed are prefixed with ovh: |
| `resources[].type` | string | read-only | Resource type. All types can be retrieved at /reference/resource/type. |
| `resources[].urn` | string |  | Unique resource name used in policies |
| `updatedAt` | string (date-time) | read-only | Last update time |
| `urn` | string | read-only | Unique resource name used in policies |

```json
[
  {
    "createdAt": "2024-01-01T12:00:00Z",
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "owner": "string",
    "readOnly": true,
    "resources": [
      {
        "displayName": "string",
        "id": "00000000-0000-0000-0000-000000000000",
        "name": "string",
        "owner": "string",
        "tags": {
          "key": "string"
        },
        "type": "string",
        "urn": "string"
      }
    ],
    "updatedAt": "2024-01-01T12:00:00Z",
    "urn": "string"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/iam/resourceGroup" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/iam/resourceGroup")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/iam/resourceGroup");

print_r($result);
?>
```

## Get a resource group

`GET /v2/iam/resourceGroup/{groupId}`

Link: https://developers.eu.ovhcloud.com/reference/manage-operate/identity-access-management/policies/resource-groups/#get-iam-resourcegroup-groupid

**Status:** Stable production version  
**IAM actions:** `account:apiovh:iam/resourceGroup/get`

Returns the name and the resources of the group. Set `details` to true to expand resource information.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `details` | query | boolean |  | Add extra information about resources in output |
| `groupId` | path | string (uuid) | yes | Group ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | iam.group.Response | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `createdAt` | string (date-time) | read-only | Creation time |
| `id` | string (uuid) | read-only | Unique identifier of the group |
| `name` | string | read-only | Name of the group |
| `owner` | string | read-only | Owner of the group |
| `readOnly` | boolean | read-only | Whether you can add or remove resources |
| `resources` | iam.group.Resource[] | read-only | Resources included in the group |
| `resources[].displayName` | string | read-only | Resource display name |
| `resources[].id` | string (uuid) |  | Unique identifier of the resource |
| `resources[].name` | string | read-only | Resource name |
| `resources[].owner` | string | read-only | Resource owner |
| `resources[].tags` | object | read-only | Resource tags. Tags that were internally computed are prefixed with ovh: |
| `resources[].type` | string | read-only | Resource type. All types can be retrieved at /reference/resource/type. |
| `resources[].urn` | string |  | Unique resource name used in policies |
| `updatedAt` | string (date-time) | read-only | Last update time |
| `urn` | string | read-only | Unique resource name used in policies |

```json
{
  "createdAt": "2024-01-01T12:00:00Z",
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "owner": "string",
  "readOnly": true,
  "resources": [
    {
      "displayName": "string",
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "string",
      "owner": "string",
      "tags": {
        "key": "string"
      },
      "type": "string",
      "urn": "string"
    }
  ],
  "updatedAt": "2024-01-01T12:00:00Z",
  "urn": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/iam/resourceGroup/{groupId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/iam/resourceGroup/{groupId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/iam/resourceGroup/{groupId}");

print_r($result);
?>
```

## Create a resource group

`POST /v2/iam/resourceGroup`

Link: https://developers.eu.ovhcloud.com/reference/manage-operate/identity-access-management/policies/resource-groups/#post-iam-resourcegroup

**Status:** Stable production version  
**IAM actions:** `account:apiovh:iam/resourceGroup/create`

Creates a group of resources that policies can target as a single entity.

### Request body (required)

Type: `iam.group.Creation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | Name of the group |
| `resources` | iam.group.Resource[] |  | Resources to add in the created group |
| `resources[].displayName` | string | read-only | Resource display name |
| `resources[].id` | string (uuid) |  | Unique identifier of the resource |
| `resources[].name` | string | read-only | Resource name |
| `resources[].owner` | string | read-only | Resource owner |
| `resources[].tags` | object | read-only | Resource tags. Tags that were internally computed are prefixed with ovh: |
| `resources[].type` | string | read-only | Resource type. All types can be retrieved at /reference/resource/type. |
| `resources[].urn` | string |  | Unique resource name used in policies |

```json
{
  "name": "string",
  "resources": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "urn": "string"
    }
  ]
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | iam.group.Response | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `createdAt` | string (date-time) | read-only | Creation time |
| `id` | string (uuid) | read-only | Unique identifier of the group |
| `name` | string | read-only | Name of the group |
| `owner` | string | read-only | Owner of the group |
| `readOnly` | boolean | read-only | Whether you can add or remove resources |
| `resources` | iam.group.Resource[] | read-only | Resources included in the group |
| `resources[].displayName` | string | read-only | Resource display name |
| `resources[].id` | string (uuid) |  | Unique identifier of the resource |
| `resources[].name` | string | read-only | Resource name |
| `resources[].owner` | string | read-only | Resource owner |
| `resources[].tags` | object | read-only | Resource tags. Tags that were internally computed are prefixed with ovh: |
| `resources[].type` | string | read-only | Resource type. All types can be retrieved at /reference/resource/type. |
| `resources[].urn` | string |  | Unique resource name used in policies |
| `updatedAt` | string (date-time) | read-only | Last update time |
| `urn` | string | read-only | Unique resource name used in policies |

```json
{
  "createdAt": "2024-01-01T12:00:00Z",
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "owner": "string",
  "readOnly": true,
  "resources": [
    {
      "displayName": "string",
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "string",
      "owner": "string",
      "tags": {
        "key": "string"
      },
      "type": "string",
      "urn": "string"
    }
  ],
  "updatedAt": "2024-01-01T12:00:00Z",
  "urn": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/iam/resourceGroup" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: iam.group.Creation
result = client.post("/v2/iam/resourceGroup",
	name = None, # Name of the group (type: string)
	resources = None, # Resources to add in the created group (type: array)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: iam.group.Creation
$result = $ovh->post("/v2/iam/resourceGroup", array(
	name => null, // Name of the group (type: string)
	resources => null, // Resources to add in the created group (type: array)
));

print_r($result);
?>
```

## Delete a resource group

`DELETE /v2/iam/resourceGroup/{groupId}`

Link: https://developers.eu.ovhcloud.com/reference/manage-operate/identity-access-management/policies/resource-groups/#delete-iam-resourcegroup-groupid

**Status:** Stable production version  
**IAM actions:** `account:apiovh:iam/resourceGroup/delete`

Deletes the resource group. The resources it contains are not deleted.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `groupId` | path | string (uuid) | yes | Group ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/iam/resourceGroup/{groupId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/v2/iam/resourceGroup/{groupId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/v2/iam/resourceGroup/{groupId}");

print_r($result);
?>
```

## Update a resource group

`PUT /v2/iam/resourceGroup/{groupId}`

Link: https://developers.eu.ovhcloud.com/reference/manage-operate/identity-access-management/policies/resource-groups/#put-iam-resourcegroup-groupid

**Status:** Stable production version  
**IAM actions:** `account:apiovh:iam/resourceGroup/edit`

Replaces the name and the list of resources of the group.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `groupId` | path | string (uuid) | yes | Group ID |

### Request body (required)

Type: `iam.group.Update`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | New name of the group |
| `resources` | iam.group.Resource[] | yes | New list of resources of the group |
| `resources[].displayName` | string | read-only | Resource display name |
| `resources[].id` | string (uuid) |  | Unique identifier of the resource |
| `resources[].name` | string | read-only | Resource name |
| `resources[].owner` | string | read-only | Resource owner |
| `resources[].tags` | object | read-only | Resource tags. Tags that were internally computed are prefixed with ovh: |
| `resources[].type` | string | read-only | Resource type. All types can be retrieved at /reference/resource/type. |
| `resources[].urn` | string |  | Unique resource name used in policies |

```json
{
  "name": "string",
  "resources": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "urn": "string"
    }
  ]
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | iam.group.Response | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `createdAt` | string (date-time) | read-only | Creation time |
| `id` | string (uuid) | read-only | Unique identifier of the group |
| `name` | string | read-only | Name of the group |
| `owner` | string | read-only | Owner of the group |
| `readOnly` | boolean | read-only | Whether you can add or remove resources |
| `resources` | iam.group.Resource[] | read-only | Resources included in the group |
| `resources[].displayName` | string | read-only | Resource display name |
| `resources[].id` | string (uuid) |  | Unique identifier of the resource |
| `resources[].name` | string | read-only | Resource name |
| `resources[].owner` | string | read-only | Resource owner |
| `resources[].tags` | object | read-only | Resource tags. Tags that were internally computed are prefixed with ovh: |
| `resources[].type` | string | read-only | Resource type. All types can be retrieved at /reference/resource/type. |
| `resources[].urn` | string |  | Unique resource name used in policies |
| `updatedAt` | string (date-time) | read-only | Last update time |
| `urn` | string | read-only | Unique resource name used in policies |

```json
{
  "createdAt": "2024-01-01T12:00:00Z",
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "owner": "string",
  "readOnly": true,
  "resources": [
    {
      "displayName": "string",
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "string",
      "owner": "string",
      "tags": {
        "key": "string"
      },
      "type": "string",
      "urn": "string"
    }
  ],
  "updatedAt": "2024-01-01T12:00:00Z",
  "urn": "string"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/iam/resourceGroup/{groupId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: iam.group.Update
result = client.put("/v2/iam/resourceGroup/{groupId}",
	name = None, # New name of the group (type: string)
	resources = None, # New list of resources of the group (type: array)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: iam.group.Update
$result = $ovh->put("/v2/iam/resourceGroup/{groupId}", array(
	name => null, // New name of the group (type: string)
	resources => null, // New list of resources of the group (type: array)
));

print_r($result);
?>
```
