curl --request PATCH \
--url https://api.statisfy.com/v1/objects/opportunity/records/{opportunity_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": null,
"close_date": null,
"description": null,
"fields": {},
"name": null,
"owner": null,
"stage": null,
"type": null
}
'import requests
url = "https://api.statisfy.com/v1/objects/opportunity/records/{opportunity_id}"
payload = {
"amount": None,
"close_date": None,
"description": None,
"fields": {},
"name": None,
"owner": None,
"stage": None,
"type": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: null,
close_date: null,
description: null,
fields: {},
name: null,
owner: null,
stage: null,
type: null
})
};
fetch('https://api.statisfy.com/v1/objects/opportunity/records/{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.statisfy.com/v1/objects/opportunity/records/{opportunity_id}",
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([
'amount' => null,
'close_date' => null,
'description' => null,
'fields' => [
],
'name' => null,
'owner' => null,
'stage' => null,
'type' => null
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.statisfy.com/v1/objects/opportunity/records/{opportunity_id}"
payload := strings.NewReader("{\n \"amount\": null,\n \"close_date\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.statisfy.com/v1/objects/opportunity/records/{opportunity_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": null,\n \"close_date\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/objects/opportunity/records/{opportunity_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": null,\n \"close_date\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"account": "<string>",
"account_name": "<string>",
"amount": 123,
"close_date": "<string>",
"created_at": "<string>",
"crm_opportunity_id": "<string>",
"description": "<string>",
"fields": {},
"is_closed": false,
"is_won": false,
"name": "<string>",
"owner": "<string>",
"source": "<string>",
"stage": "<string>",
"type": "<string>"
}Update an opportunity
Changes only the keys sent: standard fields at the top level (name, description, stage, type, amount, close_date, owner), custom fields under fields. null clears a field that may be empty: not name, stage or type, nor a mandatory custom field. A change to a standard field is the app’s own edit: until your CRM has received it, the CRM sync does not overwrite the opportunity. Where your workspace syncs opportunities with Salesforce or HubSpot (describe’s syncs_to_crm says which fields) and the account is linked to an account in that CRM (a company, in HubSpot), the next push sends name, amount, stage, type and close date, plus owner to Salesforce (never description), and creates the opportunity there if it has no crm_opportunity_id yet. An update that sends only fields leaves the standard fields to the CRM sync. A new stage sets is_closed and is_won from that stage. Every key is checked before anything is written, and any problem refuses the whole request with a 422 listing each one in details: a stage outside your stage list (where one is set up), an owner who is not a user, a field describe marks writable: false. Once the keys pass, your admin’s validation rules run over the merged record; a change that breaks one is a 422 whose details name each rule, and nothing is written. The API does not move an opportunity to another account (account is not writable); your CRM sync may. Returns the updated opportunity.
curl --request PATCH \
--url https://api.statisfy.com/v1/objects/opportunity/records/{opportunity_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": null,
"close_date": null,
"description": null,
"fields": {},
"name": null,
"owner": null,
"stage": null,
"type": null
}
'import requests
url = "https://api.statisfy.com/v1/objects/opportunity/records/{opportunity_id}"
payload = {
"amount": None,
"close_date": None,
"description": None,
"fields": {},
"name": None,
"owner": None,
"stage": None,
"type": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: null,
close_date: null,
description: null,
fields: {},
name: null,
owner: null,
stage: null,
type: null
})
};
fetch('https://api.statisfy.com/v1/objects/opportunity/records/{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.statisfy.com/v1/objects/opportunity/records/{opportunity_id}",
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([
'amount' => null,
'close_date' => null,
'description' => null,
'fields' => [
],
'name' => null,
'owner' => null,
'stage' => null,
'type' => null
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.statisfy.com/v1/objects/opportunity/records/{opportunity_id}"
payload := strings.NewReader("{\n \"amount\": null,\n \"close_date\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.statisfy.com/v1/objects/opportunity/records/{opportunity_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": null,\n \"close_date\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/objects/opportunity/records/{opportunity_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": null,\n \"close_date\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"account": "<string>",
"account_name": "<string>",
"amount": 123,
"close_date": "<string>",
"created_at": "<string>",
"crm_opportunity_id": "<string>",
"description": "<string>",
"fields": {},
"is_closed": false,
"is_won": false,
"name": "<string>",
"owner": "<string>",
"source": "<string>",
"stage": "<string>",
"type": "<string>"
}Authorizations
An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.
Body
Response
Successful Response
Was this page helpful?