---
title: "IdentityHound API: Invitations"
description: "Create an invitation, list invitations, resend an invitation, revoke an invitation, preview an invitation, or accept an invitation, with the IdentityHound API."
url: "https://agentpost.tools/docs/identityhound/reference/invitations"
kind: reference
---

# Invitations

Invitations into a workspace, by email or by a code you pass on yourself. A principal previews an invitation, then accepts it.

[Workspaces](/docs/identityhound/concepts/workspaces.md#invitations) explains invitations by email and by code.

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.

## Create an invitation

`POST /workspaces/:id/invitations`

Invites someone with a role. An email invitation is emailed to the principal; a code invitation answers with its token once.

-   **Who may call:** Your server or a signed-in principal.
-   **Access:** Needs `identity.invitation:create`. Only an owner, or a trusted caller, invites an owner.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.invitations.create(workspaceId, input)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | A workspace ID, `wsp_…`. The `id` of a [`Workspace`](/docs/identityhound/reference/workspaces.md#the-workspace-object). |

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `role` | `string` | Yes | A role key from the config, such as “member”. |
| `channel` | `"email"` or `"code"` | Yes |  |
| `email` | `string` | No | An email address; up to 254 characters. |
| `openTo` | `string[]` | No | Who may accept: `["principal"]`, `["guest"]`, or both. Without it, whoever the role is open to; at least 1. Each is one of `"principal"` or `"guest"`. |

### Response

`201 Created`, with [`InvitationCreated`](/docs/identityhound/reference/invitations.md#the-invitationcreated-object).

### Errors

-   [`conflict`](/docs/identityhound/errors.md#conflict) (409)
-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`not_found`](/docs/identityhound/errors.md#not_found) (404)
-   [`role_not_assignable`](/docs/identityhound/errors.md#role_not_assignable) (422)

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

```bash tab="curl"
curl -X POST https://api.agentpost.tools/v1/identity/workspaces/wsp_01JDGKQN2K4RF0M0Z2HBASFA62/invitations \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "member",
    "channel": "email",
    "email": "grace@example.com"
  }'
```

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

const client = createClient({ token: 'sk_test_…' });
const { invitation } = await client.invitations.create(
  'wsp_01JDGKQN2K4RF0M0Z2HBASFA62',
  { role: 'member', channel: 'email', email: 'grace@example.com' },
);
```

```json title="Response"
{
  "invitation": {
    "id": "inv_01JD4S9TK4EQEZ4YB4S2GTG2BB",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "role": "member",
    "channel": "email",
    "email": "grace@example.com",
    "openTo": ["principal"],
    "status": "pending",
    "invitedBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "createdAt": "2026-11-04T11:00:00.000Z",
    "expiresAt": "2026-11-11T11:00:00.000Z"
  }
}
```

## List invitations

`GET /workspaces/:id/invitations`

A workspace’s invitations.

-   **Who may call:** Your server or a signed-in principal.
-   **Access:** Needs `identity.invitation:view`.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.invitations.list(workspaceId, query)`
-   **Pages:** `limit`, 1 to 500, default 100, with `next` and `after`. [Lists](/docs/platform/api-basics.md#lists) has the rule.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | A workspace ID, `wsp_…`. The `id` of a [`Workspace`](/docs/identityhound/reference/workspaces.md#the-workspace-object). |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | `integer` | No | 1–500; default `100`. |
| `after` | `string` | No | 1–64 characters. |
| `status` | `string` | No | One of `"pending"`, `"accepted"`, `"revoked"`, or `"expired"`. |

### Response

`200 OK`, with:

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `invitations` | [`Invitation`](/docs/identityhound/reference/invitations.md#the-invitation-object) array | Always |  |
| `next` | `string` | When set |  |

### Errors

-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (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/workspaces/wsp_01JDGKQN2K4RF0M0Z2HBASFA62/invitations?status=pending' \
  -H "Authorization: Bearer sk_test_…"
```

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

const client = createClient({ token: 'sk_test_…' });
const { invitations } = await client.invitations.list(
  'wsp_01JDGKQN2K4RF0M0Z2HBASFA62',
  { status: 'pending' },
);
```

```json title="Response"
{
  "invitations": [
    {
      "id": "inv_01JD4S9TK4EQEZ4YB4S2GTG2BB",
      "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
      "role": "member",
      "channel": "email",
      "email": "grace@example.com",
      "openTo": ["principal"],
      "status": "pending",
      "invitedBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
      "createdAt": "2026-11-04T11:00:00.000Z",
      "expiresAt": "2026-11-11T11:00:00.000Z"
    }
  ]
}
```

## Resend an invitation

`POST /invitations/:id/resend`

Sends a pending invitation again, with a new token.

-   **Who may call:** Your server or a signed-in principal.
-   **Access:** Needs `identity.invitation:resend`.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.invitations.resend(id)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | An invitation ID, `inv_…`. The `id` of a [`Invitation`](/docs/identityhound/reference/invitations.md#the-invitation-object). |

### Response

`200 OK`, with [`InvitationCreated`](/docs/identityhound/reference/invitations.md#the-invitationcreated-object).

### Errors

-   [`conflict`](/docs/identityhound/errors.md#conflict) (409)
-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`invitation_not_pending`](/docs/identityhound/errors.md#invitation_not_pending) (409)
-   [`not_found`](/docs/identityhound/errors.md#not_found) (404)

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

```bash tab="curl"
curl -X POST https://api.agentpost.tools/v1/identity/invitations/inv_01JD4S9TK4EQEZ4YB4S2GTG2BB/resend \
  -H "Authorization: Bearer sk_test_…"
```

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

const client = createClient({ token: 'sk_test_…' });
const { invitation } = await client.invitations.resend(
  'inv_01JD4S9TK4EQEZ4YB4S2GTG2BB',
);
```

```json title="Response"
{
  "invitation": {
    "id": "inv_01JD4S9TK4EQEZ4YB4S2GTG2BB",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "role": "member",
    "channel": "email",
    "email": "grace@example.com",
    "openTo": ["principal"],
    "status": "pending",
    "invitedBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "createdAt": "2026-11-04T11:00:00.000Z",
    "expiresAt": "2026-11-11T11:00:00.000Z"
  }
}
```

## Revoke an invitation

`DELETE /invitations/:id`

Revokes a pending invitation.

-   **Who may call:** Your server or a signed-in principal.
-   **Access:** Needs `identity.invitation:revoke`.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.invitations.revoke(id)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | An invitation ID, `inv_…`. The `id` of a [`Invitation`](/docs/identityhound/reference/invitations.md#the-invitation-object). |

### Response

`200 OK`, with:

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `invitation` | [`Invitation`](/docs/identityhound/reference/invitations.md#the-invitation-object) | Always |  |

### Errors

-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`invitation_not_pending`](/docs/identityhound/errors.md#invitation_not_pending) (409)
-   [`not_found`](/docs/identityhound/errors.md#not_found) (404)

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

```bash tab="curl"
curl -X DELETE https://api.agentpost.tools/v1/identity/invitations/inv_01JD4S9TK4EQEZ4YB4S2GTG2BB \
  -H "Authorization: Bearer sk_test_…"
```

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

const client = createClient({ token: 'sk_test_…' });
const { invitation } = await client.invitations.revoke(
  'inv_01JD4S9TK4EQEZ4YB4S2GTG2BB',
);
```

```json title="Response"
{
  "invitation": {
    "id": "inv_01JD4S9TK4EQEZ4YB4S2GTG2BB",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "role": "member",
    "channel": "email",
    "email": "grace@example.com",
    "openTo": ["principal"],
    "status": "revoked",
    "invitedBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "createdAt": "2026-11-04T11:00:00.000Z",
    "expiresAt": "2026-11-11T11:00:00.000Z",
    "revokedAt": "2026-11-13T09:30:00.000Z",
    "revokedBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D"
  }
}
```

## Preview an invitation

`POST /invitations/preview`

What an invitation token is for: the workspace and the role. Changes nothing.

-   **Who may call:** Your server, anyone, or a signed-in principal.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.invitations.preview(token)`
-   **Idempotency-Key:** not taken. This operation changes nothing, so IdentityHound runs it on every request and it takes no `Idempotency-Key`.

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `token` | `string` | Yes | 16–512 characters. |

### Response

`200 OK`, with [`InvitationPreviewResponse`](/docs/identityhound/reference/invitations.md#the-invitationpreviewresponse-object).

### Errors

-   [`invitation_invalid`](/docs/identityhound/errors.md#invitation_invalid) (404)
-   [`invitation_not_pending`](/docs/identityhound/errors.md#invitation_not_pending) (409)
-   [`not_found`](/docs/identityhound/errors.md#not_found) (404)

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

```bash tab="curl"
curl -X POST https://api.agentpost.tools/v1/identity/invitations/preview \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "agp_iv_your_invitation_token"
  }'
```

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

const client = createClient({ token: 'sk_test_…' });
const { invitation, workspace, invitedBy } = await client.invitations.preview(
  'agp_iv_your_invitation_token',
);
```

```json title="Response"
{
  "invitation": {
    "id": "inv_01JD4S9TK4EQEZ4YB4S2GTG2BB",
    "role": "member",
    "channel": "email",
    "email": "grace@example.com",
    "openTo": ["principal"],
    "expiresAt": "2026-11-11T11:00:00.000Z",
    "status": "pending"
  },
  "workspace": {
    "id": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "name": "Acme"
  },
  "invitedBy": {
    "id": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "displayName": "Ada Lovelace"
  }
}
```

## Accept an invitation

`POST /invitations/accept`

The signed-in principal accepts an invitation. An email invitation needs that email as a verified identity. An invitation as owner is refused past `workspaces.maxOwnedPerPrincipal`, and stays pending.

-   **Who may call:** A signed-in principal.
-   **Credential:** the examples send a signed-in principal’s session token, `agp_st_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.invitations.accept(token)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `token` | `string` | Yes | 16–512 characters. |

### Response

`200 OK`, with [`InvitationAccepted`](/docs/identityhound/reference/invitations.md#the-invitationaccepted-object).

### Errors

-   [`conflict`](/docs/identityhound/errors.md#conflict) (409)
-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`invitation_email_mismatch`](/docs/identityhound/errors.md#invitation_email_mismatch) (403)
-   [`invitation_invalid`](/docs/identityhound/errors.md#invitation_invalid) (404)
-   [`invitation_not_open`](/docs/identityhound/errors.md#invitation_not_open) (403)
-   [`invitation_not_pending`](/docs/identityhound/errors.md#invitation_not_pending) (409)
-   [`not_found`](/docs/identityhound/errors.md#not_found) (404)
-   [`workspace_limit`](/docs/identityhound/errors.md#workspace_limit) (403)
-   [`role_not_assignable`](/docs/identityhound/errors.md#role_not_assignable) (422)

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

```bash tab="curl"
curl -X POST https://api.agentpost.tools/v1/identity/invitations/accept \
  -H "Authorization: Bearer agp_st_…" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "agp_iv_your_invitation_token"
  }'
```

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

const client = createClient({ token: 'agp_st_…' });
const { membership, workspace } = await client.invitations.accept(
  'agp_iv_your_invitation_token',
);
```

```json title="Response"
{
  "membership": {
    "id": "mem_01JD4CX40XT3YPEZHJ8VY0RG03",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "principalId": "prn_01JD1F7TG1SVVEHCFCS56KF78R",
    "principalKind": "human",
    "role": "member",
    "status": "active",
    "source": "invitation",
    "invitationId": "inv_01JD4S9TK4EQEZ4YB4S2GTG2BB",
    "createdAt": "2026-11-05T10:12:00.000Z",
    "updatedAt": "2026-11-05T10:12:00.000Z"
  },
  "workspace": {
    "id": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "name": "Acme",
    "status": "active",
    "metadata": {},
    "createdAt": "2026-11-02T14:05:00.000Z",
    "createdBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "updatedAt": "2026-11-02T14:05:00.000Z"
  }
}
```

## The InvitationCreated object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `invitation` | [`Invitation`](/docs/identityhound/reference/invitations.md#the-invitation-object) | Always |  |
| `token` | `string` | When set | The code channel’s token, shown once. |

```json title="The InvitationCreated object"
{
  "invitation": {
    "id": "inv_01JD4S9TK4EQEZ4YB4S2GTG2BB",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "role": "member",
    "channel": "email",
    "email": "grace@example.com",
    "openTo": ["principal"],
    "status": "pending",
    "invitedBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "createdAt": "2026-11-04T11:00:00.000Z",
    "expiresAt": "2026-11-11T11:00:00.000Z"
  }
}
```

## The Invitation object

An invitation as the API shows it: never with its token or hash.

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `id` | `string` | Always | An invitation ID, `inv_…`. |
| `workspaceId` | `string` | Always | A workspace ID, `wsp_…`. |
| `role` | `string` | Always |  |
| `channel` | `"email"` or `"code"` | Always |  |
| `email` | `string` | When set |  |
| `openTo` | `string[]` | When set | Who may accept: `guest`, `principal` (any principal that is not a guest), or both. Without it, whoever the role is open to. Each is one of `"principal"` or `"guest"`. |
| `status` | `string` | Always | One of `"pending"`, `"accepted"`, `"revoked"`, or `"expired"`. |
| `invitedBy` | `string` | Always | A principal ID, `prn_…`, or `"trusted_caller"`. |
| `createdAt` | `string` | Always | An ISO 8601 date and time. |
| `expiresAt` | `string` | Always | An ISO 8601 date and time. |
| `acceptedBy` | `string` | When set | A principal ID, `prn_…`. |
| `acceptedAt` | `string` | When set | An ISO 8601 date and time. |
| `revokedAt` | `string` | When set | An ISO 8601 date and time. |
| `revokedBy` | `string` | When set | A principal ID, `prn_…`, or `"trusted_caller"`. |

```json title="The Invitation object"
{
  "id": "inv_01JD4S9TK4EQEZ4YB4S2GTG2BB",
  "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
  "role": "member",
  "channel": "email",
  "email": "grace@example.com",
  "openTo": ["principal"],
  "status": "pending",
  "invitedBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
  "createdAt": "2026-11-04T11:00:00.000Z",
  "expiresAt": "2026-11-11T11:00:00.000Z"
}
```

## The InvitationPreviewResponse object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `invitation` | `object` | Always |  |
| `invitation.id` | `string` | Always | An invitation ID, `inv_…`. |
| `invitation.role` | `string` | Always |  |
| `invitation.channel` | `"email"` or `"code"` | Always |  |
| `invitation.email` | `string` | When set |  |
| `invitation.openTo` | `string[]` | When set | Who may accept: `guest`, `principal` (any principal that is not a guest), or both. Without it, whoever the role is open to. Each is one of `"principal"` or `"guest"`. |
| `invitation.status` | `string` | Always | One of `"pending"`, `"accepted"`, `"revoked"`, or `"expired"`. |
| `invitation.expiresAt` | `string` | Always | An ISO 8601 date and time. |
| `workspace` | `object` | Always |  |
| `workspace.id` | `string` | Always | A workspace ID, `wsp_…`. |
| `workspace.name` | `string` | Always |  |
| `invitedBy` | `object` | When set |  |
| `invitedBy.id` | `string` | Always | A principal ID, `prn_…`. |
| `invitedBy.displayName` | `string` | When set | A supplied name, 1 to 120 characters. Your app decides what to show when absent. |
| `invitedBy.avatarUrl` | `string` | When set |  |

```json title="The InvitationPreviewResponse object"
{
  "invitation": {
    "id": "inv_01JD4S9TK4EQEZ4YB4S2GTG2BB",
    "role": "member",
    "channel": "email",
    "email": "grace@example.com",
    "openTo": ["principal"],
    "expiresAt": "2026-11-11T11:00:00.000Z",
    "status": "pending"
  },
  "workspace": {
    "id": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "name": "Acme"
  },
  "invitedBy": {
    "id": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "displayName": "Ada Lovelace"
  }
}
```

## The InvitationAccepted object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `membership` | [`Membership`](/docs/identityhound/reference/members.md#the-membership-object) | Always |  |
| `workspace` | [`Workspace`](/docs/identityhound/reference/workspaces.md#the-workspace-object) | Always |  |

```json title="The InvitationAccepted object"
{
  "membership": {
    "id": "mem_01JD4CX40XT3YPEZHJ8VY0RG03",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "principalId": "prn_01JD1F7TG1SVVEHCFCS56KF78R",
    "principalKind": "human",
    "role": "member",
    "status": "active",
    "source": "invitation",
    "invitationId": "inv_01JD4S9TK4EQEZ4YB4S2GTG2BB",
    "createdAt": "2026-11-05T10:12:00.000Z",
    "updatedAt": "2026-11-05T10:12:00.000Z"
  },
  "workspace": {
    "id": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "name": "Acme",
    "status": "active",
    "metadata": {},
    "createdAt": "2026-11-02T14:05:00.000Z",
    "createdBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "updatedAt": "2026-11-02T14:05:00.000Z"
  }
}
```
