# Nightmail API

Send, receive and reply to email on your own domains. 202 means queued, not delivered.

- [Interactive documentation](/docs)
- [OpenAPI 3.1 JSON](/openapi.json)
- [Agent index](/llms.txt)
- TypeScript package: `@nightmail/sdk`

[API index](/docs.md) · [Feedback reference](/docs/tags/feedback.md)

## Send feedback

`POST /v1/feedback`

Tell Nightmail what got in your way while doing a task: what happened and what would have made it easier, with the request ID of a call that went wrong if you have one. Only message is needed; any other field (such as severity or kind, which an earlier version asked for) is ignored. It is filed as a support ticket for the Nightmail team, who read every one, with this credential's workspace and the key, sign-in or token that sent it. If it asks something, support answers by email to a person (whoever is behind this credential; for an API key, the workspace's owner): the answer never comes back through this call or tool, so don't wait or poll; carry on with the task.

Any credential that can read may send it (API keys, including ones limited to sender domains, agent tokens and MCP sign-ins), for its own workspace: at most 20 reports an hour from one credential and 50 from one workspace (429 FEEDBACK_RATE_LIMITED, with Retry-After). Anything in message or context that looks like a key, token or password is removed before it is stored; redacted says how many. Send one report per distinct problem.

Operation ID: `sendFeedback`

Permission: Needs Configuration: read.


### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | string | yes | What happened and what would have made it easier. Plain text. Anything that looks like a key, token or password is removed before it is stored. |
| `requestId` | string | no | The request ID of a call that went wrong: its x-request-id header, or error.requestId. |
| `operation` | string | no | The operation or MCP tool involved, such as sendEmail. |
| `context` | string | no | What you were trying to do, in a sentence or two. |

### TypeScript SDK

```ts
import { createClient } from '@nightmail/sdk/client';
import { sendFeedback } from '@nightmail/sdk';

const client = createClient({
  baseUrl: 'https://nightmail.dev',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.NIGHTMAIL_API_KEY
    : undefined,
});

const result = await sendFeedback({
  client,
  body: {
    "message": "example"
  },
  throwOnError: true,
});

console.log(result.data);
```

### cURL

```sh
curl --request POST \
  --url 'https://nightmail.dev/v1/feedback' \
  --header "Authorization: Bearer $NIGHTMAIL_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "message": "example"
}'
```

### Responses

| Status | Description | Schema |
| --- | --- | --- |
| `201` | Success | object |
| `400`, `401`, `403`, `404`, `409`, `413`, `422`, `429`, `500`, `503` | Request failed; use error.code and requestId to diagnose. | object |

#### 201: Success

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ticketId` | string | yes | The support ticket it was filed as. |
| `answer` | object | yes | Whether support answers it, and to whom: always by email to a person, never through this tool. |
| `answer.to` | string or null | yes | Who an answer is emailed to: the person behind this credential, their address masked (r•••@e•••.com), or for an API key "an owner of this workspace". Null: no answer will be sent. |
| `answer.reason` | string or null | yes | Why none will be: nobody in the workspace can get support email, or today’s answers are used up. |
| `answer.next` | string | yes | What happens now, in one sentence. Nothing more ever comes back through this call or tool. |
| `redacted` | integer | yes | How many values that looked like keys, tokens or passwords were removed from message and context. |
| `createdAt` | string | yes |  |

#### 400, 401, 403, 404, 409, 413, 422, 429, 500, 503: Request failed; use error.code and requestId to diagnose.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | object | yes |  |
| `error.code` | string | yes |  |
| `error.message` | string | yes |  |
| `error.requestId` | string | yes |  |
| `error.field` | string | no |  |
| `error.retryable` | boolean | yes |  |
| `error.resetAt` | string | no | Next capacity change for a Hosted rolling send limit. |
| `error.details` | object[] | no | Every problem found, when there is more than one part, such as rule diagnostics with rule, line, column, message and hint, or a measurement, such as CONTENT_TOO_LARGE_TO_SCREEN with screenedBytes and limitBytes (and index in a batch). |
| `error.required` | object | no | On a 403 permission refusal: what the request needs that this credential lacks. The Nightmail-Required-Permission header says the same. |
