Update
curl --request POST \
--url https://api.sequin.io/v1/mutations/run \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sequin.io/v1/mutations/run"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sequin.io/v1/mutations/run', 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.sequin.io/v1/mutations/run",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sequin.io/v1/mutations/run"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.sequin.io/v1/mutations/run")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequin.io/v1/mutations/run")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyMutation API
Update
POST
/
v1
/
mutations
/
run
Update
curl --request POST \
--url https://api.sequin.io/v1/mutations/run \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sequin.io/v1/mutations/run"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sequin.io/v1/mutations/run', 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.sequin.io/v1/mutations/run",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sequin.io/v1/mutations/run"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.sequin.io/v1/mutations/run")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequin.io/v1/mutations/run")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyUpdate mutation
For update mutations, the request body is anUpdateMutationRequest object with the following shape:
UpdateMutationRequest
{
kind: "update";
sync_id: string;
collection_id: string;
data: PartialRecord[];
await_consumer_ids?: string[];
await_consumers_timeout?: number;
}
We use
PATCH in all update mutations.Parameters
string
required
The ID of the sync that the mutations should apply to.
string
required
The ID of the collection that the mutations should apply to.
array
required
A list of one or more
PartialRecord objects.array
A list of one or more consumer IDs. See await consumers below.
integer
The number of milliseconds to wait for consumers to finish processing a mutation. Defaults to
30000 (30 seconds). See await consumers below.Response
If the mutation succeeds, Sequin will return a JSON object with arecords property containing each record:
200 OK
{
"records": [
{
"sync_id": "70a313f8-7c94-43d4-8d0c-5659a52de5c4",
"collection_id" : "salesforce:task",
"upstream_id": "0018b000021BldZAAS",
"upstream_updated_at": "2024-11-10T18:39:00.070453Z",
"data": {
"activity_date": "2023-09-12",
"description" : "task description [ ... ] ",
// ...
},
"deleted": false,
// ...
}
]
}
400 Bad Request response with an error message:
400 Bad Request
{
"error": "Error: Salesforce validation error: `Invalid email`",
"docs": [ ... ]
}
504 Gateway Timeout response with an error message:
504 Gateway Timeout
{
"error": "Error: Salesforce API timed out",
"docs": [ ... ]
}
Examples
Update a single record:curl -X POST \
https://api.sequin.io/v1/mutations/run \
-H 'content-type: application/json' \
-H 'authorization: Bearer {token}' \
-d '{
"kind": "update",
"sync_id": "my-sync-id",
"collection_id": "salesforce:contact",
"records": [
{
"upstream_id": "0031U00000Qn2ZVQAZ",
"data": {
"FirstName": "Paul",
"LastName": "Atreides",
"Email": "paul@arrakis.org"
}
}
]
}'
curl -X POST \
https://api.sequin.io/v1/mutations/run \
-H 'content-type: application/json' \
-H 'authorization: Bearer {token}' \
-d '{
"kind": "update",
"sync_id": "my-sync-id",
"collection_id": "salesforce:contact",
"records": [
{
"upstream_id": "0031U00000Qn2ZVQAZ",
"data": {
"FirstName": "Paul",
"LastName": "Atreides",
"Email": "paul@arrakis.org"
}
},
{
"upstream_id": "0031U00000Qn2ZVQBA",
"data": {
"FirstName": "Duncan",
"LastName": "Idaho",
"Email": "duncan@arrakis.org"
}
}
]
}'

