---
title: "IdentityHound API: Delegations"
description: "Create a delegation, request a delegation, list delegations, get a delegation, approve a delegation, deny a delegation, revoke a delegation, or get a delegated token, with the IdentityHound API."
url: "https://agentpost.tools/docs/identityhound/reference/delegations"
kind: reference
---

# Delegations

Permission for one principal to act for another, within listed permissions, a workspace, and an expiry. The delegate exchanges its API key or session for short-lived delegated tokens, and every check and event keeps both identities.

[Delegations](/docs/identityhound/concepts/delegations.md) explains what a delegation allows, how delegated tokens work, and what ends them.

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 a delegation

`POST /delegations`

A principal delegates directly to another principal.

-   **Who may call:** Your server or a signed-in principal.
-   **Access:** The delegator uses its own session or API key. Your server names the delegator.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.delegations.create(input)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `delegatorId` | `string` | No | A principal ID, `prn_…`. |
| `delegateId` | `string` | Yes | A principal ID, `prn_…`. |
| `workspaceId` | `string` | No | The workspace the delegation covers. Required, unless `identity.connection:use` is its only permission. |
| `permissions` | `string[]` | Yes | Each as `<resourceType>:<action>`, with no wildcard. A delegation never grants more than the delegator holds; 1–100 items. |
| `connections` | `string[]` | No | At least 1. |
| `expiresIn` | `string` | Yes | A duration, such as “15m” or “30d”. |
| `reason` | `string` | No | Up to 1000 characters. |

### Response

`201 Created`, with:

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `delegation` | [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object) | Always |  |

### Errors

-   [`conflict`](/docs/identityhound/errors.md#conflict) (409)
-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`not_found`](/docs/identityhound/errors.md#not_found) (404)
-   [`provider_unknown`](/docs/identityhound/errors.md#provider_unknown) (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/delegations \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "delegatorId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "permissions": [
      "report:view",
      "report:edit"
    ],
    "expiresIn": "30d",
    "reason": "Draft the weekly report"
  }'
```

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

const client = createClient({ token: 'sk_test_…' });
const { delegation } = await client.delegations.create({
  delegatorId: 'prn_01JDG9X6KH1ZEF2ZWP185VMW9D',
  delegateId: 'prn_01JDWRHCP925GR1HC5AP0MCFKH',
  workspaceId: 'wsp_01JDGKQN2K4RF0M0Z2HBASFA62',
  permissions: ['report:view', 'report:edit'],
  expiresIn: '30d',
  reason: 'Draft the weekly report',
});
```

```json title="Response"
{
  "delegation": {
    "id": "dlg_01JDQYPRQ3QP4QP62W3DQZ86ME",
    "delegatorId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "permissions": ["report:view", "report:edit"],
    "status": "active",
    "reason": "Draft the weekly report",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "createdAt": "2026-11-13T09:30:00.000Z",
    "createdBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D"
  }
}
```

## Request a delegation

`POST /delegations/requests`

The delegate requests a delegation. The delegator approves or denies it. Throttled per delegate.

-   **Who may call:** A signed-in principal.
-   **Access:** The delegate, with its own session or API key.
-   **Credential:** the examples send the principal’s API key, `agp_ak_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.delegations.request(input)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `delegatorId` | `string` | Yes | A principal ID, `prn_…`. |
| `workspaceId` | `string` | No | The workspace the delegation covers. Required, unless `identity.connection:use` is its only permission. |
| `permissions` | `string[]` | Yes | Each as `<resourceType>:<action>`, with no wildcard. A delegation never grants more than the delegator holds; 1–100 items. |
| `connections` | `string[]` | No | At least 1. |
| `expiresIn` | `string` | Yes | A duration, such as “15m” or “30d”. |
| `reason` | `string` | No | Up to 1000 characters. |

### Response

`201 Created`, with:

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `delegation` | [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object) | Always |  |

### Errors

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

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/delegations/requests \
  -H "Authorization: Bearer agp_ak_…" \
  -H "Content-Type: application/json" \
  -d '{
    "delegatorId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "permissions": [
      "report:view",
      "report:edit"
    ],
    "expiresIn": "30d",
    "reason": "Draft the weekly report"
  }'
```

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

