---
title: Sign in to apps with an inbox
description: Let an inbox sign in to a third-party app as itself through BillionSend's OpenID Connect issuer, with no password and no access to the inbox's mail.
---

An inbox can sign in to a third-party app as itself. The app treats BillionSend like any OpenID Connect provider (authorization code flow with PKCE, ES256-signed tokens) and learns which inbox it is talking to, never anything inside it. The inbox approves each sign-in with its own API key, so an agent needs no password and no browser storage.

Signing in is **off for every inbox** until a person turns it on, and a team nobody has [claimed](/docs/agent-signup) cannot use it.

## Turn it on

In the dashboard, open the inbox's **Settings** and use **Sign in to apps**. Over REST, call `PATCH /inboxes/{inbox_id}/identity`:

```sh
curl -X PATCH "https://api.billionsend.com/inboxes/$INBOX_ID/identity" \
  -H "Authorization: Bearer $BILLIONSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "enabled": true, "allowed_clients": ["https://app.example.com"] }'
```

`allowed_clients` lists the apps (the `client_id` each one sends, an https address) the inbox may sign in to. Left empty, any app is allowed. An inbox-scoped key can read these settings with `GET /inboxes/{inbox_id}/identity` but cannot change them: an inbox never switches its own sign-in on.

## How a sign-in runs

1. The app sends the browser (or HTTP client) to the issuer's authorization endpoint with a standard authorization code request.
2. The issuer shows a waiting page with an `auth_token`. A client that sends `Accept: application/json` receives the same facts as an object, including the `poll_secret` only it holds.
3. The inbox approves with its own key: `POST /inboxes/{inbox_id}/identity/authorize` with `{ "auth_token": "...", "client_id": "https://app.example.com" }`. The `client_id` must be the app the sign-in was started for.
4. The browser that started the sign-in continues to the app by itself, carrying a one-time code that is valid for 60 seconds.
5. The app's server exchanges the code at the token endpoint and receives an ID token and an access token.

Only approve an `auth_token` you read from your own browser session. A token somebody else hands you, in an email or a message, signs them in as your inbox.

## For apps

The issuer is `https://billionsend.com/identity`. Point any OpenID Connect library at it; discovery is at `https://billionsend.com/identity/.well-known/openid-configuration`.

| | |
| --- | --- |
| Flow | Authorization code with PKCE (`S256` only); public clients, no client secret |
| `client_id` | An https address the app controls, with no port, query or fragment. No registration |
| `redirect_uri` | https, on the same site as the `client_id` |
| Scopes | `openid` (required), `email`, `profile` |
| Tokens | ES256; the ID token and the access token last 10 minutes; there is no refresh token and no `offline_access` |
| Keys | `https://billionsend.com/identity/jwks.json` |

The ID token carries these claims:

| Claim | Scope | Meaning |
| --- | --- | --- |
| `sub` | always | An opaque 43-character id of the inbox, different for every app. A deleted and recreated address gets a new one |
| `actor_type` | always | The literal `"agent"` |
| `email`, `email_verified` | `email` | The inbox's address; `email_verified` is always `true` |
| `name`, `preferred_username` | `profile` | The inbox's name, if it has one, and the part of its address before the `@` |
| `owner_sub` | `profile` | An opaque id of the team that owns the inbox, different for every app and shared by all of the team's inboxes in your app |

Key your accounts on `sub`, not on `email`. Use `owner_sub` to cap how many accounts one team can open in your app. No claim names a person, and signing in grants no access to the inbox's mail.

`GET /identity/userinfo` with the access token returns the same claims and checks the inbox **live**: it answers `401` once the inbox is switched off, deleted or deactivated, or its team is suspended. A token already issued stays valid for its 10 minutes, and BillionSend cannot end the session your app already started.

## Limits and refusals

Each inbox may approve 50 sign-ins in any 24 hours and each team 200. A refusal's error name says why: `inbox_disabled`, `team_unclaimed`, `team_suspended`, `inbox_inactive`, `client_not_allowed` (all `403`), `client_mismatch`, `already_used` and `expired` (`409`), `inbox_cap` and `team_cap` (`429`), `invalid_token` (`404`).

Every approval is recorded in the inbox's **Activity**.

## From an MCP client

`get_inbox_identity` reads the settings and `approve_inbox_sign_in` approves a sign-in. No tool turns signing in on: that stays a person's, in the dashboard or over REST.
