Skip to content

Organizations

organizations

Organizations resource group.

Wraps two Compliance API endpoints:

  • GET /v1/compliance/organizations — list every organisation under the parent organisation. Unpaginated: the server returns the whole list in one shot, and errors with HTTP 500 when the result would exceed 1,000 organisations. The SDK surfaces that error untouched as InternalServerError rather than paginating around it client-side — server is the source of truth on capacity.
  • GET /v1/compliance/organizations/{org_uuid}/users — offset paginated list of users in a given organisation. Exposed via list_users (one page) and iter_users (auto-paginate).
Example
from claude_compliance_sdk import ComplianceClient

with ComplianceClient(api_key="sk-ant-api01-...") as client:
    for org in client.organizations.list():
        print(org.uuid, org.name)
        for user in client.organizations.iter_users(org.uuid):
            print("  ", user.email)

Organization dataclass

A single organisation under the parent organisation.

Attributes:

Name Type Description
uuid str

Stable UUID identifier (used as the path segment for /organizations/{org_uuid}/users).

name str

Human-readable organisation name.

created_at str

RFC 3339 creation timestamp.

extra dict[str, Any]

Any additional fields the API adds in a later revision.

from_dict classmethod

from_dict(body: Mapping[str, Any]) -> 'Organization'

Build an Organization from one decoded record.

User dataclass

A user member of an organisation.

Role and group memberships are not part of this payload — they come from the Roles and Groups resources.

Attributes:

Name Type Description
id str

Tagged user identifier (user_...).

full_name str

Current display name.

email str

Current email address.

created_at str

RFC 3339 account creation timestamp.

extra dict[str, Any]

Any additional fields the API adds in a later revision.

from_dict classmethod

from_dict(body: Mapping[str, Any]) -> 'User'

Build a User from one decoded record.

Organizations

Synchronous client for the Organizations endpoints.

list

list() -> list[Organization]

List every organisation under the parent organisation.

The Compliance API does not paginate this endpoint and returns an error when the result would exceed 1,000 organisations; that error surfaces as InternalServerError rather than being papered over client-side.

Returns:

Type Description
list[Organization]

Organisations sorted by created_at ascending. May be

list[Organization]

empty.

Raises:

Type Description
InternalServerError

When the server-side 1,000-org cap is exceeded. The exception's error_message carries the API's "Maximum Response Size Exceeded" message.

APIError

For any other non-2xx response.

list_users

list_users(
    org_uuid: str,
    *,
    limit: int | None = None,
    page: str | None = None
) -> OffsetPage[User]

Fetch one offset-paginated page of users for an organisation.

Parameters:

Name Type Description Default
org_uuid str

Organisation UUID, from list results.

required
limit int | None

Maximum results per page (default 500, max 1000).

None
page str | None

Opaque pagination token from a prior response's next_page.

None

Returns:

Type Description
OffsetPage[User]

One OffsetPage of User objects.

iter_users

iter_users(
    org_uuid: str, *, limit: int | None = None
) -> Iterator[User]

Iterate every user in an organisation, auto-paginating.

Same filters as list_users except that page is managed by the iterator and therefore not accepted here.

AsyncOrganizations

Asynchronous client for the Organizations endpoints.

list async

list() -> list[Organization]

Async analogue of list.

list_users async

list_users(
    org_uuid: str,
    *,
    limit: int | None = None,
    page: str | None = None
) -> OffsetPage[User]

Async analogue of list_users.

iter_users

iter_users(
    org_uuid: str, *, limit: int | None = None
) -> AsyncIterator[User]

Async analogue of iter_users.