---
title: List Resource Groups
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/python)

[IAM](https://developers.cloudflare.com/api/python/resources/iam)

[Resource Groups](https://developers.cloudflare.com/api/python/resources/iam/subresources/resource_groups)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# List Resource Groups

iam.resource\_groups.list(ResourceGroupListParams\*\*kwargs) -> SyncSinglePage\[[ResourceGroupListResponse](<https://developers.cloudflare.com/api/python/resources/iam#(resource)%20iam.resource_groups%20%3E%20(model)%20resource_group_list_response%20%3E%20(schema)>)]

GET/accounts/{account\_id}/iam/resource\_groups

List all the resource groups for an account.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**<code>X-Auth-Email: user@example.com</code>

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### Accepted Permissions (at least one required)

`SCIM Provisioning``Account Settings Write``Account Settings Read`

##### ParametersExpand Collapse

account\_id: str

Account identifier tag.

maxLength32

minLength32

[Link to this property](<#(resource)%20iam.resource_groups%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20account_id%20%3E%20(schema)>)

id: Optional\[str]

ID of the resource group to be fetched.

maxLength32

minLength32

[Link to this property](<#(resource)%20iam.resource_groups%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20id%20%3E%20(schema)>)

name: Optional\[str]

Name of the resource group to be fetched.

[Link to this property](<#(resource)%20iam.resource_groups%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20name%20%3E%20(schema)>)

##### ReturnsExpand Collapse

<details>

<summary>

class ResourceGroupListResponse: …

A group of scoped resources.

</summary>

id: str

Identifier of the resource group.

<a href="#(resource)%20iam.resource_groups%20%3E%20(model)%20resource_group_list_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

<details>

<summary>

scope: Scope

A scope is a combination of scope objects which provides additional context.

</summary>

key: str

This is a combination of pre-defined resource name and identifier (like Account ID etc.)

<a href="#(resource)%20iam.resource_groups%20%3E%20(model)%20resource_group_list_response%20%3E%20(schema)%20%3E%20(property)%20scope%20%3E%20(property)%20key">Link to this property</a>

<details>

<summary>

objects: List\[ScopeObject]

A list of scope objects for additional context.

</summary>

key: str

This is a combination of pre-defined resource name and identifier (like Zone ID etc.)

<a href="#(resource)%20iam.resource_groups%20%3E%20(model)%20resource_group_list_response%20%3E%20(schema)%20%3E%20(property)%20scope%20%3E%20(property)%20objects%20%3E%20(items)%20%3E%20(property)%20key">Link to this property</a>

</details>

<a href="#(resource)%20iam.resource_groups%20%3E%20(model)%20resource_group_list_response%20%3E%20(schema)%20%3E%20(property)%20scope%20%3E%20(property)%20objects">Link to this property</a>

</details>

<a href="#(resource)%20iam.resource_groups%20%3E%20(model)%20resource_group_list_response%20%3E%20(schema)%20%3E%20(property)%20scope">Link to this property</a>

<details>

<summary>

meta: Optional\[Meta]

Attributes associated to the resource group.

</summary>

key: Optional\[str]

<a href="#(resource)%20iam.resource_groups%20%3E%20(model)%20resource_group_list_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20key">Link to this property</a>

value: Optional\[str]

<a href="#(resource)%20iam.resource_groups%20%3E%20(model)%20resource_group_list_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20value">Link to this property</a>

</details>

<a href="#(resource)%20iam.resource_groups%20%3E%20(model)%20resource_group_list_response%20%3E%20(schema)%20%3E%20(property)%20meta">Link to this property</a>

name: Optional\[str]

Name of the resource group.

<a href="#(resource)%20iam.resource_groups%20%3E%20(model)%20resource_group_list_response%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

</details>

[Link to this property](<#(resource)%20iam.resource_groups%20%3E%20(model)%20resource_group_list_response%20%3E%20(schema)>)

### List Resource Groups

Python

HTTPTypeScriptPythonGoTerraform

```
import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
page = client.iam.resource_groups.list(
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
page = page.result[0]
print(page.id)
```

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1",
      "scope": {
        "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
        "objects": [
          {
            "key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"
          }
        ]
      },
      "meta": {
        "key": "key",
        "value": "value"
      },
      "name": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4"
    }
  ]
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": [
    {
      "id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1",
      "scope": {
        "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4",
        "objects": [
          {
            "key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"
          }
        ]
      },
      "meta": {
        "key": "key",
        "value": "value"
      },
      "name": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4"
    }
  ]
}
```