Authentication
The SmileCloud Public API authenticates every request with a per-clinic secret key, presented as an HTTP bearer token. REST uses bearer keys only - a single key both identifies the clinic and carries the scopes that gate access. MCP clients that cannot send a header, such as Claude Desktop, use the OAuth connector flow, which still resolves to one of these keys.
#API keys
Keys are opaque, randomly generated strings prefixed with sk_live_:
sk_live_4f8a2c9e1b7d6a3f0e5c8b2a9d4f7e1c
Each key belongs to exactly one clinic. SmileCloud stores only a SHA-256 hash of the key - the plaintext is shown once at creation and can never be retrieved again. If a key is lost, revoke it and mint a new one.
#Authorizing a request
Send the key in the Authorization header on every request:
curl https://api.smile-app.co.il/v1/me \
-H "Authorization: Bearer sk_live_..."
The same bearer key works across all three surfaces - REST, the MCP server at /mcp, and the sc CLI.
Keep keys server-side
Because a key carries access to clinic data, and with write scopes can change it, it must only ever live in a trusted backend or a secured operator environment. Never ship a key in a browser bundle, a mobile app, or any client you don't fully control.
#Scopes
Every key carries a set of scopes - fine-grained permissions that decide which resources it can read or write. A request is allowed only if the key holds the scope that the endpoint requires.
Read scopes (patients:read, appointments:read, payments:read, calls:read, whatsapp:read, …) unlock the matching resources. Write scopes (patients:write, payments:write, leads:write, calls:write, whatsapp:write, whatsapp_tags:write) are granted explicitly and never bundled with a read. webhooks:manage covers webhook subscriptions.
You can inspect the scopes on the current key at any time with GET /v1/me. See Scopes for the full list and a per-endpoint mapping.
#Errors
Authentication and authorization failures use standard status codes and the application/problem+json body described in Errors:
| Status | Meaning |
|---|---|
401 Unauthorized | The Authorization header is missing, malformed, or the key is invalid or revoked. |
403 Forbidden | The key is valid but lacks the scope the endpoint requires. |
{
"type": "https://docs.smile-app.co.il/api/errors/forbidden",
"title": "forbidden",
"status": 403,
"detail": "Missing required scope: patients:read"
}
#Rotating and revoking keys
- Rotate by minting a new key, deploying it, then revoking the old one - keys are independent, so there's no downtime.
- Revoke immediately if a key is exposed. Revocation takes effect on the next request.
Because keys are scoped per clinic, a compromised key can never reach another clinic's data.