Skip to content
Start here

List Organizations

Deprecated
client.user.organizations.list(OrganizationListParams { direction, match, name, 4 more } query?, RequestOptionsoptions?): V4PagePaginationArray<Organization { id, name, permissions, 2 more } >
GET/user/organizations

Lists organizations the user is associated with.

Security

API Email + API Key

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

Example:X-Auth-Email: user@example.com

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

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Memberships WriteMemberships Read
ParametersExpand Collapse
query: OrganizationListParams { direction, match, name, 4 more }
direction?: "asc" | "desc"

Direction to order organizations.

One of the following:
"asc"
"desc"
match?: "any" | "all"

Whether to match all search requirements or at least one (any).

One of the following:
"any"
"all"
name?: string

Organization name.

maxLength100
order?: "id" | "name" | "status"

Field to order organizations by.

One of the following:
"id"
"name"
"status"
page?: number

Page number of paginated results.

minimum1
per_page?: number

Number of organizations per page.

maximum50
minimum5
status?: "member" | "invited"

Whether the user is a member of the organization or has an inivitation pending.

One of the following:
"member"
"invited"
ReturnsExpand Collapse
Organization { id, name, permissions, 2 more }
id?: string

Identifier

maxLength32
minLength32
name?: string

Organization name.

maxLength100
permissions?: Array<Permission>

Access permissions for this User.

roles?: Array<string>

List of roles that a user has within an organization.

status?: Status

Whether the user is a member of the organization or has an invitation pending.

One of the following:
"member"
"invited"

List Organizations

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted
  apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const organization of client.user.organizations.list()) {
  console.log(organization.id);
}
{
  "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": "023e105f4ecef8ad9ca31a8372d0c353",
      "name": "Cloudflare, Inc.",
      "permissions": [
        "#zones:read"
      ],
      "roles": [
        "All Privileges - Super Administrator"
      ],
      "status": "member"
    }
  ],
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}
Returns Examples
{
  "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": "023e105f4ecef8ad9ca31a8372d0c353",
      "name": "Cloudflare, Inc.",
      "permissions": [
        "#zones:read"
      ],
      "roles": [
        "All Privileges - Super Administrator"
      ],
      "status": "member"
    }
  ],
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}