> ## Documentation Index
> Fetch the complete documentation index at: https://docs.batchrelay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Keyless Test Mode

> Start a persistent sandbox workflow without an account or copied API key.

Keyless Test Mode lets a person, script, or agent begin with no Batch Relay
account and no copied API key. The first request creates an isolated,
short-lived sandbox session. Later requests send that session as a bearer
credential.

<Note>
  Keyless means no signup or manually provisioned key. It does not mean that
  stateful requests share an unauthenticated account. Each session owns only
  its own quotes, assets, orders, idempotency records, and usage.
</Note>

## Use the CLI

The Batch Relay CLI creates and stores an anonymous session when a stateful
command needs one:

```bash theme={null}
batchrelay orders quote \
  --input order.json \
  --idempotency-key quote-20260829-001 \
  --pretty
```

No login command is required. Check or reset the locally stored session with:

```bash theme={null}
batchrelay auth status --pretty
batchrelay auth reset-anonymous
```

An explicit `BATCHRELAY_API_KEY` or configured API-key profile always takes
precedence. If an explicit key is rejected, the CLI reports that failure; it
does not silently fall back to an anonymous session.

## Use the HTTP API

Create a session through the public API host:

```bash theme={null}
curl -sS -X POST https://api.batchrelay.com/v1/anonymous-sessions \
  -o anonymous-session.json
```

The response contains a bearer token that is returned only once:

```json theme={null}
{
  "session_token": "br_anon_example",
  "environment": "sandbox",
  "expires_at": "2026-09-05T12:00:00Z",
  "scopes": [
    "print_orders:read",
    "print_orders:write",
    "usage:read"
  ]
}
```

Store the token as a secret and send it like an API key:

```bash theme={null}
TOKEN="$(jq -r '.session_token' anonymous-session.json)"

curl -sS -X POST https://api.batchrelay.com/v1/providers/compatibility \
  -H "Authorization: Bearer ${TOKEN}" \
  -H 'Content-Type: application/json' \
  --data-binary @compatibility-request.json
```

Do not put the token in a URL, request body, source file, or log.

## Capability boundary

An anonymous session uses the normal public Test Mode lane. It can validate
orders, check compatibility, create quotes, ingest supported assets, submit
sandbox orders, retrieve its own orders, and read its own usage.
Provider selection follows the same sandbox availability and compatibility
rules as a `br_test_` key.

It cannot enter Live Mode, charge through Stripe, access a studio or event,
manage an account, or read another session's records. Changing an
`environment` or provider field in a request cannot widen those permissions.

Template rendering is not keyless yet. The current render endpoint requires a
studio-owned API account and published-template entitlement; adding a safe
anonymous entitlement model is separate work.

## Expiry and limits

Sessions expire after seven days by default. Create a new session after expiry;
records owned by an expired anonymous session are not transferred to the new
one.

Anonymous use has operation-specific limits. A limited request returns
`429 anonymous_session_rate_limited` and a `Retry-After` header. Wait for that
interval or move durable development and CI work to a scoped Test API key.

<Warning>
  Test Mode does not charge and cannot use a production provider lane. A
  sandbox submission is still a real stateful API operation. Give retries a
  stable `Idempotency-Key`, and do not assume a timed-out write failed.
</Warning>
