Skip to main content
POST
/
connections
/
sync
Sync Connection
curl --request POST \
  --url https://production.trackstarhq.com/connections/sync \
  --header 'Content-Type: application/json' \
  --header 'x-trackstar-access-token: <x-trackstar-access-token>' \
  --header 'x-trackstar-api-key: <x-trackstar-api-key>' \
  --data '
{
  "functions_to_sync": [
    "get_inventory",
    "get_orders"
  ]
}
'
import requests

url = "https://production.trackstarhq.com/connections/sync"

payload = { "functions_to_sync": ["get_inventory", "get_orders"] }
headers = {
"x-trackstar-api-key": "<x-trackstar-api-key>",
"x-trackstar-access-token": "<x-trackstar-access-token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'x-trackstar-api-key': '<x-trackstar-api-key>',
'x-trackstar-access-token': '<x-trackstar-access-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({functions_to_sync: ['get_inventory', 'get_orders']})
};

fetch('https://production.trackstarhq.com/connections/sync', 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://production.trackstarhq.com/connections/sync",
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([
'functions_to_sync' => [
'get_inventory',
'get_orders'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-trackstar-access-token: <x-trackstar-access-token>",
"x-trackstar-api-key: <x-trackstar-api-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://production.trackstarhq.com/connections/sync"

payload := strings.NewReader("{\n \"functions_to_sync\": [\n \"get_inventory\",\n \"get_orders\"\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-trackstar-api-key", "<x-trackstar-api-key>")
req.Header.Add("x-trackstar-access-token", "<x-trackstar-access-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://production.trackstarhq.com/connections/sync")
.header("x-trackstar-api-key", "<x-trackstar-api-key>")
.header("x-trackstar-access-token", "<x-trackstar-access-token>")
.header("Content-Type", "application/json")
.body("{\n \"functions_to_sync\": [\n \"get_inventory\",\n \"get_orders\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://production.trackstarhq.com/connections/sync")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-trackstar-api-key"] = '<x-trackstar-api-key>'
request["x-trackstar-access-token"] = '<x-trackstar-access-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"functions_to_sync\": [\n \"get_inventory\",\n \"get_orders\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "id": "07b344db-0304-4866-9ae1-ac8af5292a28",
  "syncing": true,
  "functions_to_sync": [
    "get_inventory",
    "get_orders"
  ]
}
{
"error": "<string>",
"detail": {
"<location>": {
"<field_name>": [
"<string>"
]
}
}
}

Headers

x-trackstar-api-key
string
required

Your organization-level Trackstar API key.

Example:

"<x-trackstar-api-key>"

x-trackstar-access-token
string
required

Your user's access token for a specific integration (ShipHero, Extensiv, etc).

Example:

"<x-trackstar-access-token>"

Body

application/json
functions_to_sync
enum<string>[]

The specific functions to force sync. Make sure to use one compatible with the connection's type.

Function to sync

Available options:
get_inventory,
get_products,
get_inbound_shipments,
get_orders,
get_warehouses,
get_shipping_methods,
get_returns,
get_bills,
get_warehouse_customers,
get_warehouse_locations,
get_inventory_ledger,
populate_customer_order_trackstar_tags,
get_shipments,
redact_cart_orders,
get_invoice_line_items,
get_sales_orders,
get_sales_order_shipments,
get_locations,
get_items,
get_customers,
get_vendors,
get_employees,
get_purchase_orders,
get_purchase_order_receipts
Example:
["get_inventory", "get_orders"]

Response

Successful response

id
string
required

The id of the connection synced.

Example:

"07b344db-0304-4866-9ae1-ac8af5292a28"

syncing
boolean
required

Whether or not the connection is syncing.

Example:

true

functions_to_sync
string[]
required

The functions that are being synced. Returns empty if all are being synced.

Example:
["get_inventory", "get_orders"]