# Test inbox

Messages · PassBook API reference. Authenticate with `Authorization: Bearer $PASSBOOK_KEY`.

## List captured test emails, newest first {#list}

`GET /api/v1/test-inbox`

Lists emails captured in Test mode, newest first. Nothing is sent to the recipient.

Scopes: `passes:read`. SDK name: `pb.testEmails.list`.

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | string · max 512 |  |  |
| `limit` | query | integer · ≥ 1 · ≤ 200 |  |  |

Returns `200`, a `CapturedEmailPage`.

| Code | Status | Fix |
| --- | --- | --- |
| `CAPTURED_EMAIL_NOT_FOUND` |  | List emails with GET /api/v1/test-inbox and use an id from the result. |
| `FORBIDDEN` |  | Use a key with the scope the operation lists, or ask an org admin. |
| `INVALID_API_KEY` |  | Create a new key in the console and update PASSBOOK_KEY. |
| `MISSING_SCOPE` |  | Create a key with the scope the operation lists under security. |
| `NO_VERIFIED_EMAIL` |  | Verify an email address on the account, then send again. |
| `RATE_LIMITED` |  | Wait for Retry-After seconds, then retry. Back off on repeats. |
| `SANDBOX_PREVIEW_ONLY` |  | Use the preview card and QR in the console; live passes need a real organization. |
| `SANDBOX_QUOTA` |  | Delete test objects you no longer need, or move to an organization with live access. |
| `SESSION_REQUIRED` |  | Do it in the console, or sign in as the account that started it. |
| `TEST_FORWARD_ALREADY_ATTEMPTED` |  | Do not send it again; check your inbox first. |
| `TEST_FORWARD_CHANGED` |  | Send it to yourself again. |
| `TEST_FORWARD_OUTCOME_UNKNOWN` |  | Do not send this message again. |
| `TEST_FORWARD_PREPARATION_FAILED` |  | Nothing was sent. |
| `TEST_KEY_REQUIRED` |  | Use a key that starts with pb_test_. |
| `UNAUTHENTICATED` |  | Send Authorization: Bearer $PASSBOOK_KEY. |
| `VALIDATION` |  | Fix each field in issues and resend. |

```sh
curl -X GET "https://passbook.mobile/api/v1/test-inbox?limit=25" \
  -H "Authorization: Bearer $PASSBOOK_KEY"
```

Response example:

```json
{
  "items": [
    {
      "id": "0193a1b2-7c00-7000-8000-000000000101",
      "orgId": "0193a1b2-7c00-7000-8000-0000000000a1",
      "kind": "pass",
      "passId": "0193a1b2-7c00-7000-8000-0000000000c1",
      "bundleId": null,
      "to": "ada@example.com",
      "subject": "Your ticket to Example Events",
      "attached": true,
      "createdAt": 1764000000000
    }
  ],
  "nextCursor": null
}
```

## One captured email with its HTML and text {#retrieve}

`GET /api/v1/test-inbox/{id}`

One captured email with its HTML and text.

Scopes: `passes:read`. SDK name: `pb.testEmails.retrieve`.

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string · max 64 | yes |  |
| `mode` | query | "live" \| "test" |  |  |

Returns `200`, a `CapturedEmailDetail`.

| Code | Status | Fix |
| --- | --- | --- |
| `CAPTURED_EMAIL_NOT_FOUND` |  | List emails with GET /api/v1/test-inbox and use an id from the result. |
| `FORBIDDEN` |  | Use a key with the scope the operation lists, or ask an org admin. |
| `INVALID_API_KEY` |  | Create a new key in the console and update PASSBOOK_KEY. |
| `MISSING_SCOPE` |  | Create a key with the scope the operation lists under security. |
| `NOT_FOUND` |  | Check the id, and that the key's mode (test or live) matches the object. |
| `NO_VERIFIED_EMAIL` |  | Verify an email address on the account, then send again. |
| `RATE_LIMITED` |  | Wait for Retry-After seconds, then retry. Back off on repeats. |
| `SANDBOX_PREVIEW_ONLY` |  | Use the preview card and QR in the console; live passes need a real organization. |
| `SANDBOX_QUOTA` |  | Delete test objects you no longer need, or move to an organization with live access. |
| `SESSION_REQUIRED` |  | Do it in the console, or sign in as the account that started it. |
| `TEST_FORWARD_ALREADY_ATTEMPTED` |  | Do not send it again; check your inbox first. |
| `TEST_FORWARD_CHANGED` |  | Send it to yourself again. |
| `TEST_FORWARD_OUTCOME_UNKNOWN` |  | Do not send this message again. |
| `TEST_FORWARD_PREPARATION_FAILED` |  | Nothing was sent. |
| `TEST_KEY_REQUIRED` |  | Use a key that starts with pb_test_. |
| `UNAUTHENTICATED` |  | Send Authorization: Bearer $PASSBOOK_KEY. |
| `VALIDATION` |  | Fix each field in issues and resend. |

```sh
curl -X GET "https://passbook.mobile/api/v1/test-inbox/0193a1b2-7c00-7000-8000-0000000000e1" \
  -H "Authorization: Bearer $PASSBOOK_KEY"
```

Response example:

```json
{
  "id": "0193a1b2-7c00-7000-8000-000000000101",
  "orgId": "0193a1b2-7c00-7000-8000-0000000000a1",
  "kind": "pass",
  "passId": "0193a1b2-7c00-7000-8000-0000000000c1",
  "bundleId": null,
  "to": "ada@example.com",
  "subject": "Your ticket to Example Events",
  "attached": true,
  "createdAt": 1764000000000,
  "html": "<p>Your ticket is ready.</p>",
  "text": "Your ticket is ready.",
  "forwarding": "none"
}
```
