curl --request POST \
--url https://api.maxcare.ai/v2/patients \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Organization-Id: <x-organization-id>' \
--data '
{
"firstName": "Jane",
"lastName": "Doe",
"dateOfBirth": "1984-02-11",
"middleName": "Marie",
"sex": "FEMALE",
"email": "jane@example.com",
"phones": [
{
"type": "CELL_PHONE",
"value": "+13135550123",
"preferred": true
}
],
"primaryFacilityId": "<string>",
"checkForDuplicates": true
}
'import requests
url = "https://api.maxcare.ai/v2/patients"
payload = {
"firstName": "Jane",
"lastName": "Doe",
"dateOfBirth": "1984-02-11",
"middleName": "Marie",
"sex": "FEMALE",
"email": "jane@example.com",
"phones": [
{
"type": "CELL_PHONE",
"value": "+13135550123",
"preferred": True
}
],
"primaryFacilityId": "<string>",
"checkForDuplicates": True
}
headers = {
"X-Organization-Id": "<x-organization-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Organization-Id': '<x-organization-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
firstName: 'Jane',
lastName: 'Doe',
dateOfBirth: '1984-02-11',
middleName: 'Marie',
sex: 'FEMALE',
email: 'jane@example.com',
phones: [{type: 'CELL_PHONE', value: '+13135550123', preferred: true}],
primaryFacilityId: '<string>',
checkForDuplicates: true
})
};
fetch('https://api.maxcare.ai/v2/patients', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.maxcare.ai/v2/patients",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'firstName' => 'Jane',
'lastName' => 'Doe',
'dateOfBirth' => '1984-02-11',
'middleName' => 'Marie',
'sex' => 'FEMALE',
'email' => 'jane@example.com',
'phones' => [
[
'type' => 'CELL_PHONE',
'value' => '+13135550123',
'preferred' => true
]
],
'primaryFacilityId' => '<string>',
'checkForDuplicates' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Organization-Id: <x-organization-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxcare.ai/v2/patients"
payload := strings.NewReader("{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"dateOfBirth\": \"1984-02-11\",\n \"middleName\": \"Marie\",\n \"sex\": \"FEMALE\",\n \"email\": \"jane@example.com\",\n \"phones\": [\n {\n \"type\": \"CELL_PHONE\",\n \"value\": \"+13135550123\",\n \"preferred\": true\n }\n ],\n \"primaryFacilityId\": \"<string>\",\n \"checkForDuplicates\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Organization-Id", "<x-organization-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.maxcare.ai/v2/patients")
.header("X-Organization-Id", "<x-organization-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"dateOfBirth\": \"1984-02-11\",\n \"middleName\": \"Marie\",\n \"sex\": \"FEMALE\",\n \"email\": \"jane@example.com\",\n \"phones\": [\n {\n \"type\": \"CELL_PHONE\",\n \"value\": \"+13135550123\",\n \"preferred\": true\n }\n ],\n \"primaryFacilityId\": \"<string>\",\n \"checkForDuplicates\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.maxcare.ai/v2/patients")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Organization-Id"] = '<x-organization-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"dateOfBirth\": \"1984-02-11\",\n \"middleName\": \"Marie\",\n \"sex\": \"FEMALE\",\n \"email\": \"jane@example.com\",\n \"phones\": [\n {\n \"type\": \"CELL_PHONE\",\n \"value\": \"+13135550123\",\n \"preferred\": true\n }\n ],\n \"primaryFacilityId\": \"<string>\",\n \"checkForDuplicates\": true\n}"
response = http.request(request)
puts response.read_body{
"code": "success",
"data": {
"patient": {
"id": "pat_c56103bcd39c46d39f3138dd2b5e05f6",
"externalId": "882731",
"mrn": "MM0000123456",
"created": true,
"insuranceAttached": null
},
"duplicateCandidateIds": []
}
}{
"code": "bad_request",
"message": "'id' must be a valid UUID",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "unauthorized",
"message": "Invalid or missing API key",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "forbidden",
"message": "Insufficient scope",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "conflict",
"message": "Cannot edit a signed note",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Maximum 1000 requests per 60 seconds.",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "unexpected_integration_error",
"message": "EHR sync failed",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "server_unresponsive",
"message": "EHR integration is not available for this note",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}Create a patient
Creates a patient chart in the EHR. With checkForDuplicates: true, a dedupe hit WITHHOLDS the write and returns 409 duplicate_candidates with the candidate ids — review them and either book against an existing chart or retry without the flag. Send an Idempotency-Key header to protect retries for 24 hours. An uncertain vendor outcome returns 409 ehr_write_uncertain with requiresReconciliation: true; verify the chart in the EHR before attempting another create. The same key remains protected during that retention period.
curl --request POST \
--url https://api.maxcare.ai/v2/patients \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Organization-Id: <x-organization-id>' \
--data '
{
"firstName": "Jane",
"lastName": "Doe",
"dateOfBirth": "1984-02-11",
"middleName": "Marie",
"sex": "FEMALE",
"email": "jane@example.com",
"phones": [
{
"type": "CELL_PHONE",
"value": "+13135550123",
"preferred": true
}
],
"primaryFacilityId": "<string>",
"checkForDuplicates": true
}
'import requests
url = "https://api.maxcare.ai/v2/patients"
payload = {
"firstName": "Jane",
"lastName": "Doe",
"dateOfBirth": "1984-02-11",
"middleName": "Marie",
"sex": "FEMALE",
"email": "jane@example.com",
"phones": [
{
"type": "CELL_PHONE",
"value": "+13135550123",
"preferred": True
}
],
"primaryFacilityId": "<string>",
"checkForDuplicates": True
}
headers = {
"X-Organization-Id": "<x-organization-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Organization-Id': '<x-organization-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
firstName: 'Jane',
lastName: 'Doe',
dateOfBirth: '1984-02-11',
middleName: 'Marie',
sex: 'FEMALE',
email: 'jane@example.com',
phones: [{type: 'CELL_PHONE', value: '+13135550123', preferred: true}],
primaryFacilityId: '<string>',
checkForDuplicates: true
})
};
fetch('https://api.maxcare.ai/v2/patients', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.maxcare.ai/v2/patients",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'firstName' => 'Jane',
'lastName' => 'Doe',
'dateOfBirth' => '1984-02-11',
'middleName' => 'Marie',
'sex' => 'FEMALE',
'email' => 'jane@example.com',
'phones' => [
[
'type' => 'CELL_PHONE',
'value' => '+13135550123',
'preferred' => true
]
],
'primaryFacilityId' => '<string>',
'checkForDuplicates' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Organization-Id: <x-organization-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxcare.ai/v2/patients"
payload := strings.NewReader("{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"dateOfBirth\": \"1984-02-11\",\n \"middleName\": \"Marie\",\n \"sex\": \"FEMALE\",\n \"email\": \"jane@example.com\",\n \"phones\": [\n {\n \"type\": \"CELL_PHONE\",\n \"value\": \"+13135550123\",\n \"preferred\": true\n }\n ],\n \"primaryFacilityId\": \"<string>\",\n \"checkForDuplicates\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Organization-Id", "<x-organization-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.maxcare.ai/v2/patients")
.header("X-Organization-Id", "<x-organization-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"dateOfBirth\": \"1984-02-11\",\n \"middleName\": \"Marie\",\n \"sex\": \"FEMALE\",\n \"email\": \"jane@example.com\",\n \"phones\": [\n {\n \"type\": \"CELL_PHONE\",\n \"value\": \"+13135550123\",\n \"preferred\": true\n }\n ],\n \"primaryFacilityId\": \"<string>\",\n \"checkForDuplicates\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.maxcare.ai/v2/patients")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Organization-Id"] = '<x-organization-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"firstName\": \"Jane\",\n \"lastName\": \"Doe\",\n \"dateOfBirth\": \"1984-02-11\",\n \"middleName\": \"Marie\",\n \"sex\": \"FEMALE\",\n \"email\": \"jane@example.com\",\n \"phones\": [\n {\n \"type\": \"CELL_PHONE\",\n \"value\": \"+13135550123\",\n \"preferred\": true\n }\n ],\n \"primaryFacilityId\": \"<string>\",\n \"checkForDuplicates\": true\n}"
response = http.request(request)
puts response.read_body{
"code": "success",
"data": {
"patient": {
"id": "pat_c56103bcd39c46d39f3138dd2b5e05f6",
"externalId": "882731",
"mrn": "MM0000123456",
"created": true,
"insuranceAttached": null
},
"duplicateCandidateIds": []
}
}{
"code": "bad_request",
"message": "'id' must be a valid UUID",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "unauthorized",
"message": "Invalid or missing API key",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "forbidden",
"message": "Insufficient scope",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "conflict",
"message": "Cannot edit a signed note",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Maximum 1000 requests per 60 seconds.",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "unexpected_integration_error",
"message": "EHR sync failed",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "server_unresponsive",
"message": "EHR integration is not available for this note",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}Authorizations
Marketplace API key
Headers
Client-generated UUID, honoured for 24 hours. Fails closed: if the idempotency store is unreachable the write is refused with 503 idempotency_unavailable and nothing reaches the EHR, rather than proceeding with the guarantee silently withdrawn. Omit the header to accept at-least-once instead.
Target clinic organization ID
Body
"Jane"
"Doe"
YYYY-MM-DD
"1984-02-11"
"Marie"
MALE | FEMALE | vendor value; the adapter maps it
"FEMALE"
"jane@example.com"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Primary facility ID (fac_…)
Ask the EHR to dedupe-check before committing. When candidates are found the write is WITHHELD and the response is 409 duplicate_candidates — surfacing that is what stops a booking flow creating duplicate charts.
true
Show child attributes
Show child attributes
Show child attributes
Show child attributes
