---
title: "API reference"
url: "https://inboxnight.com/docs/api.md"
canonical_url: "https://inboxnight.com/docs/api"
last_updated: "2026-10-22"
type: "reference"
summary: "The InboxNight API: route groups, how requests are authenticated, scheduled jobs and what the API never exposes."
related: ["https://inboxnight.com/docs/errors.md", "https://inboxnight.com/docs/privacy-and-data.md"]
---

# API reference

> **For AI agents:** the complete index of InboxNight pages is [llms.txt](https://inboxnight.com/llms.txt). Every page is also served as markdown at its URL plus .md.

The InboxNight API: route groups, how requests are authenticated, scheduled jobs and what the API never exposes.

> **API keys are issued on request: email hello@inboxnight.com.** This page describes how the API works.

The API is JSON over HTTPS. It exists first to serve the InboxNight app itself. Every request body is JSON and at most 64 KB, times are ISO 8601 strings and money is whole US cents.

## Route groups

| Group | What it covers |
| --- | --- |
| Plans | `GET /v1/plans` lists the plans and their limits. It needs no key. |
| Account | `GET /v1/account` reads the account, its plan, inbox counts and keys. `PATCH /v1/account/settings` changes the timezone, the roundup hour and the roundup email switch. `GET /v1/usage` reads triaged counts per inbox for the month and model usage. |
| Inboxes | `GET /v1/inboxes` and `GET /v1/inboxes/:id` read inboxes. `DELETE /v1/inboxes/:id` disconnects one. `POST /v1/inboxes/:id/sync` is Sync now. |
| Rules | `GET` and `POST /v1/rules`, `PATCH` and `DELETE /v1/rules/:id`; `PUT /v1/rules/order` sets the order; `POST /v1/rules/test` previews a draft on recent mail without acting on anything. |
| Labels | `GET` and `POST /v1/labels`, and `DELETE /v1/labels/:id`. A label is refused for deletion while a rule uses it. |
| Activity | `GET /v1/activity` lists entries with filters and paging. `POST /v1/activity/:id/undo` undoes one entry. |
| Roundup | `GET /v1/roundup` reads the latest roundup, `POST /v1/roundup/build` builds today's, and `POST /v1/roundup/:id/send` emails one to the account address. |
| Suggestions | `GET /v1/suggestions` lists habit suggestions. `POST /v1/suggestions/:id/accept` turns one into a rule and `POST /v1/suggestions/:id/dismiss` dismisses it. |
| Unsubscribe | `GET` and `POST /unsubscribe/:token` are the roundup email's one-click unsubscribe. They need no sign-in. |

## Signing in

- Most routes take an API key in `Authorization: Bearer <key>` or `X-API-Key: <key>`. Keys start with `in_live_`. Every per-account route is scoped to the account that owns the key. An id that belongs to another account answers 404, exactly like an id that does not exist.
- Rate limits are applied per key, or per account for a signed-in session, and shown in `X-RateLimit-*` headers. On HTTP 429 wait the number of seconds in `Retry-After`.

## Scheduled work

There are no cron routes on the API. The checking of inboxes and the morning roundup run as two scheduled jobs:

| Job | How often | What it does |
| --- | --- | --- |
| `inboxnight-patrol` | Every 5 minutes | Applies each account's plan to its inboxes, then checks every connected inbox for new mail and applies the rules. Habit suggestions are refreshed in the same pass. |
| `inboxnight-roundups` | Every 15 minutes | Builds each account's roundup once per local day and sends the email once. |

Both jobs are safe to repeat: an inbox is read only when it is due and a roundup is sent once.

## What the API will never expose

- No unauthenticated endpoint sends mail or reads a mailbox. Acting on a Gmail inbox happens only after Google consent, for the account that gave it.
- No endpoint sends mail on a caller's behalf directly. The only mail sent from a connected inbox is what the rules the user wrote ask for, a forward or an AI-written reply.
- Tokens are never returned by any endpoint.

## Errors

Failures use one error envelope with stable codes you can branch on. A service that is not configured answers 503 `provider_unavailable`. The full list of codes is in [Errors and states](https://inboxnight.com/docs/errors.md).

For how the connection works, see [Connect Gmail](https://inboxnight.com/docs/connect-gmail.md). For what data is handled, see [Privacy and data](https://inboxnight.com/docs/privacy-and-data.md).

## Related

- [Errors and states](https://inboxnight.com/docs/errors.md)
- [Privacy and data](https://inboxnight.com/docs/privacy-and-data.md)
