curl --request POST \
--url https://api.decodahealth.com/faxes/{fax_id}/link-patient \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TENANT: <tenant>' \
--data '
{
"patientId": "<string>",
"title": "<string>",
"docType": "<string>"
}
'import requests
url = "https://api.decodahealth.com/faxes/{fax_id}/link-patient"
payload = {
"patientId": "<string>",
"title": "<string>",
"docType": "<string>"
}
headers = {
"TENANT": "<tenant>",
"API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {TENANT: '<tenant>', 'API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({patientId: '<string>', title: '<string>', docType: '<string>'})
};
fetch('https://api.decodahealth.com/faxes/{fax_id}/link-patient', 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.decodahealth.com/faxes/{fax_id}/link-patient",
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([
'patientId' => '<string>',
'title' => '<string>',
'docType' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"API-KEY: <api-key>",
"Content-Type: application/json",
"TENANT: <tenant>"
],
]);
$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.decodahealth.com/faxes/{fax_id}/link-patient"
payload := strings.NewReader("{\n \"patientId\": \"<string>\",\n \"title\": \"<string>\",\n \"docType\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TENANT", "<tenant>")
req.Header.Add("API-KEY", "<api-key>")
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.decodahealth.com/faxes/{fax_id}/link-patient")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"patientId\": \"<string>\",\n \"title\": \"<string>\",\n \"docType\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/faxes/{fax_id}/link-patient")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TENANT"] = '<tenant>'
request["API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"patientId\": \"<string>\",\n \"title\": \"<string>\",\n \"docType\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"fax": {
"id": "<string>",
"signalwireFaxSid": "<string>",
"phoneNumberId": "<string>",
"phoneNumberE164": "<string>",
"faxContact": {
"id": "<string>",
"name": "<string>",
"faxNumber": "<string>",
"organization": "<string>",
"notes": "<string>",
"addressLineOne": "<string>",
"addressLineTwo": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>",
"createdByUserId": "<string>"
},
"numPages": 123,
"cost": "<string>",
"errorCode": "<string>",
"errorMessage": "<string>",
"pdfPath": "<string>",
"sentAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"createdByUserId": "<string>",
"createdDate": "2023-11-07T05:31:56Z",
"updatedDate": "2023-11-07T05:31:56Z",
"patientId": "<string>",
"patient": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>"
},
"filedDocument": {
"id": "<string>",
"title": "<string>",
"docType": "<string>"
},
"readDate": "2023-11-07T05:31:56Z",
"attachments": [
{
"id": "<string>",
"filename": "<string>",
"gcsPath": "<string>",
"displayOrder": 123,
"documentId": "<string>"
}
],
"analysis": {
"errorMessage": "<string>",
"extraction": {
"patientFirstName": "<string>",
"patientLastName": "<string>",
"patientDateOfBirth": "<string>",
"patientPhone": "<string>",
"patientMrn": "<string>",
"requestingProviderName": "<string>",
"documentCategory": "<string>",
"summary": "<string>",
"keySections": [
{
"heading": "<string>",
"content": "<string>"
}
],
"suggestedDocumentTitle": "<string>",
"suggestedDocType": "<string>",
"suggestedNoteTemplateId": "<string>"
},
"suggestedPatient": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>"
},
"patientMatchReason": "<string>",
"suggestedTemplate": {
"id": "<string>",
"name": "<string>"
},
"suggestedProvider": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>"
},
"createdNoteId": "<string>",
"createdTaskId": "<string>",
"patientSuggestionDismissedAt": "2023-11-07T05:31:56Z",
"noteSuggestionDismissedAt": "2023-11-07T05:31:56Z",
"taskSuggestionDismissedAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z"
}
},
"affectedDocument": {
"id": "<string>",
"patientId": "<string>",
"filePath": "<string>",
"fileType": "<string>",
"title": "<string>",
"summary": "<string>",
"docType": "<string>",
"signatureUrl": "<string>",
"expiryDate": "2023-12-25",
"createdDate": "2023-11-07T05:31:56Z",
"updatedDate": "2023-11-07T05:31:56Z",
"noteIds": [],
"sourceNoteId": "<string>",
"reviewedByProviderId": "<string>",
"reviewedDate": "2023-11-07T05:31:56Z",
"reviewComment": "<string>",
"sharedWithPatient": false,
"sharedDate": "2023-11-07T05:31:56Z",
"sharedByProviderId": "<string>",
"patientMessage": "<string>",
"sourceAnsweredFormId": "<string>",
"sourceFormId": "<string>",
"sourceFormName": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Link Fax To Patient
File an inbound fax into a patient’s chart.
Creates a Document whose file_path references the fax’s own PDF
(fax.pdf_path) — no copy, one object shared by the fax and the chart
document — carrying source_fax_id. That filed Document is the
fax↔patient link; the fax row stores no patient. Re-linking to a different
patient just moves patient_id on that one Document (nothing to re-copy).
Manual by design — the system can’t know which patient a fax belongs to, so a
human picks; the same endpoint is the seam a later auto-suggest phase
pre-fills into.
curl --request POST \
--url https://api.decodahealth.com/faxes/{fax_id}/link-patient \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TENANT: <tenant>' \
--data '
{
"patientId": "<string>",
"title": "<string>",
"docType": "<string>"
}
'import requests
url = "https://api.decodahealth.com/faxes/{fax_id}/link-patient"
payload = {
"patientId": "<string>",
"title": "<string>",
"docType": "<string>"
}
headers = {
"TENANT": "<tenant>",
"API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {TENANT: '<tenant>', 'API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({patientId: '<string>', title: '<string>', docType: '<string>'})
};
fetch('https://api.decodahealth.com/faxes/{fax_id}/link-patient', 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.decodahealth.com/faxes/{fax_id}/link-patient",
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([
'patientId' => '<string>',
'title' => '<string>',
'docType' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"API-KEY: <api-key>",
"Content-Type: application/json",
"TENANT: <tenant>"
],
]);
$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.decodahealth.com/faxes/{fax_id}/link-patient"
payload := strings.NewReader("{\n \"patientId\": \"<string>\",\n \"title\": \"<string>\",\n \"docType\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TENANT", "<tenant>")
req.Header.Add("API-KEY", "<api-key>")
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.decodahealth.com/faxes/{fax_id}/link-patient")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"patientId\": \"<string>\",\n \"title\": \"<string>\",\n \"docType\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/faxes/{fax_id}/link-patient")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TENANT"] = '<tenant>'
request["API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"patientId\": \"<string>\",\n \"title\": \"<string>\",\n \"docType\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"fax": {
"id": "<string>",
"signalwireFaxSid": "<string>",
"phoneNumberId": "<string>",
"phoneNumberE164": "<string>",
"faxContact": {
"id": "<string>",
"name": "<string>",
"faxNumber": "<string>",
"organization": "<string>",
"notes": "<string>",
"addressLineOne": "<string>",
"addressLineTwo": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>",
"createdByUserId": "<string>"
},
"numPages": 123,
"cost": "<string>",
"errorCode": "<string>",
"errorMessage": "<string>",
"pdfPath": "<string>",
"sentAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"createdByUserId": "<string>",
"createdDate": "2023-11-07T05:31:56Z",
"updatedDate": "2023-11-07T05:31:56Z",
"patientId": "<string>",
"patient": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>"
},
"filedDocument": {
"id": "<string>",
"title": "<string>",
"docType": "<string>"
},
"readDate": "2023-11-07T05:31:56Z",
"attachments": [
{
"id": "<string>",
"filename": "<string>",
"gcsPath": "<string>",
"displayOrder": 123,
"documentId": "<string>"
}
],
"analysis": {
"errorMessage": "<string>",
"extraction": {
"patientFirstName": "<string>",
"patientLastName": "<string>",
"patientDateOfBirth": "<string>",
"patientPhone": "<string>",
"patientMrn": "<string>",
"requestingProviderName": "<string>",
"documentCategory": "<string>",
"summary": "<string>",
"keySections": [
{
"heading": "<string>",
"content": "<string>"
}
],
"suggestedDocumentTitle": "<string>",
"suggestedDocType": "<string>",
"suggestedNoteTemplateId": "<string>"
},
"suggestedPatient": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>"
},
"patientMatchReason": "<string>",
"suggestedTemplate": {
"id": "<string>",
"name": "<string>"
},
"suggestedProvider": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>"
},
"createdNoteId": "<string>",
"createdTaskId": "<string>",
"patientSuggestionDismissedAt": "2023-11-07T05:31:56Z",
"noteSuggestionDismissedAt": "2023-11-07T05:31:56Z",
"taskSuggestionDismissedAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z"
}
},
"affectedDocument": {
"id": "<string>",
"patientId": "<string>",
"filePath": "<string>",
"fileType": "<string>",
"title": "<string>",
"summary": "<string>",
"docType": "<string>",
"signatureUrl": "<string>",
"expiryDate": "2023-12-25",
"createdDate": "2023-11-07T05:31:56Z",
"updatedDate": "2023-11-07T05:31:56Z",
"noteIds": [],
"sourceNoteId": "<string>",
"reviewedByProviderId": "<string>",
"reviewedDate": "2023-11-07T05:31:56Z",
"reviewComment": "<string>",
"sharedWithPatient": false,
"sharedDate": "2023-11-07T05:31:56Z",
"sharedByProviderId": "<string>",
"patientMessage": "<string>",
"sourceAnsweredFormId": "<string>",
"sourceFormId": "<string>",
"sourceFormName": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
The tenant you are making this request on behalf of
Your api key
Path Parameters
Body
Body for POST /faxes/{fax_id}/link-patient.
Files an inbound fax into a patient's chart: creates a Document that
references the fax's own PDF (no copy) and carries source_fax_id. The
fax↔patient link is derived from that filed Document, not stored on the fax
row.
Response
Successful Response
Result of link-patient / unlink-patient: the updated fax plus the
chart document the action created, moved, or archived.
Returning both lets the client patch the fax detail cache and the patient's
chart document list straight from the response — no refetch — the same way
send-fax and the fax-contact mutations update their caches. affected_document
is null only on the idempotent unlink-when-nothing-was-filed path, where no
document changed.
