# Manage & Operate › Identity & Access Management › Policies › Resources 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

> 3 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/resources/

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

## Operations

- `GET /iam/resource` — List resources
- `GET /iam/resource/{resourceURN}` — Get a resource
- `POST /iam/resource/{resourceURN}/authorization/check` — Check authorizations on a resource

## List resources

`GET /v2/iam/resource`

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

**Status:** Stable production version

Returns the resources of the account. Filter by `resourceType`, `resourceName`, `resourceURN` pattern and tag filters.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `resourceName` | query | string[] |  | Filter resources for specific resource names |
| `resourceType` | query | string[] |  | Filter resources for specific resource types |
| `resourceURN` | query | string[] |  | Filter resources for specific resource URN patterns |
| `tags` | query | object |  | Filter resources using tag filters |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | iam.resource.Resource[] | successful operation |

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

```json
[
  {
    "displayName": "string",
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "owner": "string",
    "tags": {
      "key": "string"
    },
    "type": "string",
    "urn": "string"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/iam/resource" \
  -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/resource")

# 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/resource");

print_r($result);
?>
```

## Get a resource

`GET /v2/iam/resource/{resourceURN}`

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

**Status:** Stable production version

Returns the details of a resource identified by its URN.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `resourceURN` | path | string | yes | ResourceURN |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | iam.resource.Resource | successful operation |

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

```json
{
  "displayName": "string",
  "id": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "owner": "string",
  "tags": {
    "key": "string"
  },
  "type": "string",
  "urn": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/iam/resource/{resourceURN}" \
  -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/resource/{resourceURN}")

# 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/resource/{resourceURN}");

print_r($result);
?>
```

## Check authorizations on a resource

`POST /v2/iam/resource/{resourceURN}/authorization/check`

Link: https://developers.eu.ovhcloud.com/reference/manage-operate/identity-access-management/policies/resources/#post-iam-resource-resourceurn-authorization-check

**Status:** Stable production version

Checks the listed actions on this resource.
Returns the actions that are authorized and those that are not.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `resourceURN` | path | string | yes | ResourceURN |

### Request body (required)

Type: `iam.AuthorizeRequest`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `actions` | string[] | yes | List of actions to check authorizations for |

```json
{
  "actions": [
    "string"
  ]
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | iam.AuthorizeResponse | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `authorizedActions` | string[] | read-only | Actions from your request that the caller is allowed to perform on the resource |
| `unauthorizedActions` | string[] | read-only | Actions from your request that the caller is not allowed to perform on the resource |

```json
{
  "authorizedActions": [
    "string"
  ],
  "unauthorizedActions": [
    "string"
  ]
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/iam/resource/{resourceURN}/authorization/check" \
  -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.AuthorizeRequest
result = client.post("/v2/iam/resource/{resourceURN}/authorization/check",
	actions = None, # List of actions to check authorizations for (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.AuthorizeRequest
$result = $ovh->post("/v2/iam/resource/{resourceURN}/authorization/check", array(
	actions => null, // List of actions to check authorizations for (type: array)
));

print_r($result);
?>
```
