- Host auth: who is allowed to call Peel.
- Target-site session auth (
session_required): credentials some compiled endpoints need for the target site.
Host auth to call Peel
For external REST usage, authenticate to Peel withX-API-Key:
X-API-Key identifies the Peel actor that owns the API, is billed for calls, and can revise or rebuild it.
Public /v1/apis/... routes can also be called from the first-party app with session auth, but that is a host-side app session, not target-site auth.
CLI auth
The CLI defaults tohttps://api.peel.sh for API requests and supports two host-auth paths:
peel auth loginfor browser device flowpeel auth login --api-key ...for direct key injection
POST /public/device/start and POST /public/device/exchange. The signed-in browser approval step is handled by the first-party Peel app.
peel setup wraps this flow and then continues with MCP install plus doctor checks.
Headless signup
If the target deployment allows public signup, the CLI also supports:On
peel.sh, public signup is disabled during private preview. Use an existing account, then create API keys from settings. Headless signup only applies to deployments where an operator enabled public signup.MCP auth
/mcp accepts either:
X-API-KeyAuthorization: Bearer ...for MCP OAuth clients
session_id and encryption_key for protected target-site endpoints.
session_required is a second layer
Some compiled APIs publish a deterministic login endpoint and one or more protected endpoints.
- The login endpoint returns
session_id,encryption_key, andinitiates_session: true. - Protected endpoints require both values on every call.
REST session credentials
ForPOST /v1/apis/{api_id}/endpoints/{endpoint_name}:call, runtime accepts session credentials in either place:
- Preferred headers:
X-Session-IDandX-Encryption-Key - Request body fields:
session_idandencryption_key
MCP session credentials
call_endpoint takes session credentials as top-level tool arguments, with endpoint params nested under params. The shape below is the arguments object inside a JSON-RPC tools/call request. See Authenticated APIs for the full envelope.
Production guidance
- Treat
X-API-Keyas the primary deployment secret. Rotate it with your normal secret-management process. - Keep session values (
session_id,encryption_key) transient. Do not persist them outside your trusted runtime. - If a site cannot be reduced to a compiled login plus deterministic protected calls, it is not a supported
session_requiredsurface.
Calling Peel from a browser
api.peel.sh runs with a strict CORS allowlist. By default, only the Peel SPA at https://peel.sh is allowed, with credentials. Arbitrary third-party origins are rejected.
Two rules of thumb:
- Never ship
X-API-Keyin client-side JavaScript. Keys are deployment secrets. Call Peel from your server and expose a scoped proxy route to your frontend. - If you need browser-to-Peel calls from your own origin, email kaan@peel.sh to get your domain added to the allowlist. This is a one-off configuration change, not a self-service setting.