curl --request POST \
--url https://api.vectorshift.ai/v1/object-model/records/{type_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"idempotency_key": "<string>",
"links": {},
"type_id": "<string>",
"unique_by": [
"<string>"
],
"values": {}
}
'import requests
url = "https://api.vectorshift.ai/v1/object-model/records/{type_id}"
payload = {
"idempotency_key": "<string>",
"links": {},
"type_id": "<string>",
"unique_by": ["<string>"],
"values": {}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
idempotency_key: '<string>',
links: {},
type_id: '<string>',
unique_by: ['<string>'],
values: {}
})
};
fetch('https://api.vectorshift.ai/v1/object-model/records/{type_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.vectorshift.ai/v1/object-model/records/{type_id}",
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([
'idempotency_key' => '<string>',
'links' => [
],
'type_id' => '<string>',
'unique_by' => [
'<string>'
],
'values' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.vectorshift.ai/v1/object-model/records/{type_id}"
payload := strings.NewReader("{\n \"idempotency_key\": \"<string>\",\n \"links\": {},\n \"type_id\": \"<string>\",\n \"unique_by\": [\n \"<string>\"\n ],\n \"values\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.vectorshift.ai/v1/object-model/records/{type_id}")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"<string>\",\n \"links\": {},\n \"type_id\": \"<string>\",\n \"unique_by\": [\n \"<string>\"\n ],\n \"values\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vectorshift.ai/v1/object-model/records/{type_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"<string>\",\n \"links\": {},\n \"type_id\": \"<string>\",\n \"unique_by\": [\n \"<string>\"\n ],\n \"values\": {}\n}"
response = http.request(request)
puts response.read_body{
"deleted_id": "<string>",
"disposition": "<string>",
"next_cursor": "<string>",
"records": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"id": "<string>",
"label": "<string>",
"links": {},
"locked": true,
"revision": "<string>",
"type_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"values": {}
}
],
"summary": {},
"total_count": "<string>",
"written_id": "<string>"
}Create a record
Create a record from plain values, or return the existing one: with unique_by, a record that matches on those fields is returned unchanged and the supplied values are not applied (disposition says which). Answers with written_id and the record.
Re-sent under the same Idempotency-Key: The key stays with the record it created: re-sent, it answers that record and creates none; a different body under the key is refused.
curl --request POST \
--url https://api.vectorshift.ai/v1/object-model/records/{type_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"idempotency_key": "<string>",
"links": {},
"type_id": "<string>",
"unique_by": [
"<string>"
],
"values": {}
}
'import requests
url = "https://api.vectorshift.ai/v1/object-model/records/{type_id}"
payload = {
"idempotency_key": "<string>",
"links": {},
"type_id": "<string>",
"unique_by": ["<string>"],
"values": {}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
idempotency_key: '<string>',
links: {},
type_id: '<string>',
unique_by: ['<string>'],
values: {}
})
};
fetch('https://api.vectorshift.ai/v1/object-model/records/{type_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.vectorshift.ai/v1/object-model/records/{type_id}",
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([
'idempotency_key' => '<string>',
'links' => [
],
'type_id' => '<string>',
'unique_by' => [
'<string>'
],
'values' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.vectorshift.ai/v1/object-model/records/{type_id}"
payload := strings.NewReader("{\n \"idempotency_key\": \"<string>\",\n \"links\": {},\n \"type_id\": \"<string>\",\n \"unique_by\": [\n \"<string>\"\n ],\n \"values\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.vectorshift.ai/v1/object-model/records/{type_id}")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"<string>\",\n \"links\": {},\n \"type_id\": \"<string>\",\n \"unique_by\": [\n \"<string>\"\n ],\n \"values\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vectorshift.ai/v1/object-model/records/{type_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"<string>\",\n \"links\": {},\n \"type_id\": \"<string>\",\n \"unique_by\": [\n \"<string>\"\n ],\n \"values\": {}\n}"
response = http.request(request)
puts response.read_body{
"deleted_id": "<string>",
"disposition": "<string>",
"next_cursor": "<string>",
"records": [
{
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"id": "<string>",
"label": "<string>",
"links": {},
"locked": true,
"revision": "<string>",
"type_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"values": {}
}
],
"summary": {},
"total_count": "<string>",
"written_id": "<string>"
}Authorizations
An API key issued with object_model scopes: Authorization: Bearer sk_…. The scopes: object_model:records:read, object_model:records:write, object_model:facts:read, object_model:facts:write, object_model:model:read, object_model:model:configure, object_model:actions:run, object_model:changes:read. An operation's security lists the scopes it needs; several entries mean any one of them will do. A person field (ref(user), ref_list(user)) holds a user id: look people up by email or id with GET /v1/users, outside this API, with a key that also has users:read.
Headers
Required on every write: one key per logical write, sent again unchanged on every retry. A finished request replays its answer for 24 hours; the same key on a different request is refused (409 idempotency_key_reused). A dry run (dry_run: true) needs none, and is not recorded under one it carries.
1 - 255^[\x20-\x7E]+$Body
The record's fields, each keyed by its name in the JSON its storage takes. null clears a field. Every value is checked against its field before anything is written, and a value of the wrong shape is refused (422 wrong_shape).
storage | Write | Example |
|---|---|---|
string, text | A string. | "Elm Court" |
url | An absolute http or https URL. | "https://elmcourt.example.com" |
phone | A phone number, as a string. | "+1 (512) 555-0100" |
int | A whole number. | 24 |
decimal, number, or a unit such as USD | A number, in the field's unit: dollars, not cents. A percent is a fraction. | 3200000, 0.0625 |
bool | true or false. | true |
timestamp | An RFC 3339 time, a date (midnight UTC), or epoch seconds as a number. | "2024-03-01T15:30:00Z", "2024-03-01", 1709251200 |
single_select | One of the field's allowed_values: the value, never its label (else 422 not_an_option). | "under_contract" |
multi_select | An array of allowed_values, each at most once. | ["pool", "gym"] |
string_list | An array of strings; of allowed_values when the field lists any. | ["north", "east"] |
personal_name | An object with first_name and last_name; a middle name or initial goes in first_name. full_name may be left out, and if sent must be the two joined by a space. | {"first_name": "Jane Q.", "last_name": "Doe"} |
location | An object with any of street_address, city, state, postal_code and country, each a string. | {"street_address": "12 Elm St", "city": "Austin", "state": "TX", "postal_code": "78701", "country": "US"} |
ref(<type_id>), ref(user) | One record id of that type, or a person's user id (look one up by email with GET /v1/users). A field naming several types, such as ref(company,person), takes an id of any of them. | "6650a1f4c2e9b81d3f0e7a12" |
ref_list(<type_id>), ref_list(user) | An array of ids, at most 500, each at most once. | ["6650a1f4c2e9b81d3f0e7a12", "6650a1f4c2e9b81d3f0e7a13"] |
image | An object naming, by id, a file already uploaded to the organization. This API does not upload files. | {"id": "6650d5e3b1f8a92c4e0d6b31"} |
Response
Answered.
With aggregates or group: {"aggregates": [{"field", "op", "value", "error"}], "groups": [{"value", "count", "aggregates": […]}], "groups_truncated"}. aggregates are in the order asked, over every match, not only this page. A count is 0 when nothing matches; a sum, average, min or max is null when no match has a value. groups has one entry per value of the group field, in ascending order (records with no value form a group whose value is null), at most 200, with groups_truncated set past that. Sent again on every page.
