← Technical API reference

Backend resource · STATIC DECLARATIONS

Patient API reference · mansoq-core

Static source contract for Patient: 19 declared or inherited operation mappings, schema/field evidence and authorization/refusal references. Deployment and behavioral review remain explicit.

Static API contract — behavior review pending. Source baseline f6e9f05f76d4.

Enable JavaScript to inspect structured operation, parameter, schema and permission evidence. Download this reference and its evidence.

Declared route and availability

This resource is declared in mansoq-core at /api/v1/patient/. verified core mount in config/urls.py A registered path and an indexed handler do not prove deployment availability, user permission or production readiness.

Operation map

Method Path Action Evidence
GET /api/v1/patient/ list declared/inherited method
POST /api/v1/patient/ create declared/inherited method
GET /api/v1/patient/{external_id}/ retrieve declared/inherited method
PUT /api/v1/patient/{external_id}/ update declared/inherited method
PATCH /api/v1/patient/{external_id}/ partial_update declared/inherited method
DELETE /api/v1/patient/{external_id}/ destroy declared/inherited method
POST /api/v1/patient/upsert/ upsert @action declaration
POST /api/v1/patient/search/ search @action declaration
POST /api/v1/patient/search_retrieve/ search_retrieve @action declaration
GET /api/v1/patient/{external_id}/get_users/ get_users @action declaration
POST /api/v1/patient/{external_id}/add_user/ add_user @action declaration
POST /api/v1/patient/{external_id}/delete_user/ delete_user @action declaration
GET /api/v1/patient/{external_id}/get_appointments/ get_appointments @action declaration
GET /api/v1/patient/{external_id}/get_tokens/ get_tokens @action declaration
POST /api/v1/patient/{external_id}/update_identifier/ update_identifier @action declaration
POST /api/v1/patient/{external_id}/set_instance_tags/ set_instance_tags @action declaration
POST /api/v1/patient/{external_id}/remove_instance_tags/ remove_instance_tags @action declaration
POST /api/v1/patient/{external_id}/set_facility_tags/ set_facility_tags @action declaration
POST /api/v1/patient/{external_id}/remove_facility_tags/ remove_facility_tags @action declaration

list · GET

GET /api/v1/patient/ — action list. static contract extracted; runtime/permission/payload behavior review pending.

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

response: PatientListSpec. Declared fields below; inherited fields are retained in the schema inventory.

Field Type Required Constraints
meta dict false No extra constraint extracted
id UUID4 | None false No extra constraint extracted
name str true No extra constraint extracted
gender GenderChoices true No extra constraint extracted
phone_number PhoneNumber true max_length: 14
emergency_phone_number PhoneNumber | None false max_length: 14
address str | None false No extra constraint extracted
permanent_address str | None false No extra constraint extracted
pincode int | None false No extra constraint extracted
deceased_datetime StrictTZAwareDateTime | None false No extra constraint extracted
blood_group BloodGroupChoices | None false No extra constraint extracted
extensions dict false No extra constraint extracted
date_of_birth datetime.date | None false No extra constraint extracted
year_of_birth datetime.date | None false No extra constraint extracted
created_date datetime.datetime true No extra constraint extracted
modified_date datetime.datetime true No extra constraint extracted
instance_tags list[dict] false No extra constraint extracted
facility_tags list[dict] false No extra constraint extracted

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_list_facility_tag_config. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: PermissionDenied: Cannot view facility tags.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

create · POST

POST /api/v1/patient/ — action create. static contract extracted; runtime/permission/payload behavior review pending.

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

request: PatientCreateSpec. Declared fields below; inherited fields are retained in the schema inventory.

