Skip to main content
POST
/
patients
/
create
Create Patient
curl --request POST \
  --url https://api.example.com/patients/create \
  --header 'Content-Type: application/json' \
  --data '
{
  "cpf": "<string>",
  "name": "<string>",
  "email": "<string>",
  "password": "<string>",
  "dateOfBirth": "<string>",
  "address": "<string>",
  "medicalHistory": "<string>"
}
'
{
  "error": "Validation failed",
  "message": "CPF must be exactly 11 characters"
}
Creates a new patient account in the system.

Request Body

cpf
string
required
Patient’s CPF (Brazilian tax ID). Must be unique and exactly 11 characters long.
name
string
required
Patient’s full name.
email
string
required
Patient’s email address. Must be unique in the system.
password
string
required
Patient’s account password.
dateOfBirth
string
required
Patient’s date of birth in ISO 8601 format (YYYY-MM-DD).
address
string
Patient’s address (maximum 255 characters).
medicalHistory
string
Patient’s medical history notes.

Response

cpf
string
The patient’s CPF.
name
string
The patient’s full name.
email
string
The patient’s email address.
dateOfBirth
string
The patient’s date of birth in ISO 8601 format.
address
string
The patient’s address.
medicalHistory
string
The patient’s medical history.
The password field is not included in the response for security reasons.

Example Request

cURL
curl -X POST http://localhost:8080/patients/create \
  -H "Content-Type: application/json" \
  -d '{
    "cpf": "12345678901",
    "name": "Maria Silva",
    "email": "[email protected]",
    "password": "securePassword123",
    "dateOfBirth": "1990-05-15",
    "address": "Rua das Flores, 123, São Paulo, SP",
    "medicalHistory": "No known allergies. Previous surgery in 2015."
  }'

Example Response

200 OK
{
  "cpf": "12345678901",
  "name": "Maria Silva",
  "email": "[email protected]",
  "dateOfBirth": "1990-05-15",
  "address": "Rua das Flores, 123, São Paulo, SP",
  "medicalHistory": "No known allergies. Previous surgery in 2015."
}

Error Responses

{
  "error": "Validation failed",
  "message": "CPF must be exactly 11 characters"
}
{
  "error": "Patient already exists",
  "message": "A patient with this CPF or email already exists"
}
{
  "error": "Internal server error",
  "message": "An unexpected error occurred"
}

Notes

  • CPF must be unique and exactly 11 characters long
  • Email must be unique in the system
  • Password is stored securely and never returned in API responses
  • All required fields must be provided or the request will fail
  • Date of birth must be in ISO 8601 format (YYYY-MM-DD)

Build docs developers (and LLMs) love