Create an attribution link
curl --request POST \
--url https://app.openlight.tech/api/creator/v1/links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"brand_id": "<string>",
"product_id": "<string>",
"destination_url": "<string>",
"tracking_id": "<string>"
}
'import requests
url = "https://app.openlight.tech/api/creator/v1/links"
payload = {
"brand_id": "<string>",
"product_id": "<string>",
"destination_url": "<string>",
"tracking_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
brand_id: '<string>',
product_id: '<string>',
destination_url: '<string>',
tracking_id: '<string>'
})
};
fetch('https://app.openlight.tech/api/creator/v1/links', 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://app.openlight.tech/api/creator/v1/links",
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([
'brand_id' => '<string>',
'product_id' => '<string>',
'destination_url' => '<string>',
'tracking_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.openlight.tech/api/creator/v1/links"
payload := strings.NewReader("{\n \"brand_id\": \"<string>\",\n \"product_id\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://app.openlight.tech/api/creator/v1/links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"brand_id\": \"<string>\",\n \"product_id\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.openlight.tech/api/creator/v1/links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"brand_id\": \"<string>\",\n \"product_id\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"link": {
"id": "<string>",
"brand_id": "<string>",
"product_id": "<string>",
"url": "<string>",
"destination_url": "<string>",
"marketplace": "<string>",
"tracking_id": "<string>",
"status": "active",
"created_at": "2023-11-07T05:31:56Z"
}
}Links
Create attribution link
Create a creator attribution link
POST
/
api
/
creator
/
v1
/
links
Create an attribution link
curl --request POST \
--url https://app.openlight.tech/api/creator/v1/links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"brand_id": "<string>",
"product_id": "<string>",
"destination_url": "<string>",
"tracking_id": "<string>"
}
'import requests
url = "https://app.openlight.tech/api/creator/v1/links"
payload = {
"brand_id": "<string>",
"product_id": "<string>",
"destination_url": "<string>",
"tracking_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
brand_id: '<string>',
product_id: '<string>',
destination_url: '<string>',
tracking_id: '<string>'
})
};
fetch('https://app.openlight.tech/api/creator/v1/links', 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://app.openlight.tech/api/creator/v1/links",
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([
'brand_id' => '<string>',
'product_id' => '<string>',
'destination_url' => '<string>',
'tracking_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.openlight.tech/api/creator/v1/links"
payload := strings.NewReader("{\n \"brand_id\": \"<string>\",\n \"product_id\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://app.openlight.tech/api/creator/v1/links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"brand_id\": \"<string>\",\n \"product_id\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.openlight.tech/api/creator/v1/links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"brand_id\": \"<string>\",\n \"product_id\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"link": {
"id": "<string>",
"brand_id": "<string>",
"product_id": "<string>",
"url": "<string>",
"destination_url": "<string>",
"marketplace": "<string>",
"tracking_id": "<string>",
"status": "active",
"created_at": "2023-11-07T05:31:56Z"
}
}Use this endpoint to create an attribution link. The request must include
brand_id and product_id; it may also include optional tracking_id and destination_url.
Field notes:
tracking_id: Client-side tracking tag, up to 200 characters. Put your downstream tag, campaign, or source value here. Leading/trailing whitespace is trimmed and ASCII control characters are rejected. Create and list responses return the normalized value, and future reports will use it for downstream attribution.destination_url: Amazon landing page URL. If omitted, OpenLight uses the product detail page. It controls where the click lands and is not a tracking tag.
201 with { "link": LinkDTO }.
The response marketplace field returns the Amazon marketplace domain for the link, such as amazon.com, amazon.co.uk, or amazon.de. It identifies the link’s Amazon site; it is not a partnership status or tracking tag.
Possible errors include:
400 invalid_request: The request body is incomplete or invalid.403 forbidden_resource: The current token owner cannot access the brand or product.403 ads_not_connected: The brand ads connection is not ready for link creation.404 product_not_found: The product does not exist or is not accessible.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
品牌 ID。Brand ID.
商品 ID。Product ID.
Amazon 落地页 URL;可选,默认使用商品详情页。Amazon landing page URL; optional, defaults to the product detail page.
客户侧追踪标识;可选,前后空白会被裁剪,不能包含 ASCII 控制字符。创建和列表响应会返回规范化后的值,后续报表也会使用该字段做下游归因。Client-side tracking tag; optional, leading/trailing whitespace is trimmed and ASCII control characters are rejected. Create/list responses return the normalized value, intended for downstream reporting.
Maximum string length:
200Response
Attribution link created
Show child attributes
Show child attributes