curl --request POST \
--url https://api.statisfy.com/v1/objects/opportunity/records \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account": null,
"amount": null,
"close_date": null,
"crm_opportunity_id": null,
"description": null,
"fields": {},
"name": null,
"owner": null,
"stage": null,
"type": null
}
'import requests
url = "https://api.statisfy.com/v1/objects/opportunity/records"
payload = {
"account": None,
"amount": None,
"close_date": None,
"crm_opportunity_id": None,
"description": None,
"fields": {},
"name": None,
"owner": None,
"stage": None,
"type": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account: null,
amount: null,
close_date: null,
crm_opportunity_id: null,
description: null,
fields: {},
name: null,
owner: null,
stage: null,
type: null
})
};
fetch('https://api.statisfy.com/v1/objects/opportunity/records', 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",
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([
'account' => null,
'amount' => null,
'close_date' => null,
'crm_opportunity_id' => 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"
payload := strings.NewReader("{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.statisfy.com/v1/objects/opportunity/records")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": 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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": 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>"
}Create an opportunity
Creates an opportunity and returns it with 201. account (a live account’s id) and name are required; crm_opportunity_id links it to your CRM’s record, and is unique: one any opportunity holds, a deleted one included, is a 409 naming it. Every other key is an update key, checked the same way, and your validation rules apply, with one difference: without a crm_opportunity_id, a create may also set a custom field that comes from your CRM (describe’s owner is crm; not one a CRM field copies into a field of your own) where your admins have made it editable, since no CRM record overwrites it until the opportunity is in your CRM. Where your workspace syncs opportunities with Salesforce and the account is linked to one, the next push creates the opportunity there if you sent no crm_opportunity_id; if you sent one, it writes Statisfy’s values over that Salesforce record. A 500 that says the opportunity was created names its id: update it by id rather than creating it again. Send an Idempotency-Key header to make a retry safe: the same key replays the first response.
curl --request POST \
--url https://api.statisfy.com/v1/objects/opportunity/records \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account": null,
"amount": null,
"close_date": null,
"crm_opportunity_id": null,
"description": null,
"fields": {},
"name": null,
"owner": null,
"stage": null,
"type": null
}
'import requests
url = "https://api.statisfy.com/v1/objects/opportunity/records"
payload = {
"account": None,
"amount": None,
"close_date": None,
"crm_opportunity_id": None,
"description": None,
"fields": {},
"name": None,
"owner": None,
"stage": None,
"type": None
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account: null,
amount: null,
close_date: null,
crm_opportunity_id: null,
description: null,
fields: {},
name: null,
owner: null,
stage: null,
type: null
})
};
fetch('https://api.statisfy.com/v1/objects/opportunity/records', 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",
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([
'account' => null,
'amount' => null,
'close_date' => null,
'crm_opportunity_id' => 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"
payload := strings.NewReader("{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": null,\n \"description\": null,\n \"fields\": {},\n \"name\": null,\n \"owner\": null,\n \"stage\": null,\n \"type\": null\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.statisfy.com/v1/objects/opportunity/records")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": 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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account\": null,\n \"amount\": null,\n \"close_date\": null,\n \"crm_opportunity_id\": 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
An update body plus the keys only a create sets. account and name are required.
Response
Successful Response
Was this page helpful?