curl --request PUT \
--url https://api.decodahealth.com/opportunity/{opportunity_id} \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TENANT: <tenant>' \
--data '
{
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"campaignId": "<string>",
"pipelineId": "<string>",
"currentStageId": "<string>",
"assignedProviderId": "<string>",
"lostReasonId": "<string>",
"notes": "<string>"
}
'import requests
url = "https://api.decodahealth.com/opportunity/{opportunity_id}"
payload = {
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"campaignId": "<string>",
"pipelineId": "<string>",
"currentStageId": "<string>",
"assignedProviderId": "<string>",
"lostReasonId": "<string>",
"notes": "<string>"
}
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({
firstName: '<string>',
lastName: '<string>',
email: '<string>',
phoneNumber: '<string>',
campaignId: '<string>',
pipelineId: '<string>',
currentStageId: '<string>',
assignedProviderId: '<string>',
lostReasonId: '<string>',
notes: '<string>'
})
};
fetch('https://api.decodahealth.com/opportunity/{opportunity_id}', 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}",
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([
'firstName' => '<string>',
'lastName' => '<string>',
'email' => '<string>',
'phoneNumber' => '<string>',
'campaignId' => '<string>',
'pipelineId' => '<string>',
'currentStageId' => '<string>',
'assignedProviderId' => '<string>',
'lostReasonId' => '<string>',
'notes' => '<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/opportunity/{opportunity_id}"
payload := strings.NewReader("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"assignedProviderId\": \"<string>\",\n \"lostReasonId\": \"<string>\",\n \"notes\": \"<string>\"\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}")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"assignedProviderId\": \"<string>\",\n \"lostReasonId\": \"<string>\",\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/opportunity/{opportunity_id}")
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 \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"assignedProviderId\": \"<string>\",\n \"lostReasonId\": \"<string>\",\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"firstName": "<string>",
"pipelineId": "<string>",
"patientId": "<string>",
"stageEnteredAt": "2023-11-07T05:31:56Z",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"sourceDetail": "<string>",
"campaignId": "<string>",
"locationId": "<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>",
"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,
"latestBooking": {
"conversionId": "<string>",
"eventId": "<string>",
"occurredAt": "2023-11-07T05:31:56Z",
"appointmentStart": "2023-11-07T05:31:56Z",
"appointmentEnd": "2023-11-07T05:31:56Z",
"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,
"actions": [
{
"id": "<string>",
"stageId": "<string>",
"actionOrder": 123,
"delayMinutes": 0,
"config": {},
"isActive": true
}
]
},
"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",
"isLinked": true,
"locationName": "<string>",
"isArchived": false
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Update Opportunity
Update an opportunity’s fields, including stage, assignment, and linked patient identity.
curl --request PUT \
--url https://api.decodahealth.com/opportunity/{opportunity_id} \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TENANT: <tenant>' \
--data '
{
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"campaignId": "<string>",
"pipelineId": "<string>",
"currentStageId": "<string>",
"assignedProviderId": "<string>",
"lostReasonId": "<string>",
"notes": "<string>"
}
'import requests
url = "https://api.decodahealth.com/opportunity/{opportunity_id}"
payload = {
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"campaignId": "<string>",
"pipelineId": "<string>",
"currentStageId": "<string>",
"assignedProviderId": "<string>",
"lostReasonId": "<string>",
"notes": "<string>"
}
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({
firstName: '<string>',
lastName: '<string>',
email: '<string>',
phoneNumber: '<string>',
campaignId: '<string>',
pipelineId: '<string>',
currentStageId: '<string>',
assignedProviderId: '<string>',
lostReasonId: '<string>',
notes: '<string>'
})
};
fetch('https://api.decodahealth.com/opportunity/{opportunity_id}', 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}",
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([
'firstName' => '<string>',
'lastName' => '<string>',
'email' => '<string>',
'phoneNumber' => '<string>',
'campaignId' => '<string>',
'pipelineId' => '<string>',
'currentStageId' => '<string>',
'assignedProviderId' => '<string>',
'lostReasonId' => '<string>',
'notes' => '<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/opportunity/{opportunity_id}"
payload := strings.NewReader("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"assignedProviderId\": \"<string>\",\n \"lostReasonId\": \"<string>\",\n \"notes\": \"<string>\"\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}")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"assignedProviderId\": \"<string>\",\n \"lostReasonId\": \"<string>\",\n \"notes\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/opportunity/{opportunity_id}")
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 \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"assignedProviderId\": \"<string>\",\n \"lostReasonId\": \"<string>\",\n \"notes\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"firstName": "<string>",
"pipelineId": "<string>",
"patientId": "<string>",
"stageEnteredAt": "2023-11-07T05:31:56Z",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"sourceDetail": "<string>",
"campaignId": "<string>",
"locationId": "<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>",
"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,
"latestBooking": {
"conversionId": "<string>",
"eventId": "<string>",
"occurredAt": "2023-11-07T05:31:56Z",
"appointmentStart": "2023-11-07T05:31:56Z",
"appointmentEnd": "2023-11-07T05:31:56Z",
"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,
"actions": [
{
"id": "<string>",
"stageId": "<string>",
"actionOrder": 123,
"delayMinutes": 0,
"config": {},
"isActive": true
}
]
},
"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",
"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
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
