{ "openapi": "3.0.3", "info": { "title": "Amrutam Telemedicine API", "version": "0.1.0", "description": "Booking, consultations, prescriptions, and admin analytics." }, "components": { "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } }, "schemas": {} }, "paths": { "/metrics": { "get": { "tags": [ "observability" ], "responses": { "200": { "description": "Default Response" } } } }, "/health": { "get": { "tags": [ "health" ], "responses": { "200": { "description": "Default Response" } } } }, "/ready": { "get": { "tags": [ "health" ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "ok", "degraded" ] }, "checks": { "type": "object", "properties": { "database": { "type": "string", "enum": [ "ok", "error" ] }, "redis": { "type": "string", "enum": [ "ok", "error" ] } }, "required": [ "database", "redis" ], "additionalProperties": false } }, "required": [ "status", "checks" ], "additionalProperties": false } } } } } } }, "/auth/register": { "post": { "tags": [ "auth" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "format": "email" }, "password": { "type": "string", "minLength": 8, "maxLength": 128 }, "role": { "type": "string", "enum": [ "patient", "doctor" ], "default": "patient" } }, "required": [ "email", "password" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "email": { "type": "string" }, "role": { "type": "string" } }, "required": [ "id", "email", "role" ], "additionalProperties": false } } } } } } }, "/auth/login": { "post": { "tags": [ "auth" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "format": "email" }, "password": { "type": "string", "minLength": 1 } }, "required": [ "email", "password" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "anyOf": [ { "type": "object", "properties": { "mfaRequired": { "type": "boolean", "enum": [ false ] }, "accessToken": { "type": "string" }, "refreshToken": { "type": "string" } }, "required": [ "mfaRequired", "accessToken", "refreshToken" ], "additionalProperties": false }, { "type": "object", "properties": { "mfaRequired": { "type": "boolean", "enum": [ true ] }, "mfaToken": { "type": "string" } }, "required": [ "mfaRequired", "mfaToken" ], "additionalProperties": false } ] } } } } } } }, "/auth/mfa/verify": { "post": { "tags": [ "auth" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "mfaToken": { "type": "string" }, "code": { "type": "string", "minLength": 6, "maxLength": 6 } }, "required": [ "mfaToken", "code" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "mfaRequired": { "type": "boolean", "enum": [ false ] }, "accessToken": { "type": "string" }, "refreshToken": { "type": "string" } }, "required": [ "mfaRequired", "accessToken", "refreshToken" ], "additionalProperties": false } } } } } } }, "/auth/mfa/enroll": { "post": { "tags": [ "auth" ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "secret": { "type": "string" }, "otpauthUrl": { "type": "string" } }, "required": [ "secret", "otpauthUrl" ], "additionalProperties": false } } } } } } }, "/auth/mfa/enable": { "post": { "tags": [ "auth" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "code": { "type": "string", "minLength": 6, "maxLength": 6 } }, "required": [ "code" ], "additionalProperties": false } } } }, "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response" } } } }, "/auth/refresh": { "post": { "tags": [ "auth" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "refreshToken": { "type": "string" } }, "required": [ "refreshToken" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "mfaRequired": { "type": "boolean", "enum": [ false ] }, "accessToken": { "type": "string" }, "refreshToken": { "type": "string" } }, "required": [ "mfaRequired", "accessToken", "refreshToken" ], "additionalProperties": false } } } } } } }, "/auth/logout": { "post": { "tags": [ "auth" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "refreshToken": { "type": "string" } }, "required": [ "refreshToken" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Default Response" } } } }, "/profile/me": { "put": { "tags": [ "profile" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "fullName": { "type": "string", "minLength": 1, "maxLength": 200 }, "phone": { "type": "string", "minLength": 7, "maxLength": 20 }, "dob": { "type": "string", "format": "date" }, "gender": { "type": "string", "maxLength": 30 } }, "required": [ "fullName" ], "additionalProperties": false } } } }, "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "fullName": { "type": "string" }, "phone": { "type": "string", "nullable": true }, "dob": { "type": "string", "nullable": true }, "gender": { "type": "string", "nullable": true } }, "required": [ "fullName", "phone", "dob", "gender" ], "additionalProperties": false } } } } } }, "get": { "tags": [ "profile" ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "fullName": { "type": "string" }, "phone": { "type": "string", "nullable": true }, "dob": { "type": "string", "nullable": true }, "gender": { "type": "string", "nullable": true } }, "required": [ "fullName", "phone", "dob", "gender" ], "additionalProperties": false } } } } } } }, "/doctors/me": { "put": { "tags": [ "doctors" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "specialization": { "type": "string", "minLength": 1, "maxLength": 100 }, "bio": { "type": "string", "maxLength": 1000 }, "consultationFeeMinor": { "type": "integer", "exclusiveMinimum": true, "minimum": 0 }, "yearsExperience": { "type": "integer", "minimum": 0, "maximum": 80, "default": 0 } }, "required": [ "specialization", "consultationFeeMinor" ], "additionalProperties": false } } } }, "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "specialization": { "type": "string" }, "bio": { "type": "string", "nullable": true }, "consultationFeeMinor": { "type": "number" }, "yearsExperience": { "type": "number" }, "verified": { "type": "boolean" }, "email": { "type": "string" }, "fullName": { "type": "string", "nullable": true } }, "required": [ "userId", "specialization", "bio", "consultationFeeMinor", "yearsExperience", "verified", "email", "fullName" ], "additionalProperties": false } } } } } } }, "/doctors": { "get": { "tags": [ "doctors" ], "parameters": [ { "schema": { "type": "string" }, "in": "query", "name": "specialization", "required": false }, { "schema": { "type": "boolean" }, "in": "query", "name": "verified", "required": false }, { "schema": { "type": "integer", "minimum": 0 }, "in": "query", "name": "minFeeMinor", "required": false }, { "schema": { "type": "integer", "exclusiveMinimum": true, "minimum": 0 }, "in": "query", "name": "maxFeeMinor", "required": false }, { "schema": { "type": "string", "minLength": 1, "maxLength": 100 }, "in": "query", "name": "q", "required": false }, { "schema": { "type": "integer", "exclusiveMinimum": true, "minimum": 0, "default": 1 }, "in": "query", "name": "page", "required": false }, { "schema": { "type": "integer", "exclusiveMinimum": true, "minimum": 0, "maximum": 100, "default": 20 }, "in": "query", "name": "limit", "required": false } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "specialization": { "type": "string" }, "bio": { "type": "string", "nullable": true }, "consultationFeeMinor": { "type": "number" }, "yearsExperience": { "type": "number" }, "verified": { "type": "boolean" }, "email": { "type": "string" }, "fullName": { "type": "string", "nullable": true } }, "required": [ "userId", "specialization", "bio", "consultationFeeMinor", "yearsExperience", "verified", "email", "fullName" ], "additionalProperties": false } }, "page": { "type": "number" }, "limit": { "type": "number" } }, "required": [ "items", "page", "limit" ], "additionalProperties": false } } } } } } }, "/doctors/{id}": { "get": { "tags": [ "doctors" ], "parameters": [ { "schema": { "type": "string", "format": "uuid" }, "in": "path", "name": "id", "required": true } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "specialization": { "type": "string" }, "bio": { "type": "string", "nullable": true }, "consultationFeeMinor": { "type": "number" }, "yearsExperience": { "type": "number" }, "verified": { "type": "boolean" }, "email": { "type": "string" }, "fullName": { "type": "string", "nullable": true } }, "required": [ "userId", "specialization", "bio", "consultationFeeMinor", "yearsExperience", "verified", "email", "fullName" ], "additionalProperties": false } } } } } } }, "/doctors/{id}/verify": { "post": { "tags": [ "doctors" ], "parameters": [ { "schema": { "type": "string", "format": "uuid" }, "in": "path", "name": "id", "required": true } ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "userId": { "type": "string", "format": "uuid" }, "specialization": { "type": "string" }, "bio": { "type": "string", "nullable": true }, "consultationFeeMinor": { "type": "number" }, "yearsExperience": { "type": "number" }, "verified": { "type": "boolean" }, "email": { "type": "string" }, "fullName": { "type": "string", "nullable": true } }, "required": [ "userId", "specialization", "bio", "consultationFeeMinor", "yearsExperience", "verified", "email", "fullName" ], "additionalProperties": false } } } } } } }, "/doctors/me/availability": { "post": { "tags": [ "availability" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "slots": { "type": "array", "items": { "type": "object", "properties": { "startsAt": { "type": "string", "format": "date-time" }, "endsAt": { "type": "string", "format": "date-time" } }, "required": [ "startsAt", "endsAt" ], "additionalProperties": false }, "minItems": 1, "maxItems": 100 } }, "required": [ "slots" ], "additionalProperties": false } } } }, "security": [ { "bearerAuth": [] } ], "responses": { "201": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "created": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "doctorId": { "type": "string", "format": "uuid" }, "startsAt": { "type": "string" }, "endsAt": { "type": "string" }, "status": { "type": "string", "enum": [ "open", "held", "booked", "cancelled" ] } }, "required": [ "id", "doctorId", "startsAt", "endsAt", "status" ], "additionalProperties": false } }, "skipped": { "type": "number" } }, "required": [ "created", "skipped" ], "additionalProperties": false } } } } } } }, "/doctors/{id}/availability": { "get": { "tags": [ "availability" ], "parameters": [ { "schema": { "type": "string", "format": "uuid" }, "in": "path", "name": "id", "required": true } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "doctorId": { "type": "string", "format": "uuid" }, "startsAt": { "type": "string" }, "endsAt": { "type": "string" }, "status": { "type": "string", "enum": [ "open", "held", "booked", "cancelled" ] } }, "required": [ "id", "doctorId", "startsAt", "endsAt", "status" ], "additionalProperties": false } } }, "required": [ "items" ], "additionalProperties": false } } } } } } }, "/doctors/me/availability/{slotId}": { "delete": { "tags": [ "availability" ], "parameters": [ { "schema": { "type": "string", "format": "uuid" }, "in": "path", "name": "slotId", "required": true } ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response" } } } }, "/bookings": { "post": { "tags": [ "bookings" ], "description": "Requires an Idempotency-Key header. Holds the slot and creates a pending booking.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "slotId": { "type": "string", "format": "uuid" } }, "required": [ "slotId" ], "additionalProperties": false } } } }, "security": [ { "bearerAuth": [] } ], "responses": { "201": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "slotId": { "type": "string", "format": "uuid" }, "patientId": { "type": "string", "format": "uuid" }, "doctorId": { "type": "string", "format": "uuid" }, "feeMinor": { "type": "number" }, "status": { "type": "string", "enum": [ "pending_payment", "confirmed", "cancelled", "completed" ] }, "holdExpiresAt": { "type": "string", "nullable": true }, "createdAt": { "type": "string" } }, "required": [ "id", "slotId", "patientId", "doctorId", "feeMinor", "status", "holdExpiresAt", "createdAt" ], "additionalProperties": false } } } } } } }, "/bookings/me": { "get": { "tags": [ "bookings" ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "slotId": { "type": "string", "format": "uuid" }, "patientId": { "type": "string", "format": "uuid" }, "doctorId": { "type": "string", "format": "uuid" }, "feeMinor": { "type": "number" }, "status": { "type": "string", "enum": [ "pending_payment", "confirmed", "cancelled", "completed" ] }, "holdExpiresAt": { "type": "string", "nullable": true }, "createdAt": { "type": "string" } }, "required": [ "id", "slotId", "patientId", "doctorId", "feeMinor", "status", "holdExpiresAt", "createdAt" ], "additionalProperties": false } } }, "required": [ "items" ], "additionalProperties": false } } } } } } }, "/bookings/{id}": { "get": { "tags": [ "bookings" ], "parameters": [ { "schema": { "type": "string", "format": "uuid" }, "in": "path", "name": "id", "required": true } ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "slotId": { "type": "string", "format": "uuid" }, "patientId": { "type": "string", "format": "uuid" }, "doctorId": { "type": "string", "format": "uuid" }, "feeMinor": { "type": "number" }, "status": { "type": "string", "enum": [ "pending_payment", "confirmed", "cancelled", "completed" ] }, "holdExpiresAt": { "type": "string", "nullable": true }, "createdAt": { "type": "string" } }, "required": [ "id", "slotId", "patientId", "doctorId", "feeMinor", "status", "holdExpiresAt", "createdAt" ], "additionalProperties": false } } } } } } }, "/bookings/{id}/cancel": { "post": { "tags": [ "bookings" ], "description": "Requires an Idempotency-Key header.", "parameters": [ { "schema": { "type": "string", "format": "uuid" }, "in": "path", "name": "id", "required": true } ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "slotId": { "type": "string", "format": "uuid" }, "patientId": { "type": "string", "format": "uuid" }, "doctorId": { "type": "string", "format": "uuid" }, "feeMinor": { "type": "number" }, "status": { "type": "string", "enum": [ "pending_payment", "confirmed", "cancelled", "completed" ] }, "holdExpiresAt": { "type": "string", "nullable": true }, "createdAt": { "type": "string" } }, "required": [ "id", "slotId", "patientId", "doctorId", "feeMinor", "status", "holdExpiresAt", "createdAt" ], "additionalProperties": false } } } } } } }, "/bookings/{id}/complete": { "post": { "tags": [ "bookings" ], "parameters": [ { "schema": { "type": "string", "format": "uuid" }, "in": "path", "name": "id", "required": true } ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "slotId": { "type": "string", "format": "uuid" }, "patientId": { "type": "string", "format": "uuid" }, "doctorId": { "type": "string", "format": "uuid" }, "feeMinor": { "type": "number" }, "status": { "type": "string", "enum": [ "pending_payment", "confirmed", "cancelled", "completed" ] }, "holdExpiresAt": { "type": "string", "nullable": true }, "createdAt": { "type": "string" } }, "required": [ "id", "slotId", "patientId", "doctorId", "feeMinor", "status", "holdExpiresAt", "createdAt" ], "additionalProperties": false } } } } } } }, "/bookings/{id}/pay": { "post": { "tags": [ "payments" ], "description": "Requires an Idempotency-Key header. Creates a mock payment intent for a pending booking.", "parameters": [ { "schema": { "type": "string", "format": "uuid" }, "in": "path", "name": "id", "required": true } ], "security": [ { "bearerAuth": [] } ], "responses": { "201": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "paymentId": { "type": "string", "format": "uuid" }, "providerRef": { "type": "string" }, "amountMinor": { "type": "number" }, "currency": { "type": "string" }, "payUrl": { "type": "string" } }, "required": [ "paymentId", "providerRef", "amountMinor", "currency", "payUrl" ], "additionalProperties": false } } } } } } }, "/payments/webhook": { "post": { "tags": [ "payments" ], "description": "Called by the (mock) payment provider. Verified via X-Webhook-Signature (HMAC-SHA256).", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "providerRef": { "type": "string" }, "status": { "type": "string", "enum": [ "succeeded", "failed" ] } }, "required": [ "providerRef", "status" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Default Response" } } } }, "/bookings/{id}/prescriptions": { "post": { "tags": [ "prescriptions" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 200 }, "dosage": { "type": "string", "minLength": 1, "maxLength": 100 }, "frequency": { "type": "string", "minLength": 1, "maxLength": 100 }, "durationDays": { "type": "integer", "exclusiveMinimum": true, "minimum": 0 }, "notes": { "type": "string", "maxLength": 500 } }, "required": [ "name", "dosage", "frequency", "durationDays" ], "additionalProperties": false }, "minItems": 1, "maxItems": 20 } }, "required": [ "items" ], "additionalProperties": false } } } }, "parameters": [ { "schema": { "type": "string", "format": "uuid" }, "in": "path", "name": "id", "required": true } ], "security": [ { "bearerAuth": [] } ], "responses": { "201": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "consultationId": { "type": "string", "format": "uuid" }, "items": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 200 }, "dosage": { "type": "string", "minLength": 1, "maxLength": 100 }, "frequency": { "type": "string", "minLength": 1, "maxLength": 100 }, "durationDays": { "type": "integer", "exclusiveMinimum": true, "minimum": 0 }, "notes": { "type": "string", "maxLength": 500 } }, "required": [ "name", "dosage", "frequency", "durationDays" ], "additionalProperties": false } }, "pdfUrl": { "type": "string", "nullable": true }, "signedAt": { "type": "string" } }, "required": [ "id", "consultationId", "items", "pdfUrl", "signedAt" ], "additionalProperties": false } } } } } }, "get": { "tags": [ "prescriptions" ], "parameters": [ { "schema": { "type": "string", "format": "uuid" }, "in": "path", "name": "id", "required": true } ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "consultationId": { "type": "string", "format": "uuid" }, "items": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 200 }, "dosage": { "type": "string", "minLength": 1, "maxLength": 100 }, "frequency": { "type": "string", "minLength": 1, "maxLength": 100 }, "durationDays": { "type": "integer", "exclusiveMinimum": true, "minimum": 0 }, "notes": { "type": "string", "maxLength": 500 } }, "required": [ "name", "dosage", "frequency", "durationDays" ], "additionalProperties": false } }, "pdfUrl": { "type": "string", "nullable": true }, "signedAt": { "type": "string" } }, "required": [ "id", "consultationId", "items", "pdfUrl", "signedAt" ], "additionalProperties": false } } }, "required": [ "items" ], "additionalProperties": false } } } } } } }, "/admin/analytics": { "get": { "tags": [ "admin" ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Default Response", "content": { "application/json": { "schema": { "type": "object", "properties": { "users": { "type": "object", "properties": { "total": { "type": "number" }, "byRole": { "type": "object", "additionalProperties": { "type": "number" } } }, "required": [ "total", "byRole" ], "additionalProperties": false }, "doctors": { "type": "object", "properties": { "total": { "type": "number" }, "verified": { "type": "number" }, "unverified": { "type": "number" } }, "required": [ "total", "verified", "unverified" ], "additionalProperties": false }, "consultations": { "type": "object", "properties": { "total": { "type": "number" }, "byStatus": { "type": "object", "additionalProperties": { "type": "number" } } }, "required": [ "total", "byStatus" ], "additionalProperties": false }, "revenue": { "type": "object", "properties": { "totalMinor": { "type": "number" }, "currency": { "type": "string", "enum": [ "INR" ] } }, "required": [ "totalMinor", "currency" ], "additionalProperties": false } }, "required": [ "users", "doctors", "consultations", "revenue" ], "additionalProperties": false } } } } } } } }, "servers": [ { "url": "/" } ] }