Activities¶
activities ¶
Activities resource group.
Wraps GET /v1/compliance/activities. The Activity Feed is the
cursor-paginated audit log for an organisation; both Compliance Access
Keys (with read:compliance_activities scope) and Admin keys can
call it. The server is the source of truth on the scope check — the
client never inspects the API key prefix.
Example
Activity
dataclass
¶
A single audit event from the Compliance API activity feed.
Per-type fields (for example claude_chat_id on a
claude_chat_created activity) land in extra rather than
on the dataclass so the SDK does not have to track the full list
of activity types — that set grows over time.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique identifier ( |
created_at |
str
|
When the activity occurred, RFC 3339. |
type |
str
|
Activity type string ( |
organization_id |
str | None
|
Owning organisation's tagged ID, or |
organization_uuid |
str | None
|
Owning organisation's UUID, or |
actor |
dict[str, Any] | None
|
Raw actor payload ( |
extra |
dict[str, Any]
|
Activity-type-specific fields preserved verbatim from the response, plus any new top-level fields the API adds later. |
from_dict
classmethod
¶
Build an Activity from one decoded JSON record.
Activities ¶
Synchronous client for the Compliance API activity feed.
list ¶
list(
*,
organization_ids: StrList | None = None,
actor_ids: StrList | None = None,
activity_types: StrList | None = None,
created_at_gte: str | None = None,
created_at_gt: str | None = None,
created_at_lte: str | None = None,
created_at_lt: str | None = None,
after_id: str | None = None,
before_id: str | None = None,
limit: int | None = None
) -> CursorPage[Activity]
Fetch a single page of activities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
organization_ids
|
StrList | None
|
Filter to activities in any of these organisations. |
None
|
actor_ids
|
StrList | None
|
Filter to activities by any of these actor user IDs. |
None
|
activity_types
|
StrList | None
|
Filter to activities of any of these types. |
None
|
created_at_gte
|
str | None
|
|
None
|
created_at_gt
|
str | None
|
|
None
|
created_at_lte
|
str | None
|
|
None
|
created_at_lt
|
str | None
|
|
None
|
after_id
|
str | None
|
Cursor for forward pagination (newer items). |
None
|
before_id
|
str | None
|
Cursor for backward pagination (older items).
Mutually exclusive with |
None
|
limit
|
int | None
|
Maximum results, default 100, max 5000. |
None
|
Returns:
| Type | Description |
|---|---|
CursorPage[Activity]
|
One |
Raises:
| Type | Description |
|---|---|
InsufficientScopeError
|
When the API key lacks
|
APIError
|
For any other non-2xx response. |
iter ¶
iter(
*,
organization_ids: StrList | None = None,
actor_ids: StrList | None = None,
activity_types: StrList | None = None,
created_at_gte: str | None = None,
created_at_gt: str | None = None,
created_at_lte: str | None = None,
created_at_lt: str | None = None,
limit: int | None = None
) -> Iterator[Activity]
Iterate every matching activity, auto-paginating.
Same filters as list except that after_id /
before_id are managed by the iterator and therefore not
accepted here.
AsyncActivities ¶
Asynchronous client for the Compliance API activity feed.
list
async
¶
list(
*,
organization_ids: StrList | None = None,
actor_ids: StrList | None = None,
activity_types: StrList | None = None,
created_at_gte: str | None = None,
created_at_gt: str | None = None,
created_at_lte: str | None = None,
created_at_lt: str | None = None,
after_id: str | None = None,
before_id: str | None = None,
limit: int | None = None
) -> CursorPage[Activity]
Async analogue of list.
iter ¶
iter(
*,
organization_ids: StrList | None = None,
actor_ids: StrList | None = None,
activity_types: StrList | None = None,
created_at_gte: str | None = None,
created_at_gt: str | None = None,
created_at_lte: str | None = None,
created_at_lt: str | None = None,
limit: int | None = None
) -> AsyncIterator[Activity]
Async analogue of iter.