Field Type Required Constraints
meta dict false No extra constraint extracted
id UUID4 | None false No extra constraint extracted
name str true No extra constraint extracted
gender GenderChoices true No extra constraint extracted
phone_number PhoneNumber true max_length: 14
emergency_phone_number PhoneNumber | None false max_length: 14
address str | None false No extra constraint extracted
permanent_address str | None false No extra constraint extracted
pincode int | None false No extra constraint extracted
deceased_datetime StrictTZAwareDateTime | None false No extra constraint extracted
blood_group BloodGroupChoices | None false No extra constraint extracted
extensions dict false No extra constraint extracted
geo_organization UUID4 true No extra constraint extracted
date_of_birth datetime.date | None false No extra constraint extracted
age int | None false No extra constraint extracted
identifiers list[PatientIdentifierConfigRequest] false No extra constraint extracted
tags list[UUID4] false No extra constraint extracted

response: PatientRetrieveSpec. Declared fields below; inherited fields are retained in the schema inventory.

Field Type Required Constraints
meta dict false No extra constraint extracted
permissions list[str] false No extra constraint extracted
id UUID4 | None false No extra constraint extracted
name str true No extra constraint extracted
gender GenderChoices true No extra constraint extracted
phone_number PhoneNumber true max_length: 14
emergency_phone_number PhoneNumber | None false max_length: 14
address str | None false No extra constraint extracted
permanent_address str | None false No extra constraint extracted
pincode int | None false No extra constraint extracted
deceased_datetime StrictTZAwareDateTime | None false No extra constraint extracted
blood_group BloodGroupChoices | None false No extra constraint extracted
extensions dict true No extra constraint extracted
date_of_birth datetime.date | None false No extra constraint extracted
year_of_birth datetime.date | None false No extra constraint extracted
created_date datetime.datetime true No extra constraint extracted
modified_date datetime.datetime true No extra constraint extracted
instance_tags list[dict] false No extra constraint extracted
facility_tags list[dict] false No extra constraint extracted
geo_organization dict false No extra constraint extracted
created_by dict | None false No extra constraint extracted
updated_by dict | None false No extra constraint extracted
instance_identifiers list[PatientIdentifierResponse] false No extra constraint extracted
facility_identifiers list[PatientIdentifierResponse] false No extra constraint extracted

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_create_patient. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: PermissionDenied: Cannot Create Patient; ValidationError: Date of birth cannot be after the date of death; ValidationError: Year of birth cannot be after the year of death; ValidationError: Patient creation failed, try again after a while.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

retrieve · GET

GET /api/v1/patient/{external_id}/ — action retrieve. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

response: PatientRetrieveSpec. Declared fields below; inherited fields are retained in the schema inventory.

The declared field table is shown at its first occurrence in this reference; this operation links the same schema.

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_list_facility_tag_config. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: PermissionDenied: Cannot view facility tags.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

update · PUT

PUT /api/v1/patient/{external_id}/ — action update. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

request: PatientUpdateSpec. Declared fields below; inherited fields are retained in the schema inventory.

Field Type Required Constraints
meta dict false No extra constraint extracted
id UUID4 | None false No extra constraint extracted
name str | None false No extra constraint extracted
gender GenderChoices | None false No extra constraint extracted
phone_number PhoneNumber | None false max_length: 14
emergency_phone_number PhoneNumber | None false max_length: 14
address str | None false No extra constraint extracted
permanent_address str | None false No extra constraint extracted
pincode int | None false No extra constraint extracted
deceased_datetime StrictTZAwareDateTime | None false No extra constraint extracted
blood_group BloodGroupChoices | None false No extra constraint extracted
extensions dict false No extra constraint extracted
date_of_birth datetime.date | None false No extra constraint extracted
age int | None false No extra constraint extracted
geo_organization UUID4 | None false No extra constraint extracted
identifiers list[PatientIdentifierConfigRequest] false No extra constraint extracted

response: PatientRetrieveSpec. Declared fields below; inherited fields are retained in the schema inventory.

The declared field table is shown at its first occurrence in this reference; this operation links the same schema.

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_write_patient_obj. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: PermissionDenied: Cannot Update Patient; ValidationError: Date of birth cannot be after the date of death; ValidationError: Year of birth cannot be after the year of death.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

