Create a custom object record
curl --request POST \
--url https://api.statisfy.com/v1/objects/{object}/records \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": null,
"contact_id": null,
"external_id": null,
"fields": {}
}
'import requests
url = "https://api.statisfy.com/v1/objects/{object}/records"
payload = {
"account_id": None,
"contact_id": None,
"external_id": None,
"fields": {}
}
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_id: null, contact_id: null, external_id: null, fields: {}})
};
fetch('https://api.statisfy.com/v1/objects/{object}/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/{object}/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_id' => null,
'contact_id' => null,
'external_id' => null,
'fields' => [
]
]),
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/{object}/records"
payload := strings.NewReader("{\n \"account_id\": null,\n \"contact_id\": null,\n \"external_id\": null,\n \"fields\": {}\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/{object}/records")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": null,\n \"contact_id\": null,\n \"external_id\": null,\n \"fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/objects/{object}/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_id\": null,\n \"contact_id\": null,\n \"external_id\": null,\n \"fields\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"account_id": "<string>",
"contact_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"fields": {},
"updated_at": "2023-11-07T05:31:56Z"
}custom_objects
Create a custom object record
Creates a record of a Statisfy object (one whose `source` is statisfy in GET /v1/objects). It needs what it belongs to, `account_id` or `contact_id` as the object's `belongs_to` says, and a value for every mandatory field; `external_id` is optional. An `external_id` another record of the object holds on the same account or contact is a 409. What each field takes is in GET /v1/fields?object=<object>: its type, its options, and whether the API may write it (`writable`). A field your CRM fills is written only while Salesforce writeback is on for the object, and can't be cleared here; an object a warehouse or another system fills is read only. Every problem with the body comes back at once, in one 422. Returns the new record.
POST
/
v1
/
objects
/
{object}
/
records
Create a custom object record
curl --request POST \
--url https://api.statisfy.com/v1/objects/{object}/records \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": null,
"contact_id": null,
"external_id": null,
"fields": {}
}
'import requests
url = "https://api.statisfy.com/v1/objects/{object}/records"
payload = {
"account_id": None,
"contact_id": None,
"external_id": None,
"fields": {}
}
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_id: null, contact_id: null, external_id: null, fields: {}})
};
fetch('https://api.statisfy.com/v1/objects/{object}/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/{object}/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_id' => null,
'contact_id' => null,
'external_id' => null,
'fields' => [
]
]),
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/{object}/records"
payload := strings.NewReader("{\n \"account_id\": null,\n \"contact_id\": null,\n \"external_id\": null,\n \"fields\": {}\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/{object}/records")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": null,\n \"contact_id\": null,\n \"external_id\": null,\n \"fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.statisfy.com/v1/objects/{object}/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_id\": null,\n \"contact_id\": null,\n \"external_id\": null,\n \"fields\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"account_id": "<string>",
"contact_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"fields": {},
"updated_at": "2023-11-07T05:31:56Z"
}Authorizations
An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.
Path Parameters
Body
application/json
The values plus what only a create sets: what the record belongs to, and its id upstream.
Response
201 - application/json
Successful Response
Was this page helpful?