# Organizations ## List Organizations `user.organizations.list(OrganizationListParams**kwargs) -> SyncV4PagePaginationArray[Organization]` **get** `/user/organizations` Lists organizations the user is associated with. ### Parameters - `direction: Optional[Literal["asc", "desc"]]` Direction to order organizations. - `"asc"` - `"desc"` - `match: Optional[Literal["any", "all"]]` Whether to match all search requirements or at least one (any). - `"any"` - `"all"` - `name: Optional[str]` Organization name. - `order: Optional[Literal["id", "name", "status"]]` Field to order organizations by. - `"id"` - `"name"` - `"status"` - `page: Optional[float]` Page number of paginated results. - `per_page: Optional[float]` Number of organizations per page. - `status: Optional[Literal["member", "invited"]]` Whether the user is a member of the organization or has an inivitation pending. - `"member"` - `"invited"` ### Returns - `class Organization: …` - `id: Optional[str]` Identifier - `name: Optional[str]` Organization name. - `permissions: Optional[List[Permission]]` Access permissions for this User. - `roles: Optional[List[str]]` List of roles that a user has within an organization. - `status: Optional[Status]` Whether the user is a member of the organization or has an invitation pending. - `"member"` - `"invited"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.user.organizations.list() page = page.result[0] print(page.id) ``` #### Response ```json { "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 } } ``` ## Organization Details `user.organizations.get(strorganization_id) -> object` **get** `/user/organizations/{organization_id}` Gets a specific organization the user is associated with. ### Parameters - `organization_id: str` Identifier ### Returns - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) organization = client.user.organizations.get( "023e105f4ecef8ad9ca31a8372d0c353", ) print(organization) ``` #### Response ```json { "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": {} } ``` ## Leave Organization `user.organizations.delete(strorganization_id) -> OrganizationDeleteResponse` **delete** `/user/organizations/{organization_id}` Removes association to an organization. ### Parameters - `organization_id: str` Identifier ### Returns - `class OrganizationDeleteResponse: …` - `id: Optional[str]` Identifier ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) organization = client.user.organizations.delete( "023e105f4ecef8ad9ca31a8372d0c353", ) print(organization.id) ``` #### Response ```json { "id": "023e105f4ecef8ad9ca31a8372d0c353" } ``` ## Domain Types ### Organization - `class Organization: …` - `id: Optional[str]` Identifier - `name: Optional[str]` Organization name. - `permissions: Optional[List[Permission]]` Access permissions for this User. - `roles: Optional[List[str]]` List of roles that a user has within an organization. - `status: Optional[Status]` Whether the user is a member of the organization or has an invitation pending. - `"member"` - `"invited"` ### Organization Delete Response - `class OrganizationDeleteResponse: …` - `id: Optional[str]` Identifier