Skip to main content

Creating a patient

Create a patient using the FHIR Patient endpoint. The patient will need to have a valid US address to receive their home lab test.

For a patient to be eligible for lab orders, the following fields are required:

  • Patient name ("name")
  • Patient date of birth ("birthDate")
  • Patient address ("address")
  • Patient gender

For example:

curl -X POST https://api.kit.com/fhir/R4/Patient \
-H "Authorization: Bearer $MY_ACCESS_TOKEN" \
-H "Content-Type: application/fhir+json" \
-d '{
"resourceType":"Patient",
"name":[{"given":["Example"],"family":"Example"}],
"birthDate":"1990-01-01",
"gender":"male",
"address":[{
"line":["534 Erewhon St"],
"city": "PleasantVille",
"state": "Vic",
"postalCode": "3999"
}]
}'

On success, the response will return a Patient resource with additional metadata such as the Patient ID. Store the Patient ID for creating the order later.

For example:

{
"resourceType": "Patient",
...
"id": "3b9dc2ca-ff9b-4921-a61b-142420d382fa",
"meta": {
"versionId": "710585b2-a778-4dcf-8a94-08b00731b315",
"lastUpdated": "2021-08-26T20:08:48.378Z",
"project": "e244a3fb-dee3-4061-9411-e75a616636c1",
"author": {
"reference": "ClientApplication/402ec30c-b3da-4223-9bf1-d42ec301e628",
"display": "Sample App"
}
}
}

Provide your own identifiers

You can optionally provide your own identifiers for the patient using the identifier property. Here's an example providing both a social security number and an internal hospital ID:

curl -X POST https://api.kit.com/fhir/R4/Patient \
-H "Authorization: Bearer $MY_ACCESS_TOKEN" \
-H "Content-Type: application/fhir+json" \
-d '{
"resourceType":"Patient",
"identifier": [{
"system":"http://hl7.org/fhir/sid/us-ssn",
"value":"999-99-9999"
},
{"system":"www.myhospital.org/id",
"value":"mrn-89012654"}
],
"name":[{"given":["Example"],"family":"Example"}],
"birthDate":"1990-01-01",
"gender":"male",
"address":[{
"line":["534 Erewhon St"],
"city": "PleasantVille",
"state": "Vic",
"postalCode": "3999"
}]
}'

For more information about FHIR Patients: