Avycenna

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).

POST
/api/v1/auth/otp/verify

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"    }  ]}