Skip to content
Start here

List Organizations

Deprecated
client.User.Organizations.List(ctx, query) (*V4PagePaginationArray[Organization], error)
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 param.Field[OrganizationListParamsDirection]optional

Direction to order organizations.

const OrganizationListParamsDirectionAsc OrganizationListParamsDirection = "asc"
const OrganizationListParamsDirectionDesc OrganizationListParamsDirection = "desc"
Match param.Field[OrganizationListParamsMatch]optional

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

const OrganizationListParamsMatchAny OrganizationListParamsMatch = "any"
const OrganizationListParamsMatchAll OrganizationListParamsMatch = "all"
Name param.Field[string]optional

Organization name.

maxLength100
Order param.Field[OrganizationListParamsOrder]optional

Field to order organizations by.

const OrganizationListParamsOrderID OrganizationListParamsOrder = "id"
const OrganizationListParamsOrderName OrganizationListParamsOrder = "name"
const OrganizationListParamsOrderStatus OrganizationListParamsOrder = "status"
Page param.Field[float64]optional

Page number of paginated results.

minimum1
PerPage param.Field[float64]optional

Number of organizations per page.

maximum50
minimum5
Status param.Field[OrganizationListParamsStatus]optional

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

const OrganizationListParamsStatusMember OrganizationListParamsStatus = "member"
const OrganizationListParamsStatusInvited OrganizationListParamsStatus = "invited"
ReturnsExpand Collapse
type Organization struct{…}
ID stringoptional

Identifier

maxLength32
minLength32
Name stringoptional

Organization name.

maxLength100
Permissions []Permissionoptional

Access permissions for this User.

Roles []stringoptional

List of roles that a user has within an organization.

Status Statusoptional

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

One of the following:
const StatusMember Status = "member"
const StatusInvited Status = "invited"

List Organizations

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/user"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
    option.WithAPIEmail("user@example.com"),
  )
  page, err := client.User.Organizations.List(context.TODO(), user.OrganizationListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "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
  }
}