---
title: "IdentityHound API: Change feed"
description: "Read the change feed, with the IdentityHound API."
url: "https://agentpost.tools/docs/identityhound/reference/events"
kind: reference
---

# Change feed

Read IdentityHound’s retained changes after a cursor, in order, as CloudEvents. Each event keeps who acted and for whom. [Change feed retention](/docs/identityhound/concepts/change-feed.md#limits) explains how long the feed keeps changes and what happens when they expire.

[Change feed](/docs/identityhound/concepts/change-feed.md) explains what each event records and the feed’s guarantees. [Sync records with the change feed](/docs/identityhound/guides/change-feed.md) processes pages and saves a cursor for the next run.

Paths are relative to `https://api.agentpost.tools/v1/identity`, and every request follows the [API basics](/docs/platform/api-basics.md). [Who may call](/docs/identityhound/reference.md#who-may-call) explains each kind of caller.

## Read the change feed

`GET /events`

Events after a cursor, and the next cursor.

-   **Who may call:** Your server.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.events.read(query)`
-   **Pages:** `limit`, 1 to 500, default 100. A feed: every answer has `next`, to send as `after`. [Lists](/docs/platform/api-basics.md#lists) has the rule.

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `after` | `integer` or `string` or `string` | No | The `seq` to read after, or `latest` to start from now: no events, and `next` set to the newest `seq`. Start at 0, then pass each page’s `next`. Any integer or string, or `"latest"`. |
| `limit` | `integer` | No | The most events to answer with, from 1 to 500; 1–500; default `100`. |
| `types` | `string` | No | Full event types to keep, separated by commas. Without it, every type. |

### Response

`200 OK`, with [`EventsResponse`](/docs/identityhound/reference/events.md#the-eventsresponse-object).

### Errors

-   [`cursor_expired`](/docs/identityhound/errors.md#cursor_expired) (410)
-   [`trusted_caller_required`](/docs/identityhound/errors.md#trusted_caller_required) (403)

Any operation can also answer with the codes [Conventions](/docs/identityhound/reference.md#conventions) lists.

```bash tab="curl"
curl 'https://api.agentpost.tools/v1/identity/events?after=1041&limit=1' \
  -H "Authorization: Bearer sk_test_…"
```

```ts tab="SDK"
import { createClient } from '@agentpost-tools/identityhound-sdk';

const client = createClient({ token: 'sk_test_…' });
const { events, next } = await client.events.read({ after: 1041, limit: 1 });
```

```json title="Response"
{
  "events": [
    {
      "id": "01JDGKQN2M8X4C6V0B3N5T7R9W",
      "seq": 1042,
      "specversion": "1.0",
      "type": "tools.agentpost.identity.membership.added",
      "source": "/identityhound",
      "subject": "mem_01JD4CX40XT3YPEZHJ8VY0RG03",
      "time": "2026-11-05T10:12:00.000Z",
      "datacontenttype": "application/json",
      "data": {
        "context": {
          "actor": {
            "id": "prn_01JD1F7TG1SVVEHCFCS56KF78R"
          },
          "via": "session"
        },
        "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
        "membershipId": "mem_01JD4CX40XT3YPEZHJ8VY0RG03",
        "principalId": "prn_01JD1F7TG1SVVEHCFCS56KF78R",
        "principalKind": "human",
        "role": "member"
      }
    }
  ],
  "next": 1042
}
```

## The EventsResponse object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `events` | `object[]` | Always |  |
| `events[].id` | `string` | Always | A plain ULID, unique to the event. |
| `events[].seq` | `number` | Always | The event’s place in the project’s feed, from 1. Pass it as `after` to read the events after it. |
| `events[].specversion` | `"1.0"` | Always |  |
| `events[].type` | `string` | Always | The full type, `tools.agentpost.identity.<event>`. |
| `events[].source` | `"/identityhound"` | Always |  |
| `events[].subject` | `string` | When set | The record the event is about. |
| `events[].time` | `string` | Always | When the change was made. |
| `events[].datacontenttype` | `"application/json"` | Always |  |
| `events[].data` | `object` | Always |  |
| `events[].data.context` | `object` | Always | Who made the change, and for whom. |
| `events[].data.context.actor` | `object` | Always | Who made the request with its own credential: a principal’s ID, `trusted_caller` for your server’s secret key, or `anonymous` before sign-in. |
| `events[].data.context.actor.id` | `string` | Always | A principal ID, `prn_…`, or one of `"trusted_caller"` or `"anonymous"`. |
| `events[].data.context.onBehalfOf` | `object` | When set | The delegator, when the actor acted under a delegation. |
| `events[].data.context.onBehalfOf.id` | `string` | Always | A principal ID, `prn_…`. |
| `events[].data.context.delegationId` | `string` | When set | The delegation the actor acted under, with a delegated token. |
| `events[].data.context.via` | `string` | Always | How the actor called: with a session, an API key, a delegated token, or your server’s secret key; `system` for IdentityHound’s own changes, such as an expiry sweep. One of `"session"`, `"api_key"`, `"delegated_token"`, `"trusted_caller"`, or `"system"`. |
| `events[].data.workspaceId` | `string` | When set | The workspace the change is in, when it is in one. |
| `next` | `number` | Always | Pass as `after` to continue. Always present. A full page gives its last event’s `seq`. A shorter page has caught up, so it gives the newest `seq` read, past any events a `types` filter skipped; `after=latest` gives the newest `seq`. |

```json title="The EventsResponse object"
{
  "events": [
    {
      "id": "01JDGKQN2M8X4C6V0B3N5T7R9W",
      "seq": 1042,
      "specversion": "1.0",
      "type": "tools.agentpost.identity.membership.added",
      "source": "/identityhound",
      "subject": "mem_01JD4CX40XT3YPEZHJ8VY0RG03",
      "time": "2026-11-05T10:12:00.000Z",
      "datacontenttype": "application/json",
      "data": {
        "context": {
          "actor": {
            "id": "prn_01JD1F7TG1SVVEHCFCS56KF78R"
          },
          "via": "session"
        },
        "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
        "membershipId": "mem_01JD4CX40XT3YPEZHJ8VY0RG03",
        "principalId": "prn_01JD1F7TG1SVVEHCFCS56KF78R",
        "principalKind": "human",
        "role": "member"
      }
    }
  ],
  "next": 1042
}
```

## Event types

`GET /events` returns these as CloudEvents. Each `type` is `tools.agentpost.identity.<name>`, and each event’s `data.context` says who acted and for whom.

-   `principal.created`
-   `principal.imported`
-   `principal.updated`
-   `principal.suspended`
-   `principal.reactivated`
-   `principal.deleted`
-   `principal.upgraded`
-   `principal.merged`
-   `auth.code_requested`
-   `auth.signed_up`
-   `auth.signed_in`
-   `auth.signed_out`
-   `session.revoked`
-   `identity.linked`
-   `identity.removed`
-   `connection.created`
-   `connection.needs_reauth`
-   `connection.token_issued`
-   `connection.removed`
-   `api_key.created`
-   `api_key.rotated`
-   `api_key.revoked`
-   `workspace.created`
-   `workspace.updated`
-   `workspace.archived`
-   `membership.added`
-   `membership.role_changed`
-   `membership.suspended`
-   `membership.reactivated`
-   `membership.removed`
-   `invitation.created`
-   `invitation.accepted`
-   `invitation.revoked`
-   `invitation.expired`
-   `project_role.assigned`
-   `project_role.removed`
-   `resource_role.assigned`
-   `resource_role.removed`
-   `resource_role.expired`
-   `delegation.requested`
-   `delegation.approved`
-   `delegation.denied`
-   `delegation.revoked`
-   `delegation.expired`
-   `delegated_token.issued`
-   `bundle.created`
-   `bundle.updated`
-   `bundle.retired`
-   `grant.created`
-   `grant.revoked`
-   `grant.expired`
-   `access.denied`
-   `config.updated`
