Create Link Token
curl --request POST \
--url https://production.trackstarhq.com/link/token \
--header 'Content-Type: application/json' \
--header 'x-trackstar-api-key: <x-trackstar-api-key>' \
--data '
{
"connection_id": "existing_connection_id",
"customer_id": "customer_id"
}
'import requests
url = "https://production.trackstarhq.com/link/token"
payload = {
"connection_id": "existing_connection_id",
"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({connection_id: 'existing_connection_id', customer_id: 'customer_id'})
};
fetch('https://production.trackstarhq.com/link/token', 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/token",
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([
'connection_id' => 'existing_connection_id',
'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/token"
payload := strings.NewReader("{\n \"connection_id\": \"existing_connection_id\",\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/token")
.header("x-trackstar-api-key", "<x-trackstar-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"connection_id\": \"existing_connection_id\",\n \"customer_id\": \"customer_id\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production.trackstarhq.com/link/token")
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 \"connection_id\": \"existing_connection_id\",\n \"customer_id\": \"customer_id\"\n}"
response = http.request(request)
puts response.read_body{
"link_token": "your_link_token"
}{
"error": "<string>",
"detail": {
"<location>": {
"<field_name>": [
"<string>"
]
}
}
}Admin API Reference
Create Link Token
Creates a temporary link token that is required to initiate the react-trackstar-link component.
See the Getting Started guide for more details.
POST
/
link
/
token
Create Link Token
curl --request POST \
--url https://production.trackstarhq.com/link/token \
--header 'Content-Type: application/json' \
--header 'x-trackstar-api-key: <x-trackstar-api-key>' \
--data '
{
"connection_id": "existing_connection_id",
"customer_id": "customer_id"
}
'import requests
url = "https://production.trackstarhq.com/link/token"
payload = {
"connection_id": "existing_connection_id",
"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({connection_id: 'existing_connection_id', customer_id: 'customer_id'})
};
fetch('https://production.trackstarhq.com/link/token', 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/token",
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([
'connection_id' => 'existing_connection_id',
'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/token"
payload := strings.NewReader("{\n \"connection_id\": \"existing_connection_id\",\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/token")
.header("x-trackstar-api-key", "<x-trackstar-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"connection_id\": \"existing_connection_id\",\n \"customer_id\": \"customer_id\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production.trackstarhq.com/link/token")
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 \"connection_id\": \"existing_connection_id\",\n \"customer_id\": \"customer_id\"\n}"
response = http.request(request)
puts response.read_body{
"link_token": "your_link_token"
}{
"error": "<string>",
"detail": {
"<location>": {
"<field_name>": [
"<string>"
]
}
}
}Headers
Your organization-level Trackstar API key.
Example:
"<x-trackstar-api-key>"
Body
application/json
An optional existing connection ID. If provided, the connection is reinstalled instead of a new connection being created.
Example:
"existing_connection_id"
An optional identifier for your end customer. If provided, it is recorded on any failed install attempts made with this link token and carried onto the connection once it is created, so you can trace either back to a specific customer.
Example:
"customer_id"
Response
Successful response
The link token that is required to initiate the react-trackstar-link component.
Example:
"your_link_token"
⌘I