Send OTP code
Send a 6-digit one-time passcode to the given email address. Works for both returning users (sign-in) and new users (sign-up) — no account needs to exist beforehand. The code is valid for **10 minutes**. Call `/otp/verify` next to complete authentication.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/api/v1/auth/otp/send" \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com" }'null{ "detail": [ { "loc": [ "string" ], "msg": "string", "type": "string" } ]}Google sign-in — native apps POST
Native sign-in with a Google `id_token` (Android Credential Manager, Google Sign-In for iOS). The token is verified with Google and must be issued to one of this deployment's client IDs. Returns Avycenna tokens.
Verify OTP and sign in POST
Verify the 6-digit code sent by `/otp/send` and return a token pair. If no account exists for the email, one is created automatically (passwordless sign-up). The response contains: - `access_token` — JWT, expires in **15 minutes**. Pass as `Authorization: Bearer <token>`. - `refresh_token` — opaque string, expires in **30 days**. Use `/refresh` to rotate. - `user.role` — the account's current role: `patient` | `doctor` | `clinic_staff` | `clinic_admin` | `admin`. **Any role can sign in via OTP.** The role field in the response tells the client which UI to display (patient app vs. doctor dashboard).