Bulk Create Opportunities
curl --request POST \
--url https://api.decodahealth.com/opportunity/bulk \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TENANT: <tenant>' \
--data '
{
"opportunities": [
{
"rowNumber": 123,
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"sourceDetail": "<string>",
"notes": "<string>"
}
],
"pipelineId": "<string>",
"currentStageId": "<string>",
"campaignId": "<string>",
"locationId": "<string>"
}
'import requests
url = "https://api.decodahealth.com/opportunity/bulk"
payload = {
"opportunities": [
{
"rowNumber": 123,
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"sourceDetail": "<string>",
"notes": "<string>"
}
],
"pipelineId": "<string>",
"currentStageId": "<string>",
"campaignId": "<string>",
"locationId": "<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({
opportunities: [
{
rowNumber: 123,
firstName: '<string>',
lastName: '<string>',
email: '<string>',
phoneNumber: '<string>',
sourceDetail: '<string>',
notes: '<string>'
}
],
pipelineId: '<string>',
currentStageId: '<string>',
campaignId: '<string>',
locationId: '<string>'
})
};
fetch('https://api.decodahealth.com/opportunity/bulk', 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/bulk",
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([
'opportunities' => [
[
'rowNumber' => 123,
'firstName' => '<string>',
'lastName' => '<string>',
'email' => '<string>',
'phoneNumber' => '<string>',
'sourceDetail' => '<string>',
'notes' => '<string>'
]
],
'pipelineId' => '<string>',
'currentStageId' => '<string>',
'campaignId' => '<string>',
'locationId' => '<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/bulk"
payload := strings.NewReader("{\n \"opportunities\": [\n {\n \"rowNumber\": 123,\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"sourceDetail\": \"<string>\",\n \"notes\": \"<string>\"\n }\n ],\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"locationId\": \"<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/opportunity/bulk")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"opportunities\": [\n {\n \"rowNumber\": 123,\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"sourceDetail\": \"<string>\",\n \"notes\": \"<string>\"\n }\n ],\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"locationId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/opportunity/bulk")
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 \"opportunities\": [\n {\n \"rowNumber\": 123,\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"sourceDetail\": \"<string>\",\n \"notes\": \"<string>\"\n }\n ],\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"locationId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"totalCount": 123,
"createdCount": 123,
"bumpedCount": 123,
"failedCount": 123,
"bumpedIds": [
"<string>"
],
"opportunities": [
{
"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
}
}
],
"errors": [
{
"rowNumber": 123,
"message": "<string>",
"field": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Opportunities
Bulk Create Opportunities
Bulk import a batch of opportunities into one pipeline stage, reporting created/bumped/failed rows.
POST
/
opportunity
/
bulk
Bulk Create Opportunities
curl --request POST \
--url https://api.decodahealth.com/opportunity/bulk \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TENANT: <tenant>' \
--data '
{
"opportunities": [
{
"rowNumber": 123,
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"sourceDetail": "<string>",
"notes": "<string>"
}
],
"pipelineId": "<string>",
"currentStageId": "<string>",
"campaignId": "<string>",
"locationId": "<string>"
}
'import requests
url = "https://api.decodahealth.com/opportunity/bulk"
payload = {
"opportunities": [
{
"rowNumber": 123,
"firstName": "<string>",
"lastName": "<string>",
"email": "<string>",
"phoneNumber": "<string>",
"sourceDetail": "<string>",
"notes": "<string>"
}
],
"pipelineId": "<string>",
"currentStageId": "<string>",
"campaignId": "<string>",
"locationId": "<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({
opportunities: [
{
rowNumber: 123,
firstName: '<string>',
lastName: '<string>',
email: '<string>',
phoneNumber: '<string>',
sourceDetail: '<string>',
notes: '<string>'
}
],
pipelineId: '<string>',
currentStageId: '<string>',
campaignId: '<string>',
locationId: '<string>'
})
};
fetch('https://api.decodahealth.com/opportunity/bulk', 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/bulk",
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([
'opportunities' => [
[
'rowNumber' => 123,
'firstName' => '<string>',
'lastName' => '<string>',
'email' => '<string>',
'phoneNumber' => '<string>',
'sourceDetail' => '<string>',
'notes' => '<string>'
]
],
'pipelineId' => '<string>',
'currentStageId' => '<string>',
'campaignId' => '<string>',
'locationId' => '<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/bulk"
payload := strings.NewReader("{\n \"opportunities\": [\n {\n \"rowNumber\": 123,\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"sourceDetail\": \"<string>\",\n \"notes\": \"<string>\"\n }\n ],\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"locationId\": \"<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/opportunity/bulk")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"opportunities\": [\n {\n \"rowNumber\": 123,\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"sourceDetail\": \"<string>\",\n \"notes\": \"<string>\"\n }\n ],\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"locationId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/opportunity/bulk")
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 \"opportunities\": [\n {\n \"rowNumber\": 123,\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"sourceDetail\": \"<string>\",\n \"notes\": \"<string>\"\n }\n ],\n \"pipelineId\": \"<string>\",\n \"currentStageId\": \"<string>\",\n \"campaignId\": \"<string>\",\n \"locationId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"totalCount": 123,
"createdCount": 123,
"bumpedCount": 123,
"failedCount": 123,
"bumpedIds": [
"<string>"
],
"opportunities": [
{
"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
}
}
],
"errors": [
{
"rowNumber": 123,
"message": "<string>",
"field": "<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
Body
application/json
⌘I
