Verify OTP and sign in
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).
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/verify" \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com", "otp": "string" }'{ "access_token": "string", "refresh_token": "string", "token_type": "bearer", "user": { "id": "string", "name": "string", "email": "string", "image": "string", "role": "patient" }}{ "detail": [ { "loc": [ "string" ], "msg": "string", "type": "string" } ]}Send OTP code POST
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.
Available sign-in methods GET
Which web sign-in providers are configured, so the sign-in page only offers working options. Email codes are always available.