const client = createClient({ token: 'agp_ak_…' });
const { delegation } = await client.delegations.request({
  delegatorId: 'prn_01JDG9X6KH1ZEF2ZWP185VMW9D',
  workspaceId: 'wsp_01JDGKQN2K4RF0M0Z2HBASFA62',
  permissions: ['report:view', 'report:edit'],
  expiresIn: '30d',
  reason: 'Draft the weekly report',
});
```

```json title="Response"
{
  "delegation": {
    "id": "dlg_01JDQYPRQ3QP4QP62W3DQZ86ME",
    "delegatorId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "permissions": ["report:view", "report:edit"],
    "status": "requested",
    "reason": "Draft the weekly report",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "createdAt": "2026-11-13T09:30:00.000Z",
    "createdBy": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "requestedAt": "2026-11-13T09:30:00.000Z"
  }
}
```

## List delegations

`GET /delegations`

Delegations the caller gave or holds, filtered by status, delegator, or delegate.

-   **Who may call:** Your server or a signed-in principal.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.delegations.list(query)`
-   **Pages:** `limit`, 1 to 500, default 100. The answer holds up to `limit` items; narrow the query’s filters to reach others.

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `delegatorId` | `string` | No | A principal ID, `prn_…`. |
| `delegateId` | `string` | No | A principal ID, `prn_…`. |
| `workspaceId` | `string` | No | A workspace ID, `wsp_…`. |
| `status` | `string` | No | One of `"requested"`, `"active"`, `"denied"`, `"revoked"`, or `"expired"`. |
| `limit` | `integer` | No | 1–500; default `100`. |

### Response

`200 OK`, with:

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `delegations` | [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object) array | Always |  |

### 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/delegations?delegateId=prn_01JDWRHCP925GR1HC5AP0MCFKH&status=active' \
  -H "Authorization: Bearer sk_test_…"
```

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

const client = createClient({ token: 'sk_test_…' });
const { delegations } = await client.delegations.list({
  delegateId: 'prn_01JDWRHCP925GR1HC5AP0MCFKH',
  status: 'active',
});
```

```json title="Response"
{
  "delegations": [
    {
      "id": "dlg_01JDQYPRQ3QP4QP62W3DQZ86ME",
      "delegatorId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
      "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
      "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
      "permissions": ["report:view", "report:edit"],
      "status": "active",
      "reason": "Draft the weekly report",
      "expiresAt": "2026-12-13T09:30:00.000Z",
      "createdAt": "2026-11-13T09:30:00.000Z",
      "createdBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D"
    }
  ]
}
```

## Get a delegation

`GET /delegations/:id`

One delegation. A delegate that requested one reads it until its `status` is `active` or `denied`.

-   **Who may call:** Your server or a signed-in principal.
-   **Access:** Its delegator or delegate.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.delegations.get(id)`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | A delegation ID, `dlg_…`. The `id` of a [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object). |

### Response

`200 OK`, with:

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `delegation` | [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object) | Always |  |

### Errors

-   [`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 https://api.agentpost.tools/v1/identity/delegations/dlg_01JDQYPRQ3QP4QP62W3DQZ86ME \
  -H "Authorization: Bearer sk_test_…"
```

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

const client = createClient({ token: 'sk_test_…' });
const { delegation } = await client.delegations.get(
  'dlg_01JDQYPRQ3QP4QP62W3DQZ86ME',
);
```

```json title="Response"
{
  "delegation": {
    "id": "dlg_01JDQYPRQ3QP4QP62W3DQZ86ME",
    "delegatorId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "permissions": ["report:view", "report:edit"],
    "status": "active",
    "reason": "Draft the weekly report",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "createdAt": "2026-11-13T09:30:00.000Z",
    "createdBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D"
  }
}
```

## Approve a delegation

`POST /delegations/:id/approve`

Approves a requested delegation.

