Skip to main content

Doctor Signup (v1)

Method & Path

POST /api/v1/doctors/signup

Actual backend path: /v1/doctors/signup

Description

Create a new doctor account and receive access and refresh tokens. The tokens are set as HTTP-only cookies.

Authentication

Required: None (public endpoint)

Headers

HeaderTypeRequiredDescription
Content-TypestringYesapplication/json

Request Body

{
"email": "doctor@example.com",
"password": "securePassword123",
"fullName": "Dr. John Smith"
}

Body Parameters

ParameterTypeRequiredDescription
emailstringYesDoctor email address (must be valid email format)
passwordstringYesPassword (minimum 8 characters)
fullNamestringYesDoctor's full name (1-200 characters)

Response 201 Created

{
"doctor": {
"id": "507f1f77bcf86cd799439011",
"email": "doctor@example.com",
"fullName": "Dr. John Smith",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Note: The response also sets HTTP-only cookies:

  • refreshToken - Used for token refresh (7 days expiry)
  • accessToken - Used for authentication (15 minutes expiry)

Common Errors

  • 400 Bad Request: Invalid request body
  • 409 Conflict: Email already exists
  • 422 Unprocessable Entity: Validation errors (invalid email format, password too short, etc.)
  • 500 Internal Server Error: Server error