# SimPig auth.md

How a program authenticates with SimPig (https://simpig.com). In short: there is nothing to register. There is no client
account, no API key and no OAuth client. This page is the whole of it.

## Scope

Programs that read the catalogue or start an order for a buyer. Customers sign in at
https://auth.simpig.com with their own email and a six-digit code sent to it. No customer has a
password, and no step of buying involves a sign-in.

## Registration

None. There is no registration or provisioning endpoint, and nothing to apply for. In the terms of agent
registration: the only identity type is `anonymous`, and the credential is issued per order, not per client.

## What needs no credential

- The catalogue: `GET https://simpig.com/api/v1/catalog/destinations`, `/api/v1/catalog/plans/{destination}`,
  `/api/v1/catalog/trip?to=JP,KR`, `/api/v1/catalog/plan/{productId}`.
- Starting an order: `POST https://simpig.com/api/v1/agent/orders` with the buyer's email and a `productId`.
- The MCP server at `https://simpig.com/api/mcp` (Streamable HTTP): every tool, no authentication.
- The A2A agent at `https://simpig.com/api/a2a` (card: `https://simpig.com/.well-known/agent-card.json`): every skill, no authentication.
- An order's status by watch key: `GET https://simpig.com/api/v1/agent/watch/{key}`. The key in the address is the whole
  credential, and it opens the status and its times only.

## The one credential: the order token

Starting an order answers with an `orderToken`. It is the only credential SimPig issues to a program.

- **Issued by:** `POST https://simpig.com/api/v1/agent/orders` (or the MCP tool `start_order`), once, in the answer
  that creates the order. It is not issued again; a repeated `idempotencyKey` returns the order without it.
- **Used as:** `Authorization: Bearer <orderToken>` on `GET https://simpig.com/api/v1/agent/orders/{ref}` (or the
  `orderToken` argument of the MCP tool `order_status`). No endpoint takes it in a URL.
- **Grants:** reading that one order: its status and, once paid and provisioned, the eSIM's install details.
  Nothing else, and no other order.
- **Lifetime:** 14 days. A wrong, unknown or expired token answers 404.
- **Sensitivity:** it is a secret. Whoever holds it can read the install details, and whoever holds those can
  install the eSIM. The same details are emailed to the buyer.

Payment is the buyer's: the order's `payUrl` is a Stripe page the buyer opens. No payment credential is ever
issued to, or accepted from, a program.

## Limits

Orders are limited per network address and per email address each hour, and unpaid orders have their own, lower limit. A `429` carries `Retry-After` in seconds.

## More

- [API guide](https://simpig.com/agents.md): every call and field
- [OpenAPI document](https://simpig.com/api/v1/openapi.json)
- [API catalog](https://simpig.com/.well-known/api-catalog)
