# Keyless sandbox

URL: https://notifly.io/docs/keyless-sandbox

> Start a Notifly sandbox with no account and no API key, integrate against fake data, then go live by swapping the key.

The keyless sandbox lets a coding agent (or you) integrate with Notifly **before creating an account**. One unauthenticated request returns a working API key for a throwaway environment. Every notification triggered with that key runs the normal workflow path, but **nothing is ever delivered outside Notifly**: email, SMS, push, chat and HTTP request steps are captured, not sent. Going live is a key change, not a code change.

<Callout title="Availability">
  The start endpoint answers `503 KEYLESS_SANDBOX_DISABLED` until the operator turns it on
  with `NOTIFLY_KEYLESS_START_ENABLED=true`. If you see that code, create a free account at
  [app.notifly.io/auth/sign-up](https://app.notifly.io/auth/sign-up) and use a normal API key.
</Callout>

## Start a sandbox

`POST /v1/keyless/start` needs no credentials, only a small proof of work so that starting a sandbox costs the caller a second of CPU.

1. Send the request with no proof. The answer is `428` with a signed challenge:

```bash
curl -i -X POST https://api.notifly.io/v1/keyless/start -H "Content-Type: application/json" -d '{}'
```

```json
{
  "code": "KEYLESS_SANDBOX_PROOF_REQUIRED",
  "sandbox": true,
  "challenge": "<base64url>",
  "algorithm": "sha256",
  "difficultyBits": 20,
  "header": "Notifly-Keyless-Proof",
  "howTo": { "node": "node -e \"...\"", "python": "python3 -c \"...\"" }
}
```

2. Find a decimal nonce such that SHA-256 over the UTF-8 bytes of `<challenge>:<nonce>` starts with `difficultyBits` zero bits. `howTo.node` and `howTo.python` are ready-made one-liners that print the value to send.
3. Repeat the request with the header `Notifly-Keyless-Proof: <challenge>:<nonce>`.

```bash
curl -X POST https://api.notifly.io/v1/keyless/start \
  -H "Content-Type: application/json" \
  -H "Notifly-Keyless-Proof: $PROOF" \
  -d '{"label":"my-agent-run"}'
```

The body is optional. The only accepted field is `label` (1 to 64 characters). The proof is single-use and valid for 5 minutes. The difficulty is 20 bits normally and rises to 22 or 24 when your network or the whole deployment has been busy that day.

A successful start returns `201`:

```json
{
  "sandbox": true,
  "apiKey": "sk_...",
  "environmentId": "...",
  "applicationIdentifier": "pk_keyless_<hex>_sbx_<random>",
  "expiresAt": "2026-12-03T10:00:00.000Z",
  "workflows": [{ "identifier": "hello-world", "channels": ["in_app"] }],
  "integrations": [{ "channel": "email", "providerId": "sendgrid", "identifier": "..." }],
  "subscriberId": "sandbox-subscriber",
  "reservedInputs": { "email": { "success": "delivered@sandbox.notifly.test", "failure": "bounce@sandbox.notifly.test" } },
  "limits": {
    "triggerRequests": 100,
    "recipientsPerTrigger": 10,
    "recipientsPerSandbox": 500,
    "subscriberWrites": 50,
    "topicWrites": 50,
    "requestBodyBytes": 65536,
    "lifetimeHours": 24,
    "startsPerNetworkPerDay": 5
  },
  "nextSteps": ["..."],
  "goLive": "...",
  "docs": "https://notifly.io/docs/keyless-sandbox",
  "claim": { "available": false, "note": "..." }
}
```

## Use the sandbox key

Send the returned key exactly as you would a real one. It is the same API, the same request and response shapes, the same code path:

```bash
curl -X POST https://api.notifly.io/v1/events/trigger \
  -H "Authorization: ApiKey $SANDBOX_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"hello-world","to":{"subscriberId":"sandbox-subscriber"},"payload":{}}'
```

Every response made with a sandbox key carries the header `Notifly-Sandbox: true`, errors included, and a JSON object body also carries `"sandbox": true`. The ready-made `hello-world` workflow delivers to the in-app Inbox of `sandbox-subscriber`, which is safe because it never leaves Notifly. Create email, SMS, push or chat workflows with `POST /v2/workflows`, trigger them, and read the outcome with `GET /v1/notifications` and `GET /v1/messages`.

### What is captured

For a sandbox, the worker wraps every delivery in a capture: the email, SMS, push and chat provider handlers and the HTTP Request step never call the outside provider. A captured delivery succeeds with an id that starts with `sandbox_`, or fails on purpose when you use a reserved failure input. The capture is keyed on the sandbox environment itself (its identifier carries the `sbx` marker), is applied where each provider handler is built, and needs no worker setting, so a sandbox cannot be pointed at a real provider and the worker cannot be misconfigured into sending. A sandbox also cannot use a bridge: `bridgeUrl` on a trigger (top level or on any item of a bulk request) answers `400 KEYLESS_SANDBOX_BRIDGE_URL_REFUSED`, and the worker refuses to run a sandbox step through an external bridge even if one was queued. A webhook filter on a step is captured too: no request is sent, and the filter is evaluated against an empty response. A sandbox key also cannot be exchanged for an MCP access token, because that token would not carry the sandbox rules.

### Reserved test inputs

Use these recipients to force a result. They are fake and deterministic.

| Channel                                                 | Forces success                   | Forces failure                |
| ------------------------------------------------------- | -------------------------------- | ----------------------------- |
| Email                                                   | `delivered@sandbox.notifly.test` | `bounce@sandbox.notifly.test` |
| SMS                                                     | `+15005550000`                   | `+15005550006`                |
| Push (device token)                                     | `sandbox-token-success`          | `sandbox-token-invalid`       |
| Chat (channel id, in the subscriber's channel endpoint) | `sandbox-channel-success`        | `sandbox-channel-not-found`   |

A failure shows up on the message and in the execution details exactly like a real provider failure, with a reason that starts with `[sandbox]`. Push and chat need the subscriber's device token or channel set first, with `PUT /v1/subscribers/{subscriberId}/credentials`. For chat the failure value is matched anywhere inside the endpoint the step delivers to, for example the `channelId` of a Slack channel endpoint.

### Routes a sandbox key can reach

A sandbox key can trigger and read: `events`, `subscribers`, `topics`, `workflows`, `notification-templates`, `notification-groups`, `notifications`, `messages`, `layouts`, `contexts`, `feeds`, `execution-details` and `health-check`. It can also read exactly four routes about itself: `GET /v1/environments/me`, `GET /v1/environments/api-keys` (its own key), `GET /v1/integrations` and `GET /v1/integrations/active`. Anything else answers `403 KEYLESS_SANDBOX_ROUTE_NOT_ALLOWED`: billing, organizations, agents, provider credentials, the environment list and every other `environments` or `integrations` route, provider test calls such as `POST /v1/events/test/*`, `PUT /v2/workflows/{id}/sync`, every write on the legacy `/v1/workflows` and `/v1/notification-templates` routes (create workflows with `POST /v2/workflows`; reads of those routes stay open) and `POST /v1/events/trigger/broadcast` (a broadcast reaches every subscriber, so it has no recipient list to cap).

Routes are matched case-insensitively and ignoring repeated or trailing slashes, the way the API routes them, so `POST /v1/events/Trigger` is the same route as `POST /v1/events/trigger` for every rule above.

A sandbox is driven with its key only. It gets no subscriber session: `POST /v1/inbox/session`, `POST /v1/widgets/session/initialize` and `POST /v1/inbox/events` answer `403 KEYLESS_SANDBOX_ROUTE_NOT_ALLOWED` for a sandbox's `applicationIdentifier`, and a subscriber token naming a sandbox environment is rejected everywhere (the inbox routes including device tokens, channel connections and endpoints, `/v1/widgets`, web chat and `/internal`). Those routes are public or token-based, so they would bypass the key, the caps, the kill switch and the expiry. Read the sandbox inbox with `GET /v1/notifications` and `GET /v1/messages` using the key.

All sandboxes share one organization, so the allowlist is also what keeps one sandbox from seeing another: every route above filters by the environment of the key, and the routes that list or open other environments of the organization are the ones that are closed.

## Limits

| Limit                                                                                                                | Default     | Setting                                         |
| -------------------------------------------------------------------------------------------------------------------- | ----------- | ----------------------------------------------- |
| Sandboxes started per network per UTC day (IPv4 address, or IPv6 /64)                                                | 5           | `NOTIFLY_KEYLESS_START_PER_NETWORK_PER_DAY`     |
| Sandboxes started per day, everyone together                                                                         | 200         | `NOTIFLY_KEYLESS_START_GLOBAL_PER_DAY`          |
| Trigger requests per sandbox (each event of a bulk request counts)                                                   | 100         | `NOTIFLY_KEYLESS_TRIGGERS_PER_SANDBOX`          |
| Recipients named in one trigger (`to`; a topic counts as one)                                                        | 10          | `NOTIFLY_KEYLESS_RECIPIENTS_PER_TRIGGER`        |
| Recipients per sandbox, in total (a topic is charged the most subscribers it can hold, which is the topic write cap) | 500         | `NOTIFLY_KEYLESS_RECIPIENTS_PER_SANDBOX`        |
| Subscriber writes per sandbox (each item of a bulk write counts)                                                     | 50          | `NOTIFLY_KEYLESS_SUBSCRIBER_WRITES_PER_SANDBOX` |
| Topic writes per sandbox (topics changed, subscribers added to or removed from a topic)                              | 50          | `NOTIFLY_KEYLESS_TOPIC_WRITES_PER_SANDBOX`      |
| Request body size                                                                                                    | 65536 bytes | `NOTIFLY_KEYLESS_PAYLOAD_MAX_BYTES`             |
| Lifetime of an unclaimed sandbox                                                                                     | 24 hours    | `KEYLESS_RETENTION_TIME_IN_HOURS`               |

A sandbox past its lifetime (exactly the `expiresAt` it was given) answers `410 KEYLESS_SANDBOX_EXPIRED`. Start a new one.

The operator can switch the whole feature off with `NOTIFLY_KEYLESS_START_ENABLED=false`: that stops new starts and also answers `503 KEYLESS_SANDBOX_DISABLED` to every request made with an already issued sandbox key. Without Redis, or without the keyless organization configured (`KEYLESS_ORGANIZATION_ID`), the limits cannot be enforced, so a sandbox key answers `503 KEYLESS_SANDBOX_UNAVAILABLE` instead of running as an ordinary uncapped key.

### What happens to an expired sandbox

Expiry refuses the key straight away; deleting what the sandbox left behind is a separate housekeeping call, `POST /v1/keyless/purge-expired`, which is **off unless the operator sets `KEYLESS_CLEANUP_KEY` and something calls it on a schedule** (nothing in Notifly schedules it). It defaults to a dry run and deletes the environment with its notifications, messages, jobs, execution details, subscribers, topics, integrations and workflows. It does not yet sweep the other collections keyed to an environment (contexts, layouts, preferences, translations, environment variables, topic subscribers); those leftovers are small and unreachable, and sweeping them is a known follow-up.

## Errors

Every refusal is a JSON body with a stable `code` to branch on, plus `what` happened, `why`, `next` (what to do), `docs` and `signUpUrl`. A start refused for a daily cap includes `retryAt` (the next UTC midnight) and a `Retry-After` header.

| Status | `code`                                | Meaning                                           |
| ------ | ------------------------------------- | ------------------------------------------------- |
| 428    | `KEYLESS_SANDBOX_PROOF_REQUIRED`      | Solve the challenge in the body and retry         |
| 429    | `KEYLESS_SANDBOX_NETWORK_LIMIT`       | This network used its starts for the day          |
| 429    | `KEYLESS_SANDBOX_CAPACITY_REACHED`    | The deployment-wide daily cap is spent            |
| 429    | `KEYLESS_SANDBOX_TRIGGER_LIMIT`       | This sandbox used its trigger budget              |
| 429    | `KEYLESS_SANDBOX_RECIPIENT_ALLOWANCE` | This sandbox used its recipient allowance         |
| 429    | `KEYLESS_SANDBOX_WRITE_LIMIT`         | This sandbox used its subscriber or topic writes  |
| 400    | `KEYLESS_SANDBOX_RECIPIENT_LIMIT`     | One trigger names too many recipients; split it   |
| 400    | `KEYLESS_SANDBOX_BRIDGE_URL_REFUSED`  | Remove `bridgeUrl`; sandboxes never call out      |
| 413    | `KEYLESS_SANDBOX_PAYLOAD_TOO_LARGE`   | Send a smaller body                               |
| 403    | `KEYLESS_SANDBOX_ROUTE_NOT_ALLOWED`   | The route is outside the sandbox allowlist        |
| 410    | `KEYLESS_SANDBOX_EXPIRED`             | Start a new sandbox                               |
| 400    | `KEYLESS_SANDBOX_INVALID_REQUEST`     | The start body is not valid                       |
| 503    | `KEYLESS_SANDBOX_DISABLED`            | The operator has the sandbox turned off           |
| 503    | `KEYLESS_SANDBOX_UNAVAILABLE`         | The sandbox's limits cannot be enforced right now |

## Going live

Create a free account at [app.notifly.io/auth/sign-up](https://app.notifly.io/auth/sign-up), create an API key, connect your real providers, and send that key instead of the sandbox key. Nothing else changes. Claiming a sandbox's workflows into an account is not available yet, so recreate them in the real account; they are plain API calls.
