curl --request PATCH \
--url https://api.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"rxNumber": "<string>",
"fillDate": "2023-12-25",
"ndc": "<string>",
"drugName": "<string>",
"quantity": "<string>",
"daysSupply": 1825,
"prescriberName": "<string>",
"billedAmount": "<string>",
"prescriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"claimDocumentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"notes": "<string>"
}
'import requests
url = "https://api.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}"
payload = {
"rxNumber": "<string>",
"fillDate": "2023-12-25",
"ndc": "<string>",
"drugName": "<string>",
"quantity": "<string>",
"daysSupply": 1825,
"prescriberName": "<string>",
"billedAmount": "<string>",
"prescriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"claimDocumentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"notes": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
rxNumber: '<string>',
fillDate: '2023-12-25',
ndc: '<string>',
drugName: '<string>',
quantity: '<string>',
daysSupply: 1825,
prescriberName: '<string>',
billedAmount: '<string>',
prescriptionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
claimDocumentId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
notes: '<string>'
})
};
fetch('https://api.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}', 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.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'rxNumber' => '<string>',
'fillDate' => '2023-12-25',
'ndc' => '<string>',
'drugName' => '<string>',
'quantity' => '<string>',
'daysSupply' => 1825,
'prescriberName' => '<string>',
'billedAmount' => '<string>',
'prescriptionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'claimDocumentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'notes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}"
payload := strings.NewReader("{\n \"rxNumber\": \"<string>\",\n \"fillDate\": \"2023-12-25\",\n \"ndc\": \"<string>\",\n \"drugName\": \"<string>\",\n \"quantity\": \"<string>\",\n \"daysSupply\": 1825,\n \"prescriberName\": \"<string>\",\n \"billedAmount\": \"<string>\",\n \"prescriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"claimDocumentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"notes\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-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.patch("https://api.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"rxNumber\": \"<string>\",\n \"fillDate\": \"2023-12-25\",\n \"ndc\": \"<string>\",\n \"drugName\": \"<string>\",\n \"quantity\": \"<string>\",\n \"daysSupply\": 1825,\n \"prescriberName\": \"<string>\",\n \"billedAmount\": \"<string>\",\n \"prescriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"claimDocumentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rxNumber\": \"<string>\",\n \"fillDate\": \"2023-12-25\",\n \"ndc\": \"<string>\",\n \"drugName\": \"<string>\",\n \"quantity\": \"<string>\",\n \"daysSupply\": 1825,\n \"prescriberName\": \"<string>\",\n \"billedAmount\": \"<string>\",\n \"prescriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"claimDocumentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"medCaseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"medReferralId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"externalId": "<string>",
"rxNumber": "<string>",
"fillDate": "2023-12-25",
"ndc": "<string>",
"drugName": "<string>",
"quantity": "<string>",
"daysSupply": 1825,
"prescriberName": "<string>",
"billedAmount": "<string>",
"prescriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"claimDocumentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"notes": "<string>",
"voidedAt": "2023-11-07T05:31:56Z",
"voidReason": "<string>",
"createdVia": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}Edit a pharmacy fill
Changes any fill field except externalId and the void fields; send at least one field. Changing billedAmount changes the balance, and the activity log records the old and new amount. Requires a provider-scoped key (cxpp_) for a pharmacy practice at STANDARD tier, on the practice’s own referral. Firm keys receive 403 wrong_scope; a non-pharmacy practice receives 403 pharmacy_only; another practice’s referral is 404. Writes are accepted while the referral is accepted, in treatment, treatment complete, closed or withdrawn — payments often arrive after the firm closes the case — and refused with 409 referral_not_writable while sent, under review, rejected or archived. Restricted-access practices receive 403 restricted_access. A voided fill cannot be edited (409 fill_voided). Emits a pharmacy_fill.updated webhook.
curl --request PATCH \
--url https://api.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"rxNumber": "<string>",
"fillDate": "2023-12-25",
"ndc": "<string>",
"drugName": "<string>",
"quantity": "<string>",
"daysSupply": 1825,
"prescriberName": "<string>",
"billedAmount": "<string>",
"prescriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"claimDocumentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"notes": "<string>"
}
'import requests
url = "https://api.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}"
payload = {
"rxNumber": "<string>",
"fillDate": "2023-12-25",
"ndc": "<string>",
"drugName": "<string>",
"quantity": "<string>",
"daysSupply": 1825,
"prescriberName": "<string>",
"billedAmount": "<string>",
"prescriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"claimDocumentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"notes": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
rxNumber: '<string>',
fillDate: '2023-12-25',
ndc: '<string>',
drugName: '<string>',
quantity: '<string>',
daysSupply: 1825,
prescriberName: '<string>',
billedAmount: '<string>',
prescriptionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
claimDocumentId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
notes: '<string>'
})
};
fetch('https://api.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}', 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.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'rxNumber' => '<string>',
'fillDate' => '2023-12-25',
'ndc' => '<string>',
'drugName' => '<string>',
'quantity' => '<string>',
'daysSupply' => 1825,
'prescriberName' => '<string>',
'billedAmount' => '<string>',
'prescriptionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'claimDocumentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'notes' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}"
payload := strings.NewReader("{\n \"rxNumber\": \"<string>\",\n \"fillDate\": \"2023-12-25\",\n \"ndc\": \"<string>\",\n \"drugName\": \"<string>\",\n \"quantity\": \"<string>\",\n \"daysSupply\": 1825,\n \"prescriberName\": \"<string>\",\n \"billedAmount\": \"<string>\",\n \"prescriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"claimDocumentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"notes\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-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.patch("https://api.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"rxNumber\": \"<string>\",\n \"fillDate\": \"2023-12-25\",\n \"ndc\": \"<string>\",\n \"drugName\": \"<string>\",\n \"quantity\": \"<string>\",\n \"daysSupply\": 1825,\n \"prescriberName\": \"<string>\",\n \"billedAmount\": \"<string>\",\n \"prescriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"claimDocumentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.casexchange.com/api/public/v1/med-cases/{caseId}/referrals/{referralId}/pharmacy/fills/{fillId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rxNumber\": \"<string>\",\n \"fillDate\": \"2023-12-25\",\n \"ndc\": \"<string>\",\n \"drugName\": \"<string>\",\n \"quantity\": \"<string>\",\n \"daysSupply\": 1825,\n \"prescriberName\": \"<string>\",\n \"billedAmount\": \"<string>\",\n \"prescriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"claimDocumentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"medCaseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"medReferralId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"externalId": "<string>",
"rxNumber": "<string>",
"fillDate": "2023-12-25",
"ndc": "<string>",
"drugName": "<string>",
"quantity": "<string>",
"daysSupply": 1825,
"prescriberName": "<string>",
"billedAmount": "<string>",
"prescriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"claimDocumentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"notes": "<string>",
"voidedAt": "2023-11-07T05:31:56Z",
"voidReason": "<string>",
"createdVia": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"meta": {
"requestId": "req_f2dbe1d3f6ad4a7bb5b4c9f2",
"timestamp": "2023-11-07T05:31:56Z"
}
}Authorizations
Public API key: cxp_<hex> (firm-scoped) or cxpp_<hex> (provider-scoped). Required on every request.
Path Parameters
Med case UUID: medCaseId in the referral.* webhook payload, or the id from GET /med-cases.
Med referral UUID: the referral of this case to your pharmacy practice. Find it with GET /med-cases/{id}/referrals, or take it from the referral.* webhook payload.
Pharmacy fill UUID
Body
Partial update: at least one field; omitted fields are unchanged. externalId and the void fields cannot be changed. A voided fill cannot be updated (409 fill_voided).
1 - 50YYYY-MM-DD, a real calendar date.
1 - 500^\d{1,9}(\.\d{1,3})?$0 <= x <= 3650300Non-negative decimal string, e.g. "40.00".
^\d{1,10}(\.\d{1,2})?$2000
