Referrals
18 endpoints
Patient Attributions
4 endpoints
/api/v1/{org_id}/patients/{patient_uuid}/referral-attributionsList patient attributions
List referral attributions for a patient with pagination. Returns attribution records showing how this patient was acquired. Each record links to exactly one source: a marketing referral source, referral partner, in-house provider, or referring patient. Error conditions: - 404: Patient not found.
Parameters
Path Parameters
patient_uuidstringrequiredorg_idstringrequiredQuery Parameters
pageintegerPage number (1-based).
Default: 1
page_sizeintegerNumber of records per page.
Default: 50
Responses
itemsobject[]requiredList of referral attributions for the patient.
pageintegerrequiredCurrent page number (1-based).
page_sizeintegerrequiredNumber of records per page.
totalintegerrequiredTotal number of attributions.
detailobject[]curl -X GET "https://api.example.com/api/v1/{org_id}/patients/{patient_uuid}/referral-attributions" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"curl -X GET "https://api.example.com/api/v1/{org_id}/patients/{patient_uuid}/referral-attributions" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"/api/v1/{org_id}/patients/{patient_uuid}/referral-attributionsCreate patient attribution
Record a referral attribution for a patient. Tracks how this patient was acquired. Exactly one source reference must be provided (referral_source_uuid, referral_partner_uuid, provider_uuid, or referring_patient_uuid). Only one active 'primary' attribution is allowed per patient. Error conditions: - 404: Patient or referenced source/partner/provider not found. - 409: Patient already has a primary attribution. - 422: No source provided, or multiple sources provided.
Parameters
Path Parameters
patient_uuidstringrequiredorg_idstringrequiredRequest Body
attribution_roleenumRole of this attribution in the patient's acquisition. One of: primary (first-touch attribution set at intake), secondary (additional touchpoint), assist (contributing factor).
assistprimarysecondaryprovider_uuidstring (uuid)referral_partner_uuidstring (uuid)referral_source_uuidstring (uuid)referring_patient_uuidstring (uuid)source_notestringResponses
attributed_atstring (date-time)requiredTimestamp when the attribution was recorded.
attribution_roleenumRole of this attribution in the patient's acquisition. One of: primary (first-touch attribution set at intake), secondary (additional touchpoint), assist (contributing factor).
assistprimarysecondarycreated_atstring (date-time)requiredTimestamp when the record was created.
idstring (uuid)requiredUnique identifier of the attribution record.
patientobjectrequiredLightweight reference to a related entity — exposes UUID and optional name.
providerobjectLightweight reference to a related entity — exposes UUID and optional name.
referral_partnerobjectLightweight reference to a related entity — exposes UUID and optional name.
referral_sourceobjectLightweight reference to a related entity — exposes UUID and optional name.
referring_patientobjectLightweight reference to a related entity — exposes UUID and optional name.
source_notestringupdated_atstring (date-time)requiredTimestamp when the record was last updated.
versionintegerrequiredOptimistic concurrency version number.
detailobject[]curl -X POST "https://api.example.com/api/v1/{org_id}/patients/{patient_uuid}/referral-attributions" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"attribution_role": "assist",
"provider_uuid": "string",
"referral_partner_uuid": "string",
"referral_source_uuid": "string",
"referring_patient_uuid": "string"
}'curl -X POST "https://api.example.com/api/v1/{org_id}/patients/{patient_uuid}/referral-attributions" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"attribution_role": "assist",
"provider_uuid": "string",
"referral_partner_uuid": "string",
"referral_source_uuid": "string",
"referring_patient_uuid": "string"
}'/api/v1/{org_id}/patients/{patient_uuid}/referral-attributions/{attribution_uuid}/archiveArchive patient attribution
Soft-delete a referral attribution. Verifies ownership before archiving. Error conditions: - 404: Patient or attribution not found, or attribution does not belong to this patient. - 409: Version conflict — the attribution was modified since last read.
Parameters
Path Parameters
patient_uuidstringrequiredattribution_uuidstringrequiredorg_idstringrequiredQuery Parameters
base_versionintegerrequiredCurrent version for optimistic concurrency. Rejected with 409 if stale.
Responses
detailobject[]curl -X POST "https://api.example.com/api/v1/{org_id}/patients/{patient_uuid}/referral-attributions/{attribution_uuid}/archive" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"curl -X POST "https://api.example.com/api/v1/{org_id}/patients/{patient_uuid}/referral-attributions/{attribution_uuid}/archive" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"/api/v1/{org_id}/patients/{patient_uuid}/referral-attributions/{attribution_uuid}Update patient attribution
Update a referral attribution. Only attribution_role and source_note can be modified. Source references (referral_source, referral_partner, provider, referring_patient) are immutable after creation. Requires base_version for optimistic concurrency control. Verifies that the attribution belongs to the specified patient. Error conditions: - 404: Patient or attribution not found, or attribution does not belong to this patient. - 409: Version conflict — the attribution was modified since last read.
Parameters
Path Parameters
patient_uuidstringrequiredattribution_uuidstringrequiredorg_idstringrequiredRequest Body
attribution_roleenumassistprimarysecondarybase_versionintegerrequiredCurrent version for optimistic concurrency. Rejected with 409 if stale.
source_notestringResponses
attributed_atstring (date-time)requiredTimestamp when the attribution was recorded.
attribution_roleenumRole of this attribution in the patient's acquisition. One of: primary (first-touch attribution set at intake), secondary (additional touchpoint), assist (contributing factor).
assistprimarysecondarycreated_atstring (date-time)requiredTimestamp when the record was created.
idstring (uuid)requiredUnique identifier of the attribution record.
patientobjectrequiredLightweight reference to a related entity — exposes UUID and optional name.
providerobjectLightweight reference to a related entity — exposes UUID and optional name.
referral_partnerobjectLightweight reference to a related entity — exposes UUID and optional name.
referral_sourceobjectLightweight reference to a related entity — exposes UUID and optional name.
referring_patientobjectLightweight reference to a related entity — exposes UUID and optional name.
source_notestringupdated_atstring (date-time)requiredTimestamp when the record was last updated.
versionintegerrequiredOptimistic concurrency version number.
detailobject[]curl -X PATCH "https://api.example.com/api/v1/{org_id}/patients/{patient_uuid}/referral-attributions/{attribution_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"attribution_role": "string",
"base_version": 1,
"source_note": "string"
}'curl -X PATCH "https://api.example.com/api/v1/{org_id}/patients/{patient_uuid}/referral-attributions/{attribution_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"attribution_role": "string",
"base_version": 1,
"source_note": "string"
}'Partners
5 endpoints
/api/v1/{org_id}/referral-partnersList referral partners
List referral partners with pagination and filters. Returns a paginated list of referral partners. Supports filtering by contact type, specialty, and active status, plus free-text search across name, practice name, and NPI fields.
Parameters
Path Parameters
org_idstringrequiredQuery Parameters
pageintegerPage number (1-based).
Default: 1
page_sizeintegerNumber of records per page.
Default: 50
contact_typestringFilter by contact type
specialtystringFilter by specialty
is_activebooleanFilter by active status
searchstringSearch by name, practice, or NPI
Responses
itemsobject[]requiredList of referral partners matching the query.
pageintegerrequiredCurrent page number (1-based).
page_sizeintegerrequiredNumber of records per page.
totalintegerrequiredTotal number of partners matching the query.
detailobject[]curl -X GET "https://api.example.com/api/v1/{org_id}/referral-partners" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"curl -X GET "https://api.example.com/api/v1/{org_id}/referral-partners" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"/api/v1/{org_id}/referral-partners/{referral_partner_uuid}Get referral partner by ID
Retrieve a single referral partner by UUID. Error conditions: - 404: Referral partner not found.
Parameters
Path Parameters
referral_partner_uuidstringrequiredorg_idstringrequiredResponses
accepts_ereferralbooleanWhether this partner accepts electronic referrals. If true, ereferral_endpoint is required.
address_line1stringaddress_line2stringcitystringcontact_typeenumType of referral contact. One of: provider (individual practitioner), practice (dental or medical office), lab (dental laboratory), other.
labotherpracticeprovidercountrystringCountry code. Defaults to 'US'.
created_atstring (date-time)requiredTimestamp when the partner was created.
emailstringereferral_endpointstringfaxstringfirst_namestringidstring (uuid)requiredUnique identifier of the referral partner.
is_activebooleanWhether this partner is currently active and available for referrals.
last_namestringnotesstringnpistringphonestringpostal_codestringpractice_namestringpreferred_contact_methodenumemailfaxphoneportalspecialtystringstatestringupdated_atstring (date-time)requiredTimestamp when the partner was last updated.
versionintegerrequiredOptimistic concurrency version number.
detailobject[]curl -X GET "https://api.example.com/api/v1/{org_id}/referral-partners/{referral_partner_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"curl -X GET "https://api.example.com/api/v1/{org_id}/referral-partners/{referral_partner_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"/api/v1/{org_id}/referral-partnersCreate referral partner
Create a new referral partner. Registers an external provider, practice, lab, or other contact for referral tracking. Partners with contact_type 'provider' require first_name and last_name. If accepts_ereferral is true, ereferral_endpoint must be provided. Error conditions: - 422: Validation error (missing required name fields, invalid NPI format).
Parameters
Path Parameters
org_idstringrequiredRequest Body
accepts_ereferralbooleanWhether this partner accepts electronic referrals. If true, ereferral_endpoint is required.
address_line1stringaddress_line2stringcitystringcontact_typeenumType of referral contact. One of: provider (individual practitioner), practice (dental or medical office), lab (dental laboratory), other.
labotherpracticeprovidercountrystringCountry code. Defaults to 'US'.
emailstringereferral_endpointstringfaxstringfirst_namestringis_activebooleanWhether this partner is currently active and available for referrals.
last_namestringnotesstringnpistringphonestringpostal_codestringpractice_namestringpreferred_contact_methodenumemailfaxphoneportalspecialtystringstatestringResponses
accepts_ereferralbooleanWhether this partner accepts electronic referrals. If true, ereferral_endpoint is required.
address_line1stringaddress_line2stringcitystringcontact_typeenumType of referral contact. One of: provider (individual practitioner), practice (dental or medical office), lab (dental laboratory), other.
labotherpracticeprovidercountrystringCountry code. Defaults to 'US'.
created_atstring (date-time)requiredTimestamp when the partner was created.
emailstringereferral_endpointstringfaxstringfirst_namestringidstring (uuid)requiredUnique identifier of the referral partner.
is_activebooleanWhether this partner is currently active and available for referrals.
last_namestringnotesstringnpistringphonestringpostal_codestringpractice_namestringpreferred_contact_methodenumemailfaxphoneportalspecialtystringstatestringupdated_atstring (date-time)requiredTimestamp when the partner was last updated.
versionintegerrequiredOptimistic concurrency version number.
detailobject[]curl -X POST "https://api.example.com/api/v1/{org_id}/referral-partners" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"accepts_ereferral": false,
"address_line1": "string",
"address_line2": "string",
"city": "string",
"contact_type": "lab"
}'curl -X POST "https://api.example.com/api/v1/{org_id}/referral-partners" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"accepts_ereferral": false,
"address_line1": "string",
"address_line2": "string",
"city": "string",
"contact_type": "lab"
}'/api/v1/{org_id}/referral-partners/{referral_partner_uuid}/archiveArchive referral partner
Soft-delete a referral partner. Sets deleted_at timestamp. The partner is excluded from normal queries but data is preserved. Error conditions: - 404: Referral partner not found. - 409: Version conflict — the partner was modified since last read.
Parameters
Path Parameters
referral_partner_uuidstringrequiredorg_idstringrequiredQuery Parameters
base_versionintegerrequiredCurrent version for optimistic concurrency. Rejected with 409 if stale.
Responses
detailobject[]curl -X POST "https://api.example.com/api/v1/{org_id}/referral-partners/{referral_partner_uuid}/archive" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"curl -X POST "https://api.example.com/api/v1/{org_id}/referral-partners/{referral_partner_uuid}/archive" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"/api/v1/{org_id}/referral-partners/{referral_partner_uuid}Update referral partner
Update a referral partner. Uses PATCH semantics — only provided fields are modified. Requires base_version for optimistic concurrency control. Error conditions: - 404: Referral partner not found. - 409: Version conflict — the partner was modified since last read. - 422: Validation error (provider without name, e-referral without endpoint).
Parameters
Path Parameters
referral_partner_uuidstringrequiredorg_idstringrequiredRequest Body
accepts_ereferralbooleanaddress_line1stringaddress_line2stringbase_versionintegerrequiredCurrent version for optimistic concurrency. Rejected with 409 if stale.
citystringcontact_typeenumlabotherpracticeprovidercountrystringemailstringereferral_endpointstringfaxstringfirst_namestringis_activebooleanlast_namestringnotesstringnpistringphonestringpostal_codestringpractice_namestringpreferred_contact_methodenumemailfaxphoneportalspecialtystringstatestringResponses
accepts_ereferralbooleanWhether this partner accepts electronic referrals. If true, ereferral_endpoint is required.
address_line1stringaddress_line2stringcitystringcontact_typeenumType of referral contact. One of: provider (individual practitioner), practice (dental or medical office), lab (dental laboratory), other.
labotherpracticeprovidercountrystringCountry code. Defaults to 'US'.
created_atstring (date-time)requiredTimestamp when the partner was created.
emailstringereferral_endpointstringfaxstringfirst_namestringidstring (uuid)requiredUnique identifier of the referral partner.
is_activebooleanWhether this partner is currently active and available for referrals.
last_namestringnotesstringnpistringphonestringpostal_codestringpractice_namestringpreferred_contact_methodenumemailfaxphoneportalspecialtystringstatestringupdated_atstring (date-time)requiredTimestamp when the partner was last updated.
versionintegerrequiredOptimistic concurrency version number.
detailobject[]curl -X PATCH "https://api.example.com/api/v1/{org_id}/referral-partners/{referral_partner_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"accepts_ereferral": null,
"address_line1": "string",
"address_line2": "string",
"base_version": 1,
"city": "string"
}'curl -X PATCH "https://api.example.com/api/v1/{org_id}/referral-partners/{referral_partner_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"accepts_ereferral": null,
"address_line1": "string",
"address_line2": "string",
"base_version": 1,
"city": "string"
}'Sources
5 endpoints
/api/v1/{org_id}/referral-sourcesList referral sources
List referral sources with pagination and filters. Returns a paginated list of marketing attribution sources with computed statistics (patient_count, total_cost) for each source. Supports filtering by category and active status, plus name search.
Parameters
Path Parameters
org_idstringrequiredQuery Parameters
pageintegerPage number (1-based).
Default: 1
page_sizeintegerNumber of records per page.
Default: 50
categorystringFilter by category
is_activebooleanFilter by active status
searchstringSearch by name
Responses
itemsobject[]requiredList of referral sources matching the query.
pageintegerrequiredCurrent page number (1-based).
page_sizeintegerrequiredNumber of records per page.
totalintegerrequiredTotal number of sources matching the query.
detailobject[]curl -X GET "https://api.example.com/api/v1/{org_id}/referral-sources" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"curl -X GET "https://api.example.com/api/v1/{org_id}/referral-sources" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"/api/v1/{org_id}/referral-sources/{referral_source_uuid}Get referral source by ID
Retrieve a single referral source by UUID. Returns the source with linked references and computed statistics (patient_count, total_cost). Error conditions: - 404: Referral source not found.
Parameters
Path Parameters
referral_source_uuidstringrequiredorg_idstringrequiredResponses
categorystringrequiredMarketing attribution category. One of: patient_referral, doctor_referral, digital_advertising, organic_search, social_media, online_directory, website, insurance_plan, direct_mail, print_media, community_event, signage, tv_radio, email_marketing, walk_in, internal_transfer, other.
created_atstring (date-time)requiredTimestamp when the source was created.
descriptionstringidstring (uuid)requiredUnique identifier of the referral source.
is_activebooleanWhether this source is currently active and available for attribution.
linked_patientobjectLightweight reference to a related entity — exposes UUID and optional name.
linked_referral_partnerobjectLightweight reference to a related entity — exposes UUID and optional name.
namestringrequiredDisplay name of the referral source (e.g. 'Google Ads - Spring 2026', 'Dr. Smith (Periodontist)').
patient_countintegerComputed: number of patients attributed to this source.
sort_orderintegerrequiredDisplay sort order for the source in lists.
total_costnumberComputed: total marketing spend recorded for this source across all periods.
updated_atstring (date-time)requiredTimestamp when the source was last updated.
versionintegerrequiredOptimistic concurrency version number.
detailobject[]curl -X GET "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"curl -X GET "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"/api/v1/{org_id}/referral-sourcesCreate referral source
Create a new referral source for marketing attribution. A referral source represents a marketing channel or person that brings patients to the practice (e.g. 'Google Ads', 'Patient Referral', 'Walk-in'). Sources with category 'patient_referral' should link to a patient; 'doctor_referral' should link to a referral partner. Returns the created source with computed patient_count and total_cost. Error conditions: - 404: Linked patient or referral partner not found. - 422: Invalid category value, or both patient and partner linked.
Parameters
Path Parameters
org_idstringrequiredRequest Body
categorystringrequiredMarketing attribution category. One of: patient_referral, doctor_referral, digital_advertising, organic_search, social_media, online_directory, website, insurance_plan, direct_mail, print_media, community_event, signage, tv_radio, email_marketing, walk_in, internal_transfer, other.
descriptionstringis_activebooleanWhether this source is currently active and available for attribution.
linked_patient_uuidstring (uuid)linked_referral_partner_uuidstring (uuid)namestringrequiredDisplay name of the referral source (e.g. 'Google Ads - Spring 2026', 'Dr. Smith (Periodontist)').
Responses
categorystringrequiredMarketing attribution category. One of: patient_referral, doctor_referral, digital_advertising, organic_search, social_media, online_directory, website, insurance_plan, direct_mail, print_media, community_event, signage, tv_radio, email_marketing, walk_in, internal_transfer, other.
created_atstring (date-time)requiredTimestamp when the source was created.
descriptionstringidstring (uuid)requiredUnique identifier of the referral source.
is_activebooleanWhether this source is currently active and available for attribution.
linked_patientobjectLightweight reference to a related entity — exposes UUID and optional name.
linked_referral_partnerobjectLightweight reference to a related entity — exposes UUID and optional name.
namestringrequiredDisplay name of the referral source (e.g. 'Google Ads - Spring 2026', 'Dr. Smith (Periodontist)').
patient_countintegerComputed: number of patients attributed to this source.
sort_orderintegerrequiredDisplay sort order for the source in lists.
total_costnumberComputed: total marketing spend recorded for this source across all periods.
updated_atstring (date-time)requiredTimestamp when the source was last updated.
versionintegerrequiredOptimistic concurrency version number.
detailobject[]curl -X POST "https://api.example.com/api/v1/{org_id}/referral-sources" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"category": "string",
"description": "string",
"is_active": true,
"linked_patient_uuid": "string",
"linked_referral_partner_uuid": "string",
"name": "string"
}'curl -X POST "https://api.example.com/api/v1/{org_id}/referral-sources" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"category": "string",
"description": "string",
"is_active": true,
"linked_patient_uuid": "string",
"linked_referral_partner_uuid": "string",
"name": "string"
}'/api/v1/{org_id}/referral-sources/{referral_source_uuid}/archiveArchive referral source
Soft-delete a referral source. Existing patient attributions referencing this source are preserved. Error conditions: - 404: Referral source not found. - 409: Version conflict — the source was modified since last read.
Parameters
Path Parameters
referral_source_uuidstringrequiredorg_idstringrequiredQuery Parameters
base_versionintegerrequiredCurrent version for optimistic concurrency. Rejected with 409 if stale.
Responses
detailobject[]curl -X POST "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}/archive" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"curl -X POST "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}/archive" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"/api/v1/{org_id}/referral-sources/{referral_source_uuid}Update referral source
Update a referral source. Uses PATCH semantics — only provided fields are modified. Linked patient and partner references can be updated or cleared. Requires base_version for optimistic concurrency control. Error conditions: - 404: Referral source, linked patient, or linked partner not found. - 409: Version conflict — the source was modified since last read. - 422: Invalid category or mutually exclusive links violated.
Parameters
Path Parameters
referral_source_uuidstringrequiredorg_idstringrequiredRequest Body
base_versionintegerrequiredCurrent version for optimistic concurrency. Rejected with 409 if stale.
categorystringdescriptionstringis_activebooleanlinked_patient_uuidstring (uuid)linked_referral_partner_uuidstring (uuid)namestringResponses
categorystringrequiredMarketing attribution category. One of: patient_referral, doctor_referral, digital_advertising, organic_search, social_media, online_directory, website, insurance_plan, direct_mail, print_media, community_event, signage, tv_radio, email_marketing, walk_in, internal_transfer, other.
created_atstring (date-time)requiredTimestamp when the source was created.
descriptionstringidstring (uuid)requiredUnique identifier of the referral source.
is_activebooleanWhether this source is currently active and available for attribution.
linked_patientobjectLightweight reference to a related entity — exposes UUID and optional name.
linked_referral_partnerobjectLightweight reference to a related entity — exposes UUID and optional name.
namestringrequiredDisplay name of the referral source (e.g. 'Google Ads - Spring 2026', 'Dr. Smith (Periodontist)').
patient_countintegerComputed: number of patients attributed to this source.
sort_orderintegerrequiredDisplay sort order for the source in lists.
total_costnumberComputed: total marketing spend recorded for this source across all periods.
updated_atstring (date-time)requiredTimestamp when the source was last updated.
versionintegerrequiredOptimistic concurrency version number.
detailobject[]curl -X PATCH "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"base_version": 1,
"category": "string",
"description": "string",
"is_active": null,
"linked_patient_uuid": "string"
}'curl -X PATCH "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"base_version": 1,
"category": "string",
"description": "string",
"is_active": null,
"linked_patient_uuid": "string"
}'Source Costs
4 endpoints
/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costsList source costs
List cost records for a referral source with pagination. Returns campaign spend entries ordered by period. Used for marketing ROI calculation (Cost Per Acquisition = Total Spend / New Patients). Error conditions: - 404: Referral source not found.
Parameters
Path Parameters
referral_source_uuidstringrequiredorg_idstringrequiredQuery Parameters
pageintegerPage number (1-based).
Default: 1
page_sizeintegerNumber of records per page.
Default: 50
Responses
itemsobject[]requiredList of cost records for the referral source.
pageintegerrequiredCurrent page number (1-based).
page_sizeintegerrequiredNumber of records per page.
totalintegerrequiredTotal number of cost records.
detailobject[]curl -X GET "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costs" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"curl -X GET "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costs" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costsRecord source cost
Record a marketing spend entry for a referral source. Tracks campaign costs by time period for ROI analysis. period_end must be >= period_start and amount must be >= 0. Error conditions: - 404: Referral source not found. - 422: period_end < period_start, or negative amount.
Parameters
Path Parameters
referral_source_uuidstringrequiredorg_idstringrequiredRequest Body
amountnumberrequirednotesstringperiod_endstring (date)requiredEnd date of the cost tracking period. Must be >= period_start.
period_startstring (date)requiredStart date of the cost tracking period.
Responses
amountstringrequiredMarketing spend amount in dollars for this period. Must be >= 0 with at most 2 decimal places.
created_atstring (date-time)requiredTimestamp when the cost record was created.
idstring (uuid)requiredUnique identifier of the cost record.
notesstringperiod_endstring (date)requiredEnd date of the cost tracking period. Must be >= period_start.
period_startstring (date)requiredStart date of the cost tracking period.
updated_atstring (date-time)requiredTimestamp when the cost record was last updated.
versionintegerrequiredOptimistic concurrency version number.
detailobject[]curl -X POST "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costs" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": null,
"notes": "string",
"period_end": "2025-01-15",
"period_start": "2025-01-15"
}'curl -X POST "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costs" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": null,
"notes": "string",
"period_end": "2025-01-15",
"period_start": "2025-01-15"
}'/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costs/{cost_uuid}/archiveArchive source cost
Soft-delete a cost record. Verifies ownership before archiving. Error conditions: - 404: Referral source or cost record not found, or cost does not belong to this source. - 409: Version conflict — the cost record was modified since last read.
Parameters
Path Parameters
referral_source_uuidstringrequiredcost_uuidstringrequiredorg_idstringrequiredQuery Parameters
base_versionintegerrequiredCurrent version for optimistic concurrency. Rejected with 409 if stale.
Responses
detailobject[]curl -X POST "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costs/{cost_uuid}/archive" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"curl -X POST "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costs/{cost_uuid}/archive" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costs/{cost_uuid}Update source cost
Update a cost record. Verifies that the cost record belongs to the specified referral source. Requires base_version for optimistic concurrency control. Error conditions: - 404: Referral source or cost record not found, or cost does not belong to this source. - 409: Version conflict — the cost record was modified since last read. - 422: Invalid amount or period dates.
Parameters
Path Parameters
referral_source_uuidstringrequiredcost_uuidstringrequiredorg_idstringrequiredRequest Body
amountnumberbase_versionintegerrequiredCurrent version for optimistic concurrency. Rejected with 409 if stale.
notesstringperiod_endstring (date)period_startstring (date)Responses
amountstringrequiredMarketing spend amount in dollars for this period. Must be >= 0 with at most 2 decimal places.
created_atstring (date-time)requiredTimestamp when the cost record was created.
idstring (uuid)requiredUnique identifier of the cost record.
notesstringperiod_endstring (date)requiredEnd date of the cost tracking period. Must be >= period_start.
period_startstring (date)requiredStart date of the cost tracking period.
updated_atstring (date-time)requiredTimestamp when the cost record was last updated.
versionintegerrequiredOptimistic concurrency version number.
detailobject[]curl -X PATCH "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costs/{cost_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": null,
"base_version": 1,
"notes": "string",
"period_end": "string",
"period_start": "string"
}'curl -X PATCH "https://api.example.com/api/v1/{org_id}/referral-sources/{referral_source_uuid}/costs/{cost_uuid}" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": null,
"base_version": 1,
"notes": "string",
"period_end": "string",
"period_start": "string"
}'