-   **Who may call:** Your server or a signed-in principal.
-   **Access:** Its delegator, with its own session or API key, or your server.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.delegations.approve(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 | A delegation ID, `dlg_…`. The `id` of a [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object). |

### Response

`200 OK`, with:

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `delegation` | [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object) | Always |  |

### Errors

-   [`conflict`](/docs/identityhound/errors.md#conflict) (409)
-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`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/delegations/dlg_01JDQYPRQ3QP4QP62W3DQZ86ME/approve \
  -H "Authorization: Bearer sk_test_…"
```

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

const client = createClient({ token: 'sk_test_…' });
const { delegation } = await client.delegations.approve(
  'dlg_01JDQYPRQ3QP4QP62W3DQZ86ME',
);
```

```json title="Response"
{
  "delegation": {
    "id": "dlg_01JDQYPRQ3QP4QP62W3DQZ86ME",
    "delegatorId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "permissions": ["report:view", "report:edit"],
    "status": "active",
    "reason": "Draft the weekly report",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "createdAt": "2026-11-13T09:30:00.000Z",
    "createdBy": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "requestedAt": "2026-11-13T09:30:00.000Z",
    "decidedAt": "2026-11-13T09:30:00.000Z",
    "decidedBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D"
  }
}
```

## Deny a delegation

`POST /delegations/:id/deny`

Denies a requested delegation.

-   **Who may call:** Your server or a signed-in principal.
-   **Access:** Its delegator, with its own session or API key, or your server.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.delegations.deny(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 | A delegation ID, `dlg_…`. The `id` of a [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object). |

### Response

`200 OK`, with:

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `delegation` | [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object) | Always |  |

### Errors

-   [`conflict`](/docs/identityhound/errors.md#conflict) (409)
-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`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/delegations/dlg_01JDQYPRQ3QP4QP62W3DQZ86ME/deny \
  -H "Authorization: Bearer sk_test_…"
```

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

const client = createClient({ token: 'sk_test_…' });
const { delegation } = await client.delegations.deny(
  'dlg_01JDQYPRQ3QP4QP62W3DQZ86ME',
);
```

```json title="Response"
{
  "delegation": {
    "id": "dlg_01JDQYPRQ3QP4QP62W3DQZ86ME",
    "delegatorId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "permissions": ["report:view", "report:edit"],
    "status": "denied",
    "reason": "Draft the weekly report",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "createdAt": "2026-11-13T09:30:00.000Z",
    "createdBy": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "requestedAt": "2026-11-13T09:30:00.000Z",
    "decidedAt": "2026-11-13T09:30:00.000Z",
    "decidedBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D"
  }
}
```

## Revoke a delegation

`DELETE /delegations/:id`

Revokes a delegation. Its delegated tokens and connection access stop at once.

-   **Who may call:** Your server or a signed-in principal.
-   **Access:** Its delegator or delegate, or anyone with `identity.delegation:revoke` in its workspace. Not with a delegated token.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.delegations.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 | A delegation ID, `dlg_…`. The `id` of a [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object). |

### Response

`204 No Content`, with no body.

### Errors

-   [`conflict`](/docs/identityhound/errors.md#conflict) (409)
-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`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/delegations/dlg_01JDQYPRQ3QP4QP62W3DQZ86ME \
  -H "Authorization: Bearer sk_test_…"
```

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

const client = createClient({ token: 'sk_test_…' });
await client.delegations.revoke('dlg_01JDQYPRQ3QP4QP62W3DQZ86ME');
```

```text title="Response"
204 No Content
```

## Get a delegated token

`POST /delegations/:id/tokens`

Exchanges the delegate’s API key or session for a delegated token, lasting the config’s `delegations.tokenTtl` unless `expiresIn` is shorter, and never past the delegation’s expiry. Answers `conflict` until the delegation is approved.

-   **Who may call:** A signed-in principal.
-   **Access:** The delegate, with its API key or session.
-   **Credential:** the examples send the principal’s API key, `agp_ak_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.delegations.token(id, 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 delegation ID, `dlg_…`. The `id` of a [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object). |

### Body

The body is optional.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `expiresIn` | `string` | No | A duration, such as “15m” or “30d”. |

### Response

`201 Created`, with [`DelegatedToken`](/docs/identityhound/reference/delegations.md#the-delegatedtoken-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)

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/delegations/dlg_01JDQYPRQ3QP4QP62W3DQZ86ME/tokens \
  -H "Authorization: Bearer agp_ak_…" \
  -H "Content-Type: application/json" \
  -d '{
    "expiresIn": "15m"
  }'
```

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

const client = createClient({ token: 'agp_ak_…' });
const result = await client.delegations.token(
  'dlg_01JDQYPRQ3QP4QP62W3DQZ86ME',
  { expiresIn: '15m' },
);
```

```json title="Response"
{
  "token": "agp_dt_…",
  "session": {
    "id": "ses_01JD4TCTCH1J3DXJ3N1PVAXVX2",
    "kind": "delegated",
    "principalId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "delegationId": "dlg_01JDQYPRQ3QP4QP62W3DQZ86ME",
    "authMethods": ["api_key"],
    "createdAt": "2026-11-13T09:30:00.000Z",
    "lastSeenAt": "2026-11-13T09:30:00.000Z",
    "idleExpiresAt": "2026-11-13T09:45:00.000Z",
    "expiresAt": "2026-11-13T09:45:00.000Z"
  },
  "actor": {
    "id": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "kind": "agent",
    "status": "active",
    "displayName": "Report assistant",
    "projectRoles": [],
    "description": "Drafts the weekly report",
    "metadata": {},
    "createdAt": "2026-11-06T16:40:00.000Z",
    "createdBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "updatedAt": "2026-11-06T16:40:00.000Z"
  },
  "onBehalfOf": {
    "id": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "kind": "human",
    "status": "active",
    "displayName": "Ada Lovelace",
    "projectRoles": [],
    "lastActiveAt": "2026-11-13T09:30:00.000Z",
    "metadata": {},
    "createdAt": "2026-11-02T14:05:00.000Z",
    "updatedAt": "2026-11-13T09:30:00.000Z"
  },
  "delegation": {
    "id": "dlg_01JDQYPRQ3QP4QP62W3DQZ86ME",
    "delegatorId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "permissions": ["report:view", "report:edit"],
    "status": "active",
    "reason": "Draft the weekly report",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "createdAt": "2026-11-13T09:30:00.000Z",
    "createdBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D"
  }
}
```

## The Delegation object

Permissions a delegator grants its delegate (ih\_delegations). `permissions` are concrete, never wildcards, so they can be checked against what the delegator holds. `connections` names the provider keys the delegate may fetch the delegator’s connected-account tokens for, which also needs `identity.connection:use` in `permissions`.

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `id` | `string` | Always | A delegation ID, `dlg_…`. |
| `delegatorId` | `string` | Always | A principal ID, `prn_…`. |
| `delegateId` | `string` | Always | A principal ID, `prn_…`. |
| `workspaceId` | `string` | When set | A workspace ID, `wsp_…`. |
| `permissions` | `string[]` | Always |  |
| `connections` | `string[]` | When set |  |
| `status` | `string` | Always | One of `"requested"`, `"active"`, `"denied"`, `"revoked"`, or `"expired"`. |
| `reason` | `string` | When set |  |
| `expiresAt` | `string` | Always | An ISO 8601 date and time. |
| `createdAt` | `string` | Always | An ISO 8601 date and time. |
| `createdBy` | `string` | Always | A principal ID, `prn_…`, or `"trusted_caller"`. |
| `requestedAt` | `string` | When set | An ISO 8601 date and time. |
| `decidedAt` | `string` | When set | An ISO 8601 date and time. |
| `decidedBy` | `string` | When set | A principal ID, `prn_…`, or `"trusted_caller"`. |
| `revokedAt` | `string` | When set | An ISO 8601 date and time. |
| `revokedBy` | `string` | When set | A principal ID, `prn_…`, or `"trusted_caller"`. |
| `expiredAt` | `string` | When set | An ISO 8601 date and time. |

```json title="The Delegation object"
{
  "id": "dlg_01JDQYPRQ3QP4QP62W3DQZ86ME",
  "delegatorId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
  "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
  "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
  "permissions": ["report:view", "report:edit"],
  "status": "active",
  "reason": "Draft the weekly report",
  "expiresAt": "2026-12-13T09:30:00.000Z",
  "createdAt": "2026-11-13T09:30:00.000Z",
  "createdBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D"
}
```

## The DelegatedToken object

The short-lived token the delegate uses to act for the delegator.

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `token` | `string` | Always | The bearer token. Shown once. |
| `session` | [`Session`](/docs/identityhound/reference/principals.md#the-session-object) | Always |  |
| `actor` | [`Principal`](/docs/identityhound/reference/principals.md#the-principal-object) | Always | The delegate, which makes requests with the token. |
| `onBehalfOf` | [`Principal`](/docs/identityhound/reference/principals.md#the-principal-object) | Always | The delegator the delegate acts for. |
| `delegation` | [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object) | Always |  |

```json title="The DelegatedToken object"
{
  "token": "agp_dt_…",
  "session": {
    "id": "ses_01JD4TCTCH1J3DXJ3N1PVAXVX2",
    "kind": "delegated",
    "principalId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "delegationId": "dlg_01JDQYPRQ3QP4QP62W3DQZ86ME",
    "authMethods": ["api_key"],
    "createdAt": "2026-11-13T09:30:00.000Z",
    "lastSeenAt": "2026-11-13T09:30:00.000Z",
    "idleExpiresAt": "2026-11-13T09:45:00.000Z",
    "expiresAt": "2026-11-13T09:45:00.000Z"
  },
  "actor": {
    "id": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "kind": "agent",
    "status": "active",
    "displayName": "Report assistant",
    "projectRoles": [],
    "description": "Drafts the weekly report",
    "metadata": {},
    "createdAt": "2026-11-06T16:40:00.000Z",
    "createdBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "updatedAt": "2026-11-06T16:40:00.000Z"
  },
  "onBehalfOf": {
    "id": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "kind": "human",
    "status": "active",
    "displayName": "Ada Lovelace",
    "projectRoles": [],
    "lastActiveAt": "2026-11-13T09:30:00.000Z",
    "metadata": {},
    "createdAt": "2026-11-02T14:05:00.000Z",
    "updatedAt": "2026-11-13T09:30:00.000Z"
  },
  "delegation": {
    "id": "dlg_01JDQYPRQ3QP4QP62W3DQZ86ME",
    "delegatorId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "delegateId": "prn_01JDWRHCP925GR1HC5AP0MCFKH",
    "workspaceId": "wsp_01JDGKQN2K4RF0M0Z2HBASFA62",
    "permissions": ["report:view", "report:edit"],
    "status": "active",
    "reason": "Draft the weekly report",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "createdAt": "2026-11-13T09:30:00.000Z",
    "createdBy": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D"
  }
}
```
