Skip to content

Keys and environments

Send your API key on every request:

Authorization: Bearer <key>

A missing or invalid key answers 401. Keep keys on your server. Never put one in a browser or a mobile app.

Key What it does
Sandbox Creates sandbox requests. Nothing leaves Sunny: no office is contacted, and offices and clinicians are fictional. See Sandbox.
Live Creates real requests. Sunny contacts real offices for your member.

A key sees only requests of its own kind. A sandbox key cannot read a live request, and a live key cannot read a sandbox one: either answers 404.

You create and revoke keys in the dashboard. You can create sandbox keys at any time. Live keys can be created once Sunny has turned on live use for your account; see Going live.

A key’s value is shown once, when it is created. If you lose it, revoke it and create another. A revoked key stops working within 60 seconds.

Environment Base URL Notes
Production https://api.sunnyhealthai.com
Staging https://api-staging.sunnyhealthai.com For building and testing your integration. A live key in staging still cannot reach a real office: every call goes to a Sunny test number.

Keys, webhook endpoints and requests are separate in each environment. Staging has its own dashboard.

Topic Rule
Format JSON, UTF-8. Request bodies need Content-Type: application/json.
Ids Prefixed and opaque: req_… for a request, evt_… for an event.
Times Instants are RFC 3339 in UTC (2026-11-19T17:02:11Z). Dates are YYYY-MM-DD. An appointment time is local, with no offset, beside an IANA timezone.
Phones E.164 (+14155550123).
Unknown fields Rejected with 422, so a typo is never silently ignored.
Trace id Every response has a Sunny-Trace-Id header. Quote it when you ask us about a call.
Versioning The path carries the major version. Within /v1, changes are additive: new optional fields, new events, new values. Ignore fields and events you do not know.
Body size 36 MB at most. Larger answers 413.