# Sandbox and accounts

## Sandbox

`POST /sandbox` (or the `sandbox_create` tool) creates a tenant with no authentication:

- A full-scope key and a tokenized MCP URL.
- The two starter buckets, which you can change or delete.
- The whole pipeline: parsing, sanitization, classification, extraction, validation, routing, tasks, corrections, approvals, webhooks, events.
- No real addresses and no sending. Ingest is by upload only.
- A cap on messages and a 24-hour lifetime. When it expires, every row and object is deleted.

There is no model spend in a sandbox because there is no model in the pipeline.

Nothing is really received in a sandbox, so SPF, DKIM and DMARC are `unknown` on every message. To test an auth rule, pass `auth: {dkim: "pass"}` to `ingest_message`; the results are recorded as synthetic.

## Accounts

To keep anything past 24 hours, create an account:

```bash
curl -s -X POST https://api.emailimport.com/accounts -H "content-type: application/json" \
  -d '{"email":"you@example.com","name":"Acme","sandbox_key":"mx_sb_…"}'
```

You get an account key (`mx_live_…`) and an MCP URL. Pass `sandbox_key` to adopt the sandbox you were working in: its tenant moves to the account and, once the email is verified, stops expiring. Without it a fresh tenant is created with the starter buckets.

A verification link is sent to the address. Until it is clicked the account exists but cannot create more tenants. After verification: up to ten tenants (`create_tenant`), keys with chosen scopes and tenant lists (`create_key`, `list_keys`, `revoke_key`), and, when real mail receipt ships, addresses on our inbound domain within small caps. Sending and higher caps come with a paid tier.

## Accounts, tenants, keys

An **account** is the billing and admin umbrella: an email, a verification, and the tenants it owns. A **tenant** is one business and a hard isolation boundary: its own rows, keys, object-storage prefix, buckets, test suite. Nothing configured or learned in one tenant reaches another, even under the same account. A **key** belongs to an account, carries scopes, and reaches a set of the account's tenants: an explicit list, or all of them now and later.

When a key reaches one tenant, `tenant` is implied on every call. When it reaches several, `tenant` is required and a call without it is refused with the list. A firm running several client businesses is one account, several tenants, and a key per agent scoped to the tenants it should touch.

A sandbox is the same model with a throwaway account that has no email: one tenant, one key, a 24-hour lifetime.
