Exchange Auth Code
curl --request POST \
--url https://production.trackstarhq.com/link/exchange \
--header 'Content-Type: application/json' \
--header 'x-trackstar-api-key: <x-trackstar-api-key>' \
--data '
{
"auth_code": "auth_code",
"customer_id": "customer_id"
}
'import requests
url = "https://production.trackstarhq.com/link/exchange"
payload = {
"auth_code": "auth_code",
"customer_id": "customer_id"
}
headers = {
"x-trackstar-api-key": "<x-trackstar-api-key>",
"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>',
'Content-Type': 'application/json'
},
body: JSON.stringify({auth_code: 'auth_code', customer_id: 'customer_id'})
};
fetch('https://production.trackstarhq.com/link/exchange', 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/link/exchange",
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([
'auth_code' => 'auth_code',
'customer_id' => 'customer_id'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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/link/exchange"
payload := strings.NewReader("{\n \"auth_code\": \"auth_code\",\n \"customer_id\": \"customer_id\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-trackstar-api-key", "<x-trackstar-api-key>")
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/link/exchange")
.header("x-trackstar-api-key", "<x-trackstar-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"auth_code\": \"auth_code\",\n \"customer_id\": \"customer_id\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production.trackstarhq.com/link/exchange")
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["Content-Type"] = 'application/json'
request.body = "{\n \"auth_code\": \"auth_code\",\n \"customer_id\": \"customer_id\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "your_permanent_access_token",
"connection_id": "unique_connection_id",
"integration_name": "shipbob",
"customer_id": "customer_id",
"available_actions": [
"get_inventory",
"get_products"
],
"me": {
"account_id": "account_12345",
"account_name": "My WMS Account"
}
}{
"error": "<string>",
"detail": {
"<location>": {
"<field_name>": [
"<string>"
]
}
}
}Admin API Reference
Exchange Auth Code
Exchanges a temporary authorization code for a permanent access token. See the Getting Started guide for more details.
POST
/
link
/
exchange
Exchange Auth Code
curl --request POST \
--url https://production.trackstarhq.com/link/exchange \
--header 'Content-Type: application/json' \
--header 'x-trackstar-api-key: <x-trackstar-api-key>' \
--data '
{
"auth_code": "auth_code",
"customer_id": "customer_id"
}
'import requests
url = "https://production.trackstarhq.com/link/exchange"
payload = {
"auth_code": "auth_code",
"customer_id": "customer_id"
}
headers = {
"x-trackstar-api-key": "<x-trackstar-api-key>",
"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>',
'Content-Type': 'application/json'
},
body: JSON.stringify({auth_code: 'auth_code', customer_id: 'customer_id'})
};
fetch('https://production.trackstarhq.com/link/exchange', 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/link/exchange",
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([
'auth_code' => 'auth_code',
'customer_id' => 'customer_id'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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/link/exchange"
payload := strings.NewReader("{\n \"auth_code\": \"auth_code\",\n \"customer_id\": \"customer_id\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-trackstar-api-key", "<x-trackstar-api-key>")
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/link/exchange")
.header("x-trackstar-api-key", "<x-trackstar-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"auth_code\": \"auth_code\",\n \"customer_id\": \"customer_id\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production.trackstarhq.com/link/exchange")
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["Content-Type"] = 'application/json'
request.body = "{\n \"auth_code\": \"auth_code\",\n \"customer_id\": \"customer_id\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "your_permanent_access_token",
"connection_id": "unique_connection_id",
"integration_name": "shipbob",
"customer_id": "customer_id",
"available_actions": [
"get_inventory",
"get_products"
],
"me": {
"account_id": "account_12345",
"account_name": "My WMS Account"
}
}{
"error": "<string>",
"detail": {
"<location>": {
"<field_name>": [
"<string>"
]
}
}
}Headers
Your organization-level Trackstar API key.
Example:
"<x-trackstar-api-key>"
Body
application/json
Response
Successful response
The permanent access token for the integration used to make requests to the Trackstar API.
Example:
"your_permanent_access_token"
A unique connection ID for the integration.
Example:
"unique_connection_id"
The name of the integration that was installed.
Example:
"shipbob"
An identifier for your end customer.
Example:
"customer_id"
A list of actions that the integration supports.
Actions supported by the integration
Example:
["get_inventory", "get_products"]
Information that helps identify the connected account. If null, the integration does not provide this information.
Show child attributes
Show child attributes
Example:
{ "account_id": "account_12345", "account_name": "My WMS Account" }