---
title: "IdentityHound API: Sign-in"
description: "Send a sign-in code, verify a sign-in code, start an OAuth flow, finish an OAuth flow, start a guest session, sign out, or introspect a token, with the IdentityHound API."
url: "https://agentpost.tools/docs/identityhound/reference/auth"
kind: reference
---

# Sign-in

Emailed codes, OAuth providers, guests, sign-out, and introspection. The session-start operations, and an invitation’s preview, are the only ones a publishable key reaches.

[Sessions](/docs/identityhound/concepts/sessions.md) explains how a sign-in starts a session, how long it lasts, and what ends it.

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.

## Send a sign-in code

`POST /auth/email-code`

Sends a 6-digit sign-in code to an email address that has an account or that the sign-up mode lets in. Always answers 202 the same way, so the answer never says which.

-   **Who may call:** Your server or anyone.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.auth.requestCode(input)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `email` | `string` | Yes | An email address; up to 254 characters. |

### Response

`202 Accepted`, with [`CodeRequested`](/docs/identityhound/reference/auth.md#the-coderequested-object).

### Errors

-   [`sign_in_disabled`](/docs/identityhound/errors.md#sign_in_disabled) (403)
-   [`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/auth/email-code \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "ada@example.com"
  }'
```

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

const client = createClient({ token: 'sk_test_…' });
const { verificationId, resendAfter } = await client.auth.requestCode({
  email: 'ada@example.com',
});
```

```json title="Response"
{
  "verificationId": "ver_01JDCXQVC1YRR68NC4NQ58DM0A",
  "resendAfter": 30
}
```

## Verify a sign-in code

`POST /auth/email-code/verify`

Checks the code and signs the principal in, or signs it up when the sign-up mode allows. Answers with a session token, shown once.

-   **Who may call:** Your server or anyone.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.auth.verifyCode(input)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `email` | `string` | Yes | An email address; up to 254 characters. |
| `code` | `string` | Yes | The 6-digit code from the email. |
| `verificationId` | `string` | Yes | The verificationId the code request returned. |
| `kind` | `string` | No | A label the principal chooses for itself. Omit it to leave the kind unset. Roles, grants, and invitations treat every kind alike. One of `"human"`, `"agent"`, or `"service"`. |

### Response

`200 OK`, with [`SessionGrant`](/docs/identityhound/reference/auth.md#the-sessiongrant-object).

### Errors

-   [`code_expired`](/docs/identityhound/errors.md#code_expired) (400)
-   [`code_invalid`](/docs/identityhound/errors.md#code_invalid) (400)
-   [`conflict`](/docs/identityhound/errors.md#conflict) (409)
-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`identity_in_use`](/docs/identityhound/errors.md#identity_in_use) (409)
-   [`not_found`](/docs/identityhound/errors.md#not_found) (404)
-   [`sign_up_closed`](/docs/identityhound/errors.md#sign_up_closed) (403)
-   [`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/auth/email-code/verify \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "ada@example.com",
    "code": "123456",
    "verificationId": "ver_01JDCXQVC1YRR68NC4NQ58DM0A"
  }'
```

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

const client = createClient({ token: 'sk_test_…' });
const result = await client.auth.verifyCode({
  email: 'ada@example.com',
  code: '123456',
  verificationId: 'ver_01JDCXQVC1YRR68NC4NQ58DM0A',
});
```

```json title="Response"
{
  "token": "agp_st_…",
  "session": {
    "id": "ses_01JD2EQP0GCGZMSCG7GMDVCFJ6",
    "kind": "direct",
    "principalId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "authMethods": ["email_code"],
    "client": {
      "ip": "203.0.113.24",
      "userAgent": "Mozilla/5.0",
      "platform": "web"
    },
    "createdAt": "2026-11-13T09:30:00.000Z",
    "lastSeenAt": "2026-11-13T09:30:00.000Z",
    "idleExpiresAt": "2026-11-20T09:30:00.000Z",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "current": true
  },
  "principal": {
    "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"
  },
  "signedUp": false
}
```

## Start an OAuth flow

`POST /auth/oauth/:providerKey/start`

Starts an OAuth flow with a configured provider. Answers with the provider’s authorize URL. `returnTo` must match a configured URL. With `purpose: sign_in`, set `connect: true` to also save this app’s connection. Connecting requests the app’s `connectScopes` and any extra `scopes`; sign-in also requests `signInScopes`. To keep what the principal’s other connections for this app hold, list them and pass their `scopes`.

-   **Who may call:** Your server, anyone, or a signed-in principal.
-   **Access:** Signing in needs no credential. Linking or connecting an account needs the signed-in principal.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.auth.oauthStart(providerKey, input)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `providerKey` | `string` | Yes | A provider key: a key of the config’s `signIn.providers`, such as `twitch`. |

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `string` | No | A label the principal chooses for itself. Omit it to leave the kind unset. Roles, grants, and invitations treat every kind alike. One of `"human"`, `"agent"`, or `"service"`. |
| `purpose` | `string` | Yes | One of `"sign_in"`, `"link"`, or `"connect"`. |
| `returnTo` | `string` | Yes | A URL. |
| `scopes` | `string[]` | No |  |
| `connect` | `boolean` | No | With sign\_in, also save a connection for this provider app. |
| `binding` | `string` | No | 1–256 characters. |

### Response

`200 OK`, with [`OAuthStartResponse`](/docs/identityhound/reference/auth.md#the-oauthstartresponse-object).

### Errors

-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`not_found`](/docs/identityhound/errors.md#not_found) (404)
-   [`provider_disabled`](/docs/identityhound/errors.md#provider_disabled) (403)
-   [`provider_unknown`](/docs/identityhound/errors.md#provider_unknown) (404)
-   [`return_to_not_allowed`](/docs/identityhound/errors.md#return_to_not_allowed) (400)
-   [`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/auth/oauth/twitch/start \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "purpose": "sign_in",
    "returnTo": "https://app.example.com/auth/callback"
  }'
```

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

const client = createClient({ token: 'sk_test_…' });
const { authorizeUrl, state, expiresAt } = await client.auth.oauthStart(
  'twitch',
  { purpose: 'sign_in', returnTo: 'https://app.example.com/auth/callback' },
);
```

```json title="Response"
{
  "authorizeUrl": "https://id.twitch.tv/oauth2/authorize?client_id=your_client_id&response_type=code&scope=user%3Aread%3Aemail&state=…",
  "state": "oauth_state_…",
  "expiresAt": "2026-11-13T09:40:00.000Z"
}
```

## Finish an OAuth flow

`POST /auth/oauth/:providerKey/callback`

Finishes an OAuth flow with the provider’s `code` and `state`. Signs in, links an identity, or connects an account, depending on how the flow started. A sign-in started with `connect: true` also answers with its connection. If an existing connection needs more scopes, answers with `purpose: reauthorize` with a fresh authorize URL and state, without changing the connection or issuing a session. Send the browser to that URL, authorize the same provider account, and post the new code and state here with the original binding and credential. Repeat until the original purpose completes.

-   **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.auth.oauthCallback(providerKey, input)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `providerKey` | `string` | Yes | A provider key: a key of the config’s `signIn.providers`, such as `twitch`. |

### Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | `string` | Yes |  |
| `state` | `string` | Yes |  |
| `binding` | `string` | No | 1–256 characters. |

### Response

`200 OK`, with [`OAuthCallbackResponse`](/docs/identityhound/reference/auth.md#the-oauthcallbackresponse-object).

### Errors

-   [`conflict`](/docs/identityhound/errors.md#conflict) (409)
-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`identity_in_use`](/docs/identityhound/errors.md#identity_in_use) (409)
-   [`not_found`](/docs/identityhound/errors.md#not_found) (404)
-   [`oauth_state_invalid`](/docs/identityhound/errors.md#oauth_state_invalid) (400)
-   [`provider_disabled`](/docs/identityhound/errors.md#provider_disabled) (403)
-   [`provider_error`](/docs/identityhound/errors.md#provider_error) (502)
-   [`provider_unknown`](/docs/identityhound/errors.md#provider_unknown) (404)
-   [`sign_up_closed`](/docs/identityhound/errors.md#sign_up_closed) (403)

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/auth/oauth/twitch/callback \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "provider_code_…",
    "state": "oauth_state_…"
  }'
```

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

const client = createClient({ token: 'sk_test_…' });
const result = await client.auth.oauthCallback('twitch', {
  code: 'provider_code_…',
  state: 'oauth_state_…',
});
```

```json title="Response"
{
  "purpose": "sign_in",
  "token": "agp_st_…",
  "session": {
    "id": "ses_01JD2EQP0GCGZMSCG7GMDVCFJ6",
    "kind": "direct",
    "principalId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "authMethods": ["email_code"],
    "client": {
      "ip": "203.0.113.24",
      "userAgent": "Mozilla/5.0",
      "platform": "web"
    },
    "createdAt": "2026-11-13T09:30:00.000Z",
    "lastSeenAt": "2026-11-13T09:30:00.000Z",
    "idleExpiresAt": "2026-11-20T09:30:00.000Z",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "current": true
  },
  "principal": {
    "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"
  },
  "signedUp": false
}
```

## Start a guest session

`POST /auth/guest`

Creates a guest principal and its session, when the project allows guests. Throttled per IP.

-   **Who may call:** Your server or anyone.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.auth.startGuest(input)`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Body

The body is optional.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `displayName` | `string` | No | 1–120 characters. |

### Response

`201 Created`, with [`SessionGrant`](/docs/identityhound/reference/auth.md#the-sessiongrant-object).

### Errors

-   [`conflict`](/docs/identityhound/errors.md#conflict) (409)
-   [`forbidden`](/docs/identityhound/errors.md#forbidden) (403)
-   [`guest_limit`](/docs/identityhound/errors.md#guest_limit) (429)
-   [`guests_disabled`](/docs/identityhound/errors.md#guests_disabled) (403)
-   [`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/auth/guest \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "displayName": "Visitor"
  }'
```

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

const client = createClient({ token: 'sk_test_…' });
const result = await client.auth.startGuest({ displayName: 'Visitor' });
```

```json title="Response"
{
  "token": "agp_st_…",
  "session": {
    "id": "ses_01JD2EQP0GCGZMSCG7GMDVCFJ6",
    "kind": "direct",
    "principalId": "prn_01JD8B49FTM5GZ9SVD3SRG7TKD",
    "authMethods": ["guest"],
    "client": {
      "ip": "203.0.113.24",
      "userAgent": "Mozilla/5.0",
      "platform": "web"
    },
    "createdAt": "2026-11-13T09:30:00.000Z",
    "lastSeenAt": "2026-11-13T09:30:00.000Z",
    "idleExpiresAt": "2026-11-20T09:30:00.000Z",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "current": true
  },
  "principal": {
    "id": "prn_01JD8B49FTM5GZ9SVD3SRG7TKD",
    "kind": "guest",
    "status": "active",
    "displayName": "Visitor",
    "projectRoles": [],
    "guest": {
      "createdIp": "203.0.113.24"
    },
    "metadata": {},
    "createdAt": "2026-11-13T09:30:00.000Z",
    "updatedAt": "2026-11-13T09:30:00.000Z"
  },
  "signedUp": true
}
```

## Sign out

`POST /auth/sign-out`

Revokes the session or delegated token the call is made with.

-   **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.auth.signOut()`
-   **Idempotency-Key:** optional. [Retrying a write](/docs/platform/api-basics.md#retrying-a-write) has the rule.

### Response

`204 No Content`, with no body.

### 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 -X POST https://api.agentpost.tools/v1/identity/auth/sign-out \
  -H "Authorization: Bearer agp_st_…"
```

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

const client = createClient({ token: 'agp_st_…' });
await client.auth.signOut();
```

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

## Introspect a token

`POST /auth/introspect`

Says whether a session, API key, or delegated token is active, and who it acts for. `verifyRequest` in the SDK calls this. It counts as using the token, as a call made with it does: the idle limit of a session or delegated token moves forward, at most once a minute. So a server that checks the token on each request keeps the session alive while it is in use.

-   **Who may call:** Your server.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.
-   **SDK:** `client.auth.introspect(token)`
-   **Idempotency-Key:** not taken. A retry only checks the token again, 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 [`IntrospectResponse`](/docs/identityhound/reference/auth.md#the-introspectresponse-object).

### Errors

-   [`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 -X POST https://api.agentpost.tools/v1/identity/auth/introspect \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "agp_st_your_session_token"
  }'
```

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

const client = createClient({ token: 'sk_test_…' });
const result = await client.auth.introspect('agp_st_your_session_token');
```

```json title="Response"
{
  "active": true,
  "credential": {
    "kind": "session",
    "id": "ses_01JD2EQP0GCGZMSCG7GMDVCFJ6"
  },
  "actor": {
    "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"
  },
  "session": {
    "id": "ses_01JD2EQP0GCGZMSCG7GMDVCFJ6",
    "kind": "direct",
    "principalId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "authMethods": ["email_code"],
    "client": {
      "ip": "203.0.113.24",
      "userAgent": "Mozilla/5.0",
      "platform": "web"
    },
    "createdAt": "2026-11-13T09:30:00.000Z",
    "lastSeenAt": "2026-11-13T09:30:00.000Z",
    "idleExpiresAt": "2026-11-20T09:30:00.000Z",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "current": true
  }
}
```

## The CodeRequested object

A code request’s answer. It is the same whether or not the address gets a code.

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `verificationId` | `string` | Always | Send it back with the code. A request for the same address before `resendAfter` runs out sends no new code and answers with this same ID. |
| `resendAfter` | `number` | Always | Whole seconds until a request for the same address sends a new code. A request that sends one answers with the config’s `signIn.emailCode.resendAfter` in seconds: `"30s"` answers `30`. A request within that window answers with the seconds left. |

```json title="The CodeRequested object"
{
  "verificationId": "ver_01JDCXQVC1YRR68NC4NQ58DM0A",
  "resendAfter": 30
}
```

## The SessionGrant object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `token` | `string` | Always | The bearer token. Shown once. |
| `session` | [`Session`](/docs/identityhound/reference/principals.md#the-session-object) | Always |  |
| `principal` | [`Principal`](/docs/identityhound/reference/principals.md#the-principal-object) | Always |  |
| `signedUp` | `boolean` | Always | True when this sign-in created the principal. |

```json title="The SessionGrant object"
{
  "token": "agp_st_…",
  "session": {
    "id": "ses_01JD2EQP0GCGZMSCG7GMDVCFJ6",
    "kind": "direct",
    "principalId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "authMethods": ["email_code"],
    "client": {
      "ip": "203.0.113.24",
      "userAgent": "Mozilla/5.0",
      "platform": "web"
    },
    "createdAt": "2026-11-13T09:30:00.000Z",
    "lastSeenAt": "2026-11-13T09:30:00.000Z",
    "idleExpiresAt": "2026-11-20T09:30:00.000Z",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "current": true
  },
  "principal": {
    "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"
  },
  "signedUp": false
}
```

## The OAuthStartResponse object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `authorizeUrl` | `string` | Always |  |
| `state` | `string` | Always |  |
| `expiresAt` | `string` | Always |  |

```json title="The OAuthStartResponse object"
{
  "authorizeUrl": "https://id.twitch.tv/oauth2/authorize?client_id=your_client_id&response_type=code&scope=user%3Aread%3Aemail&state=…",
  "state": "oauth_state_…",
  "expiresAt": "2026-11-13T09:40:00.000Z"
}
```

## The OAuthCallbackResponse object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `purpose` | `string` | Always | One of `"sign_in"`, `"reauthorize"`, `"link"`, or `"connect"`. |
| `connection` | [`Connection`](/docs/identityhound/reference/connections.md#the-connection-object) | When set | With `purpose: "sign_in"` or `purpose: "connect"`. |
| `token` | `string` | When set | With `purpose: "sign_in"`. The bearer token. Shown once. |
| `session` | [`Session`](/docs/identityhound/reference/principals.md#the-session-object) | When set | With `purpose: "sign_in"`. |
| `principal` | [`Principal`](/docs/identityhound/reference/principals.md#the-principal-object) | When set | With `purpose: "sign_in"` or `purpose: "link"`. |
| `signedUp` | `boolean` | When set | With `purpose: "sign_in"`. True when this sign-in created the principal. |
| `authorizeUrl` | `string` | When set | With `purpose: "reauthorize"`. |
| `state` | `string` | When set | With `purpose: "reauthorize"`. |
| `expiresAt` | `string` | When set | With `purpose: "reauthorize"`. |
| `identity` | [`Identity`](/docs/identityhound/reference/me.md#the-identity-object) | When set | With `purpose: "link"`. |

```json title="The OAuthCallbackResponse object"
{
  "purpose": "sign_in",
  "token": "agp_st_…",
  "session": {
    "id": "ses_01JD2EQP0GCGZMSCG7GMDVCFJ6",
    "kind": "direct",
    "principalId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "authMethods": ["email_code"],
    "client": {
      "ip": "203.0.113.24",
      "userAgent": "Mozilla/5.0",
      "platform": "web"
    },
    "createdAt": "2026-11-13T09:30:00.000Z",
    "lastSeenAt": "2026-11-13T09:30:00.000Z",
    "idleExpiresAt": "2026-11-20T09:30:00.000Z",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "current": true
  },
  "principal": {
    "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"
  },
  "signedUp": false
}
```

## The IntrospectResponse object

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `active` | `boolean` | Always |  |
| `credential` | `object` | When set |  |
| `credential.kind` | `string` | Always | One of `"session"`, `"api_key"`, or `"delegated_token"`. |
| `credential.id` | `string` | Always |  |
| `actor` | [`Principal`](/docs/identityhound/reference/principals.md#the-principal-object) | When set | The principal that holds the credential and makes requests with it. |
| `onBehalfOf` | [`Principal`](/docs/identityhound/reference/principals.md#the-principal-object) | When set | The delegator, for a delegated token. Authority comes from it, within the delegation. |
| `delegation` | [`Delegation`](/docs/identityhound/reference/delegations.md#the-delegation-object) | When set |  |
| `restrictions` | `object` | When set |  |
| `restrictions.workspaceIds` | `string[]` | When set |  |
| `restrictions.permissions` | `string[]` | When set |  |
| `session` | [`Session`](/docs/identityhound/reference/principals.md#the-session-object) | When set |  |

```json title="The IntrospectResponse object"
{
  "active": true,
  "credential": {
    "kind": "session",
    "id": "ses_01JD2EQP0GCGZMSCG7GMDVCFJ6"
  },
  "actor": {
    "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"
  },
  "session": {
    "id": "ses_01JD2EQP0GCGZMSCG7GMDVCFJ6",
    "kind": "direct",
    "principalId": "prn_01JDG9X6KH1ZEF2ZWP185VMW9D",
    "authMethods": ["email_code"],
    "client": {
      "ip": "203.0.113.24",
      "userAgent": "Mozilla/5.0",
      "platform": "web"
    },
    "createdAt": "2026-11-13T09:30:00.000Z",
    "lastSeenAt": "2026-11-13T09:30:00.000Z",
    "idleExpiresAt": "2026-11-20T09:30:00.000Z",
    "expiresAt": "2026-12-13T09:30:00.000Z",
    "current": true
  }
}
```