partial_update · PATCH

PATCH /api/v1/patient/{external_id}/ — action partial_update. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

request: PatientUpdateSpec. Declared fields below; inherited fields are retained in the schema inventory.

The declared field table is shown at its first occurrence in this reference; this operation links the same schema.

response: PatientRetrieveSpec. Declared fields below; inherited fields are retained in the schema inventory.

The declared field table is shown at its first occurrence in this reference; this operation links the same schema.

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_write_patient_obj. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: ValidationError: Date of birth cannot be after the date of death; ValidationError: Year of birth cannot be after the year of death; PermissionDenied: Cannot Update Patient.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

destroy · DELETE

DELETE /api/v1/patient/{external_id}/ — action destroy. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

Observed authorization checks: get_filtered_patients, can_view_clinical_data. Helper/queryset evidence is included; this is not proof of complete security review.

Explicit response statuses in observed code: status.HTTP_204_NO_CONTENT. Other branches/framework exception handling may differ.

Declared refusal/error evidence: PermissionDenied: Cannot delete patient.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

upsert · POST

POST /api/v1/patient/upsert/ — action upsert. static contract extracted; runtime/permission/payload behavior review pending.

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
body datapoints not declared at read site not established
query organization not declared at read site direct indexing; validation may be upstream

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_write_patient_obj, can_create_patient. Helper/queryset evidence is included; this is not proof of complete security review.

Explicit response statuses in observed code: 400. Other branches/framework exception handling may differ.

Declared refusal/error evidence: RestFrameworkValidationError: Invalid request data; RestFrameworkValidationError: No datapoints provided; RestFrameworkValidationError: Too many datapoints provided; ValidationError: Date of birth cannot be after the date of death; ValidationError: Year of birth cannot be after the year of death; PermissionDenied: Cannot Update Patient; PermissionDenied: Cannot Create Patient; ValidationError: Patient creation failed, try again after a while.

Conditional gates: conditional/computed expression; inspect pinned declaration comparison settings.MAX_DATAPOINTS_PER_UPSERT; settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

search · POST

POST /api/v1/patient/search/ — action search. static contract extracted; runtime/permission/payload behavior review pending.

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

Observed authorization checks: can_list_facility_patient_identifier_config, get_filtered_patients, can_view_clinical_data. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: ValidationError: Either phone number or config is required; ValidationError: Config not found; PermissionDenied: Cannot search for patient identifier configs in this facility; ValidationError: Value is required.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

search_retrieve · POST

POST /api/v1/patient/search_retrieve/ — action search_retrieve. static contract extracted; runtime/permission/payload behavior review pending.

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

decorator responses: PatientRetrieveSpec. Declared fields below; inherited fields are retained in the schema inventory.

The declared field table is shown at its first occurrence in this reference; this operation links the same schema.

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_list_facility_tag_config. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: PermissionDenied: No valid patients found; PermissionDenied: Cannot view facility tags.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

Direct refusal present: the handler/helper contains a top-level raise. Review whether the operation is intentionally disabled or only performs validation before relying on it.

get_users · GET

GET /api/v1/patient/{external_id}/get_users/ — action get_users. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

Observed authorization checks: get_filtered_patients, can_view_clinical_data. Helper/queryset evidence is included; this is not proof of complete security review.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

add_user · POST

POST /api/v1/patient/{external_id}/add_user/ — action add_user. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

decorator responses: UserSpec. Declared fields below; inherited fields are retained in the schema inventory.

Field Type Required Constraints
meta dict false No extra constraint extracted
id UUID4 | None false No extra constraint extracted
first_name str true No extra constraint extracted
last_name str true No extra constraint extracted
phone_number str true max_length: 14
prefix str | None false max_length: 10
suffix str | None false max_length: 50
last_login str true No extra constraint extracted
profile_picture_url str true No extra constraint extracted
gender str true No extra constraint extracted
username str true No extra constraint extracted
mfa_enabled bool false No extra constraint extracted
deleted bool false No extra constraint extracted
role_orgs dict true No extra constraint extracted

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_write_patient_obj. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: ValidationError: User already exists; PermissionDenied: Cannot Update Patient.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

