curl --request PUT \
--url https://api.decodahealth.com/opportunity/{opportunity_id}/status \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TENANT: <tenant>' \
--data '
{
"lostReasonId": "<string>",
"resumeAutomations": false
}
'import requests
url = "https://api.decodahealth.com/opportunity/{opportunity_id}/status"
payload = {
"lostReasonId": "<string>",
"resumeAutomations": False
}
headers = {
"TENANT": "<tenant>",
"API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {TENANT: '<tenant>', 'API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({lostReasonId: '<string>', resumeAutomations: false})
};
fetch('https://api.decodahealth.com/opportunity/{opportunity_id}/status', 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/opportunity/{opportunity_id}/status",
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([
'lostReasonId' => '<string>',
'resumeAutomations' => false
]),
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/opportunity/{opportunity_id}/status"
payload := strings.NewReader("{\n \"lostReasonId\": \"<string>\",\n \"resumeAutomations\": false\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.decodahealth.com/opportunity/{opportunity_id}/status")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"lostReasonId\": \"<string>\",\n \"resumeAutomations\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/opportunity/{opportunity_id}/status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["TENANT"] = '<tenant>'
request["API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"lostReasonId\": \"<string>\",\n \"resumeAutomations\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"firstName": "<string>",
"patientId": "<string>",
"stageEnteredAt": "2023-11-07T05:31:56Z",
"lifecycleStage": "PROSPECT",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"sourceDetail": "<string>",
"campaignId": "<string>",
"locationId": "<string>",
"pipelineId": "<string>",
"currentStageId": "<string>",
"assignedProviderId": "<string>",
"status": "OPEN",
"wonAt": "2023-11-07T05:31:56Z",
"lostAt": "2023-11-07T05:31:56Z",
"lostReasonId": "<string>",
"lostReasonLabel": "<string>",
"convertedDate": "2023-11-07T05:31:56Z",
"lostReason": "<string>",
"sourceChannel": "META_LEAD_FORM",
"originatingTouchpointId": "<string>",
"estValueCents": 123,
"contactAttempts": 0,
"firstResponseDueAt": "2023-11-07T05:31:56Z",
"firstResponseAt": "2023-11-07T05:31:56Z",
"lastEngagedAt": "2023-11-07T05:31:56Z",
"automationsPaused": false,
"stale": false,
"isExistingPatient": false,
"optedInToSmsMarketing": true,
"optedInToEmailMarketing": true,
"latestBooking": {
"conversionId": "<string>",
"eventId": "<string>",
"occurredAt": "2023-11-07T05:31:56Z",
"appointmentStart": "2023-11-07T05:31:56Z",
"appointmentEnd": "2023-11-07T05:31:56Z",
"appointmentStatus": "PENDING",
"isLinked": true,
"locationName": "<string>",
"isArchived": false
},
"createdDate": "2023-11-07T05:31:56Z",
"updatedDate": "2023-11-07T05:31:56Z",
"currentStage": {
"id": "<string>",
"pipelineId": "<string>",
"name": "<string>",
"stageNumber": 123,
"color": "<string>",
"kind": "WORKING",
"staleAfterDays": 123,
"isTerminalWon": false,
"isTerminalLost": false,
"autoConvert": false
},
"assignedProvider": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"createdDate": "2023-11-07T05:31:56Z"
},
"campaign": {
"id": "<string>",
"name": "<string>",
"locationId": "<string>",
"description": "<string>",
"platformId": "<string>",
"platformAssetId": "<string>",
"externalCampaignId": "<string>",
"externalResourceName": "<string>",
"externalName": "<string>",
"externalStatus": "<string>",
"externalCurrency": "<string>",
"externalDailyBudgetCents": 123,
"externalLifetimeBudgetCents": 123,
"externalLastSeenAt": "2023-11-07T05:31:56Z",
"externalLastSyncedAt": "2023-11-07T05:31:56Z",
"externalStaleAt": "2023-11-07T05:31:56Z",
"externalSyncError": "<string>",
"isActive": true,
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"budgetCents": 123,
"pipelineId": "<string>",
"webhook": {
"webhookKey": "<string>",
"webhookUrl": "<string>",
"redirectUrl": "<string>"
},
"createdDate": "2023-11-07T05:31:56Z",
"updatedDate": "2023-11-07T05:31:56Z",
"opportunityCount": 0,
"convertedCount": 0
},
"notes": "<string>",
"opportunityNotes": [
{
"id": "<string>",
"opportunityId": "<string>",
"content": "<string>",
"creatorId": "<string>",
"createdDate": "2023-11-07T05:31:56Z",
"creator": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"createdDate": "2023-11-07T05:31:56Z"
},
"updatedDate": "2023-11-07T05:31:56Z"
}
],
"aiSummaries": [
{
"id": "<string>",
"opportunityId": "<string>",
"summary": "<string>",
"createdDate": "2023-11-07T05:31:56Z",
"suggestions": [
"<string>"
],
"latestActivity": "<string>"
}
],
"bookings": [
{
"conversionId": "<string>",
"eventId": "<string>",
"occurredAt": "2023-11-07T05:31:56Z",
"appointmentStart": "2023-11-07T05:31:56Z",
"appointmentEnd": "2023-11-07T05:31:56Z",
"appointmentStatus": "PENDING",
"isLinked": true,
"locationName": "<string>",
"isArchived": false
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Set Opportunity Status
Set an opportunity’s status (open, won, or lost), running any status-change automations and converting won opportunities to patients.
curl --request PUT \
--url https://api.decodahealth.com/opportunity/{opportunity_id}/status \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TENANT: <tenant>' \
--data '
{
"lostReasonId": "<string>",
"resumeAutomations": false
}
'import requests
url = "https://api.decodahealth.com/opportunity/{opportunity_id}/status"
payload = {
"lostReasonId": "<string>",
"resumeAutomations": False
}
headers = {
"TENANT": "<tenant>",
"API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {TENANT: '<tenant>', 'API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({lostReasonId: '<string>', resumeAutomations: false})
};
fetch('https://api.decodahealth.com/opportunity/{opportunity_id}/status', 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/opportunity/{opportunity_id}/status",
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([
'lostReasonId' => '<string>',
'resumeAutomations' => false
]),
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/opportunity/{opportunity_id}/status"
payload := strings.NewReader("{\n \"lostReasonId\": \"<string>\",\n \"resumeAutomations\": false\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.decodahealth.com/opportunity/{opportunity_id}/status")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"lostReasonId\": \"<string>\",\n \"resumeAutomations\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/opportunity/{opportunity_id}/status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["TENANT"] = '<tenant>'
request["API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"lostReasonId\": \"<string>\",\n \"resumeAutomations\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"firstName": "<string>",
"patientId": "<string>",
"stageEnteredAt": "2023-11-07T05:31:56Z",
"lifecycleStage": "PROSPECT",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"sourceDetail": "<string>",
"campaignId": "<string>",
"locationId": "<string>",
"pipelineId": "<string>",
"currentStageId": "<string>",
"assignedProviderId": "<string>",
"status": "OPEN",
"wonAt": "2023-11-07T05:31:56Z",
"lostAt": "2023-11-07T05:31:56Z",
"lostReasonId": "<string>",
"lostReasonLabel": "<string>",
"convertedDate": "2023-11-07T05:31:56Z",
"lostReason": "<string>",
"sourceChannel": "META_LEAD_FORM",
"originatingTouchpointId": "<string>",
"estValueCents": 123,
"contactAttempts": 0,
"firstResponseDueAt": "2023-11-07T05:31:56Z",
"firstResponseAt": "2023-11-07T05:31:56Z",
"lastEngagedAt": "2023-11-07T05:31:56Z",
"automationsPaused": false,
"stale": false,
"isExistingPatient": false,
"optedInToSmsMarketing": true,
"optedInToEmailMarketing": true,
"latestBooking": {
"conversionId": "<string>",
"eventId": "<string>",
"occurredAt": "2023-11-07T05:31:56Z",
"appointmentStart": "2023-11-07T05:31:56Z",
"appointmentEnd": "2023-11-07T05:31:56Z",
"appointmentStatus": "PENDING",
"isLinked": true,
"locationName": "<string>",
"isArchived": false
},
"createdDate": "2023-11-07T05:31:56Z",
"updatedDate": "2023-11-07T05:31:56Z",
"currentStage": {
"id": "<string>",
"pipelineId": "<string>",
"name": "<string>",
"stageNumber": 123,
"color": "<string>",
"kind": "WORKING",
"staleAfterDays": 123,
"isTerminalWon": false,
"isTerminalLost": false,
"autoConvert": false
},
"assignedProvider": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"createdDate": "2023-11-07T05:31:56Z"
},
"campaign": {
"id": "<string>",
"name": "<string>",
"locationId": "<string>",
"description": "<string>",
"platformId": "<string>",
"platformAssetId": "<string>",
"externalCampaignId": "<string>",
"externalResourceName": "<string>",
"externalName": "<string>",
"externalStatus": "<string>",
"externalCurrency": "<string>",
"externalDailyBudgetCents": 123,
"externalLifetimeBudgetCents": 123,
"externalLastSeenAt": "2023-11-07T05:31:56Z",
"externalLastSyncedAt": "2023-11-07T05:31:56Z",
"externalStaleAt": "2023-11-07T05:31:56Z",
"externalSyncError": "<string>",
"isActive": true,
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"budgetCents": 123,
"pipelineId": "<string>",
"webhook": {
"webhookKey": "<string>",
"webhookUrl": "<string>",
"redirectUrl": "<string>"
},
"createdDate": "2023-11-07T05:31:56Z",
"updatedDate": "2023-11-07T05:31:56Z",
"opportunityCount": 0,
"convertedCount": 0
},
"notes": "<string>",
"opportunityNotes": [
{
"id": "<string>",
"opportunityId": "<string>",
"content": "<string>",
"creatorId": "<string>",
"createdDate": "2023-11-07T05:31:56Z",
"creator": {
"id": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"createdDate": "2023-11-07T05:31:56Z"
},
"updatedDate": "2023-11-07T05:31:56Z"
}
],
"aiSummaries": [
{
"id": "<string>",
"opportunityId": "<string>",
"summary": "<string>",
"createdDate": "2023-11-07T05:31:56Z",
"suggestions": [
"<string>"
],
"latestActivity": "<string>"
}
],
"bookings": [
{
"conversionId": "<string>",
"eventId": "<string>",
"occurredAt": "2023-11-07T05:31:56Z",
"appointmentStart": "2023-11-07T05:31:56Z",
"appointmentEnd": "2023-11-07T05:31:56Z",
"appointmentStatus": "PENDING",
"isLinked": true,
"locationName": "<string>",
"isArchived": false
}
]
}{
"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
Terminal-capable status for a pursuit episode (separate from stage).
Schema column lands with the opportunity rebuild; enum ships early so intake/services can type against it without a second enum PR.
OPEN, WON, LOST, DISQUALIFIED Response
Successful Response
Clinical vs marketing hygiene for a patient row.
Prospects are thin / pre-clinical people created by CRM capture. Transition is one-way to PATIENT on first completed visit, first committed payment, portal claim, or explicit staff action.
PROSPECT, PATIENT Terminal-capable status for a pursuit episode (separate from stage).
Schema column lands with the opportunity rebuild; enum ships early so intake/services can type against it without a second enum PR.
OPEN, WON, LOST, DISQUALIFIED How a marketing interaction was observed.
Reporting dimension #1 on the touchpoint ledger. Add values only with a writer in the same PR (TypedEnum decodes unmapped strings to None).
META_LEAD_FORM, GOOGLE_LEAD_FORM, PAID_CLICK, WEB_ORGANIC, WEB_FORM, WEB_CHAT, PHONE_CALL, SMS_INBOUND, EMAIL_INBOUND, DM_INSTAGRAM, DM_FACEBOOK, REFERRAL, WALK_IN, QR, IMPORT, OTHER One real appointment fact visible in an opportunity's patient context.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes

