# Account activity

Read the security and activity history of a Main Account and its Subaccounts in one feed with ListAccountActivity: sign-ins, API keys, MFA, policies, members, invites, and saved destinations.

[`ListAccountActivity`](https://testnet.polyester.com/docs/api-docs/connect/auth.v1.AccountActivityService/ListAccountActivity) ([`GET /v1/auth/activity`](https://testnet.polyester.com/docs/api-docs/rest/GET/v1/auth/activity)) returns the security and activity events of a Main Account and all its Subaccounts in one feed, newest first: sign-ins, API key, MFA, policy, member, invite, and saved-destination changes. Use it to audit who did what, from where, and with which API key.

`ListSubaccountActivity` still reads the events of one Subaccount; see [Subaccounts and roles](https://testnet.polyester.com/docs/developer-docs/account/subaccounts-and-roles). The account feed adds the Main Account's own events, which belong to no Subaccount, such as sign-ins and saved destinations.

## Access

- **Session** · only the Main Account's own session. No member role opens it.
- **Main Account API key** · needs the `READ_ACCOUNT_ACTIVITY` permission on its policy, and reads the whole account.
- **Subaccount-scoped API key** · needs `READ_ACCOUNT_ACTIVITY` too, and reads only its own Subaccount's events. Setting `includeMainAccount` is refused with `PERMISSION_DENIED`, and naming another Subaccount answers `NOT_FOUND`.

`READ_SUBACCOUNT_ACTIVITY` does not open this feed. A Subaccount outside the caller's Main Account answers `NOT_FOUND`. The read needs no step-up. See [API key and Subaccount policies](https://testnet.polyester.com/docs/developer-docs/account/api-key-policies#subaccounts).

## Filter the feed

Every filter is optional and narrows the result; an omitted filter matches every event the caller may read.

- **Accounts** · `subaccountIds` (at most 100) and `includeMainAccount` together select the accounts the feed covers. `includeMainAccount` alone lists only the Main Account's own events; with `subaccountIds` it adds them to those Subaccounts. When neither selects an account, the feed covers the Main Account and every Subaccount the caller may read.
- **What happened** · `entityKinds` (at most 16), `eventActions` (at most 32), and `sources` (at most 8), each without repeats.
- **Who did it** · `apiKeyId` is the API key's `ak_` string ID from `ApiKey.key_id`, not an opaque account-style ID. It returns only the events performed with that key.
- **When** · `startTime` is inclusive and `endTime` exclusive. When both are set, `endTime` must be after `startTime`.

```http
GET /v1/auth/activity?includeMainAccount=true&entityKinds=SESSION&eventActions=FAILED&startTime=2026-11-01T00:00:00Z
```

Over REST, repeat a parameter for each value (`subaccountIds=<id>&subaccountIds=<id>`), and spell enum values without their prefix, as REST responses do: `SESSION`, `FAILED`, `WEB`. A prefixed name such as `ACTIVITY_ENTITY_SESSION` is refused with `400`; ConnectRPC JSON takes the full names. Times are RFC 3339. Opaque account and item IDs are base58 strings in REST and decimal strings in ConnectRPC JSON. API key IDs stay `ak_` strings on both interfaces.

## Pages

`limit` defaults to 50 and is at most 200. Pass `nextPageToken` from the previous response as `pageToken` to read the next page; it is empty when no more events exist. A page token is bound to the Main Account, the API key when the caller is one, and every filter of the request: reuse it only with the same filters, or the request fails with `INVALID_ARGUMENT`.

After the 0.93.9 update, discard old `ListAccountActivity` tokens for requests filtered by `apiKeyId` and every old `ListSubaccountActivity` token. They fail with `INVALID_ARGUMENT`; start from the first page. Unfiltered `ListAccountActivity` tokens keep working.

## Events

Each event carries:

- `createdAt`, `entityKind`, `eventAction`, and `source`
- `subaccountId` · the Subaccount the event belongs to; absent for an event of the Main Account itself
- `actor` · always set; `kind` identifies a signed-in `USER`, an `API_KEY`, `SYSTEM`, or an `UNAUTHENTICATED` request
- `item` · the affected item's ID and its display `name` at the time of the event. Its ID is a oneof: at most one ID field is set. Sign-ins and recovery codes have a name without an ID. Events recorded before item details were introduced may have no `item`
- `details` · typed details for the kind of item, with only the changed fields set. Changes use before/after values such as `from` and `to`; policy actions use `added` and `removed` lists of `PolicyAction` values. A saved-destination note is only marked as changed, without its text. Details may be absent when there was no change to report, such as a deletion, or on older events
- `ip` and `userAgent` · where the action came from

A `USER` actor carries `accountId` and, when available, `username`. A Subaccount member is named by the member's own account. An `API_KEY` actor adds `apiKeyId`, `apiKeyKind`, and `apiKeyLabel`; the kind and label are those recorded at the time of the event. A `SYSTEM` actor carries `systemReason`, has source `SYSTEM`, and has no IP or user agent. An `UNAUTHENTICATED` actor names no account; the event's source, IP, and user agent describe the attempt.

Read `actor`, `item`, and `details` instead of the removed `actorAccountId`, `actorApiKeyId`, and `payloadJson` fields. The event shape is shared with `ListSubaccountActivity`.

Entity kinds, as REST spells them:

- `ACCOUNT` · the Main Account
- `SESSION` · sign-ins and other session security events, for example an MFA confirmation applied or revoked
- `API_KEY`
- `SUBACCOUNT`
- `MEMBER` · a Subaccount member
- `POLICY` · an access policy
- `INVITE` · a Subaccount invitation
- `SECURITY` · the account's security configuration, such as MFA
- `DESTINATION` · a saved transfer destination

Actions: `CREATED`, `UPDATED`, `DELETED`, `ENABLED`, `DISABLED`, `REMOVED` (removed from its parent scope), `ROLE_SET`, `RECEIVED` and `REPLIED` (a security challenge or request and its answer), `FAILED`, `REVOKED`, `BLOCKED`, `HOLD_PLACED`, `HOLD_RELEASED`, and `REQUESTED` and `APPLIED` (a later `APPLIED` or `FAILED` event records how a request ended). Sources: `WEB`, `MOBILE`, `API`, and `SYSTEM` (ConnectRPC: `ACTIVITY_SOURCE_SYSTEM`).

### Sign-ins

A successful wallet sign-in records a `SESSION` event with action `CREATED`, and a refused one action `FAILED`, with the client IP and user agent. Read `details.session.method` (`WALLET` in REST) and `details.session.walletAddress`, when available. A refused sign-in uses an `UNAUTHENTICATED` actor and `details.session.failure`: `INVALID_CHALLENGE`, `CHALLENGE_EXPIRED`, `CHALLENGE_USED`, `INVALID_SIGNATURE`, or `NO_CHALLENGE` in REST. ConnectRPC uses the full enum names.

> **A session's end is not recorded**
>
> A session ends without an event: the feed has no sign-out or session expiry events. See [Session login](https://testnet.polyester.com/docs/developer-docs/authentication-security/session-login).
