---
title: "Platform API: Test inbox"
description: "Read the test inbox, with the Agentpost API."
url: "https://agentpost.tools/docs/platform/reference/test-inbox"
kind: reference
---

# Test inbox

In a `dev` environment, a project’s email to an address at `.test`, such as a sign-in code, waits here for an hour instead of being sent, so tests and agents sign in with made-up addresses and no mailbox. Agentpost’s own email, such as a workspace invitation, is always sent to its address.

Paths are from `https://api.agentpost.tools`, and every route follows the [API basics](/docs/platform/api-basics.md). The examples send the first credential the route takes; [Credentials](/docs/platform/concepts/credentials.md) explains each one.

## Read the test inbox

`GET /v1/test-inbox`

The project’s `dev` messages from the last hour, oldest first, at most the newest 100.

-   **Who may call:** Your server, with a secret key.
-   **Access:** The project’s `dev` secret key, `sk_test_…`, only.
-   **Credential:** the examples send your project’s `dev` secret key, `sk_test_…`, as `Authorization: Bearer <token>`.

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `to` | `string` | No | Only the messages to this address. |

### Response

`200 OK`, with:

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `messages` | [`TestMessage`](/docs/platform/reference/test-inbox.md#the-testmessage-object) array | Always |  |

### Errors

-   [`forbidden`](/docs/errors.md#forbidden) (403)

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

```bash tab="curl"
curl 'https://api.agentpost.tools/v1/test-inbox?to=ada%40example.test' \
  -H "Authorization: Bearer sk_test_…"
```

```json title="Response"
{
  "messages": [
    {
      "template": "sign_in_code",
      "to": "ada@example.test",
      "data": {
        "code": "123456"
      },
      "at": "2026-11-13T09:30:00.000Z"
    }
  ]
}
```

## The TestMessage object

A message a `dev` environment sent to a `.test` address.

| Name | Type | Present | Description |
| --- | --- | --- | --- |
| `template` | `string` | Always | What the message is, such as `sign_in_code` or `invitation`. |
| `to` | `string` | Always | Lowercased. |
| `data` | `object` | Always | The message’s fields, such as `code` or `link`. |
| `at` | `string` | Always | An ISO 8601 date and time. |

```json title="The TestMessage object"
{
  "template": "sign_in_code",
  "to": "ada@example.test",
  "data": {
    "code": "123456"
  },
  "at": "2026-11-13T09:30:00.000Z"
}
```
