Avycenna

Authentication

Email codes, Apple and Google, tokens and API keys.

Email code

curl -X POST https://api.avycenna.com/api/v1/auth/otp/send \
  -H "Content-Type: application/json" \
  -d '{"email": "you@clinic.com"}'

curl -X POST https://api.avycenna.com/api/v1/auth/otp/verify \
  -H "Content-Type: application/json" \
  -d '{"email": "you@clinic.com", "otp": "123456"}'

Codes expire after 10 minutes. Verifying returns an access_token, a refresh_token and the user.

Apple and Google

  • Web: GET /auth/oauth/google or /auth/oauth/apple redirects to the provider. Afterwards the browser returns to the web app with tokens in the URL fragment, which is never sent to a server.
  • Native: the iOS app posts Apple's identity token to POST /auth/oauth/apple/native; the Android app posts Google's ID token to POST /auth/oauth/google/native.
  • GET /auth/providers says which providers this server has configured.

Tokens

TokenLifetimeUse
Access token15 minutesAuthorization: Bearer <token>
Refresh token30 daysPOST /auth/refresh returns a new pair; the old refresh token stops working

POST /auth/logout revokes a refresh token.

API keys

For server-to-server integrations, create a workspace key under Integrations and send it as:

X-API-Key: sk_live_…

Workspace keys have the read_granted scope: they read data patients have shared with the workspace and can't change anything. Account administration (workspaces, billing, members) needs a signed-in session.

On this page