delete_user · POST

POST /api/v1/patient/{external_id}/delete_user/ — action delete_user. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_write_patient_obj. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: ValidationError: User does not exist; PermissionDenied: Cannot Update Patient.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

get_appointments · GET

GET /api/v1/patient/{external_id}/get_appointments/ — action get_appointments. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query facility not declared at read site not established
query organization not declared at read site direct indexing; validation may be upstream

Observed authorization checks: can_list_booking_on_facility, get_filtered_patients, can_view_clinical_data. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: PermissionDenied: Cannot list bookings.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

get_tokens · GET

GET /api/v1/patient/{external_id}/get_tokens/ — action get_tokens. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query facility not declared at read site not established
query organization not declared at read site direct indexing; validation may be upstream

Observed authorization checks: can_list_token_on_facility, get_filtered_patients, can_view_clinical_data. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: PermissionDenied: Cannot list tokens.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

update_identifier · POST

POST /api/v1/patient/{external_id}/update_identifier/ — action update_identifier. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

decorator request: PatientIdentifierConfigRequest. Declared fields below; inherited fields are retained in the schema inventory.

Field Type Required Constraints
config UUID4 true No extra constraint extracted
value str true No extra constraint extracted

decorator responses: PatientRetrieveSpec. Declared fields below; inherited fields are retained in the schema inventory.

The declared field table is shown at its first occurrence in this reference; this operation links the same schema.

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_write_patient_obj. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: ValidationError: Cannot update auto maintained identifier; ValidationError: Value is required; PermissionDenied: Cannot Update Patient.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

set_instance_tags · POST

POST /api/v1/patient/{external_id}/set_instance_tags/ — action set_instance_tags. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_write_patient_obj, can_list_facility_tag_config. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: PermissionDenied: Cannot Update Patient; PermissionDenied: Cannot view facility tags.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

remove_instance_tags · POST

POST /api/v1/patient/{external_id}/remove_instance_tags/ — action remove_instance_tags. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_write_patient_obj, can_list_facility_tag_config. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: PermissionDenied: Cannot Update Patient; PermissionDenied: Cannot view facility tags.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

set_facility_tags · POST

POST /api/v1/patient/{external_id}/set_facility_tags/ — action set_facility_tags. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_write_patient_obj, can_list_facility_tag_config. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: PermissionDenied: Cannot Update Patient; PermissionDenied: Cannot view facility tags.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

remove_facility_tags · POST

POST /api/v1/patient/{external_id}/remove_facility_tags/ — action remove_facility_tags. static contract extracted; runtime/permission/payload behavior review pending.

Path and deployment-context parameters:

Location Parameter Type Required
path external_id router lookup string; semantic ID validation requires handler/schema review true

Directly observed request reads (these do not constitute a complete accepted-payload or requiredness guarantee):

Location Field Declared/inferred read type Requiredness evidence
query organization not declared at read site direct indexing; validation may be upstream

Observed authorization checks: get_filtered_patients, can_view_clinical_data, can_write_patient_obj, can_list_facility_tag_config. Helper/queryset evidence is included; this is not proof of complete security review.

Declared refusal/error evidence: PermissionDenied: Cannot Update Patient; PermissionDenied: Cannot view facility tags.

Conditional gates: settings.PATIENT_GLOBAL_EDIT_ACCESS_ENABLED.

Integration review checklist

Confirm the installed route and full schema; review authentication, organization/facility scoping, all accepted fields, value-state and date/time semantics, idempotency, pagination, response/exception branches and the allowed correction/reversal workflow. Test positive and negative cases with synthetic data. This source reference does not establish external certification or replace an illustrated user procedure.

Pinned source evidence

Links require access to the private source repository.