curl --request PUT \
--url https://api.maxcare.ai/v1/patients/{id}/referring-provider \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Organization-Id: <x-organization-id>' \
--data '
{
"npi": "1255374757"
}
'import requests
url = "https://api.maxcare.ai/v1/patients/{id}/referring-provider"
payload = { "npi": "1255374757" }
headers = {
"X-Organization-Id": "<x-organization-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-Organization-Id': '<x-organization-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({npi: '1255374757'})
};
fetch('https://api.maxcare.ai/v1/patients/{id}/referring-provider', 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/v1/patients/{id}/referring-provider",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'npi' => '1255374757'
]),
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/v1/patients/{id}/referring-provider"
payload := strings.NewReader("{\n \"npi\": \"1255374757\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.maxcare.ai/v1/patients/{id}/referring-provider")
.header("X-Organization-Id", "<x-organization-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"npi\": \"1255374757\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.maxcare.ai/v1/patients/{id}/referring-provider")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Organization-Id"] = '<x-organization-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"npi\": \"1255374757\"\n}"
response = http.request(request)
puts response.read_body{
"code": "success",
"data": {
"patientId": "pat_c56103bcd39c46d39f3138dd2b5e05f6",
"npi": "1255374757",
"providerName": "Nazem Abdelfattah, MD",
"ehrProviderId": "ef7da13e-fe38-4cde-8d39-8f573e4684ba",
"addedToDirectory": true,
"changed": true,
"primaryReferringNpi": "1255374757"
}
}{
"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": "not_found",
"message": "Resource not found",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "conflict",
"message": "Cannot edit a signed note",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "controlled_substance_unsupported",
"message": "Controlled substances cannot be prescribed through the API",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"data": {}
}{
"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"
}Set a patient's referring provider
Adds the provider with this NPI as the patient’s referring provider in the EHR, keeping every other provider already on the chart. A provider the practice’s directory does not have yet is added to it from the national provider registry first (addedToDirectory: true). EZDerm: the provider joins the patient’s care team as the default referring physician; the other members stay on the team and lose the default flag. ModMed: the provider is added to the patient’s referring providers. ModMed has no default flag and keeps reporting the longest-standing referring provider as THE referring provider, so primaryReferringNpi can name another provider when the chart already had one; remove the other provider in ModMed if this one must be the only one. Calling it again with the same NPI writes nothing and returns changed: false. 422 npi_not_found when the NPI is not in the national registry; 422 chart_not_writable when the chart could not be read in full (data.reason: practice_data_unreadable) or, on EZDerm, the practice address book has too many providers with this last name to rule out an existing entry (directory_ambiguous); nothing is written in either case. If the EHR does not confirm the change the request fails with 409 ehr_write_uncertain: the provider may already be on the chart or in the directory, so read the chart before retrying. Send an Idempotency-Key header: a retry with the same NPI replays the original result for 24 hours. Requires write:patients.
curl --request PUT \
--url https://api.maxcare.ai/v1/patients/{id}/referring-provider \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Organization-Id: <x-organization-id>' \
--data '
{
"npi": "1255374757"
}
'import requests
url = "https://api.maxcare.ai/v1/patients/{id}/referring-provider"
payload = { "npi": "1255374757" }
headers = {
"X-Organization-Id": "<x-organization-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-Organization-Id': '<x-organization-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({npi: '1255374757'})
};
fetch('https://api.maxcare.ai/v1/patients/{id}/referring-provider', 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/v1/patients/{id}/referring-provider",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'npi' => '1255374757'
]),
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/v1/patients/{id}/referring-provider"
payload := strings.NewReader("{\n \"npi\": \"1255374757\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.maxcare.ai/v1/patients/{id}/referring-provider")
.header("X-Organization-Id", "<x-organization-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"npi\": \"1255374757\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.maxcare.ai/v1/patients/{id}/referring-provider")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Organization-Id"] = '<x-organization-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"npi\": \"1255374757\"\n}"
response = http.request(request)
puts response.read_body{
"code": "success",
"data": {
"patientId": "pat_c56103bcd39c46d39f3138dd2b5e05f6",
"npi": "1255374757",
"providerName": "Nazem Abdelfattah, MD",
"ehrProviderId": "ef7da13e-fe38-4cde-8d39-8f573e4684ba",
"addedToDirectory": true,
"changed": true,
"primaryReferringNpi": "1255374757"
}
}{
"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": "not_found",
"message": "Resource not found",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "conflict",
"message": "Cannot edit a signed note",
"trace_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"code": "controlled_substance_unsupported",
"message": "Controlled substances cannot be prescribed through the API",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"data": {}
}{
"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 key protecting retries for 24 hours
Target clinic organization ID
Path Parameters
Patient ID
Body
The referring provider's 10-digit NPI
^\d{10}$"1255374757"
