Advertiser Integration
API Tracking Integration

Integration Steps

1. Authentication

Linkbest will provide you with a unique ADS_KEY which you can use to call Linkbest's API. You can obtain the ADS_KEY in the brand backend.

2. Request Interface Requirements

  • Encoding Requirement: The data sent must be encoded in UTF-8.

  • Request Method: POST

  • HTTP Content-Type Requirement: When encoding the request body as a form, set the HTTP Content-Type header to application/x-www-form-urlencoded. When encoding the request body as JSON, set it to application/json. If you need to upload a file as part of the request, specify multipart/form-data.

  • Linkbest API Endpoint:
  • Request Parameter Format Restrictions:

    Parameter TypeFormat Requirements
    string255 UTF-8 characters
    decimal8 digits, 2 decimal places
    datetimeISO-8601 (e.g., 2022-12-11T11:10:01-07:00)
    currencyISO-4217 (e.g., USD)
    integer16 digits

3. Request Example

Each API route should include the ADS_KEY and the corresponding SERVICE_NAME. You can find the specific SERVICE_NAME for each API in the API documentation.

curl Example
# Example curl command
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -d 'OrderId=TestOrderId'
PHP Request Example
// Example PHP code
$ch = curl_init();
$data = [
curl_setopt($ch, CURLOPT_URL, '{ADS_KEY}/{SERVICE_NAME}');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = [
    'Content-Type: application/x-www-form-urlencoded',
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec($ch);
curl_close ($ch);
Go Request Example
// Example Go code
package main

import (

func main() {
	url := "{ADS_KEY}/{SERVICE_NAME}"
	method := "POST"

	payload := strings.NewReader("OrderId=TestOrderId")

	client := &http.Client {}
	req, err := http.NewRequest(method, url, payload)

	if err != nil {
	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, err := client.Do(req)
	defer res.Body.Close()
	body, err := ioutil.ReadAll(res.Body)

Java Request Example
// Example Java code

public class Main {
    public static void main(String[] args) throws Exception {
        URL url = new URL ("{ADS_KEY}/{SERVICE_NAME}");
        String urlParameters = "OrderId=TestOrderId";
        byte[] postData = urlParameters.getBytes( StandardCharsets.UTF_8 );
        int postDataLength = postData.length;
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();           
        conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); 
        conn.setRequestProperty("charset", "utf-8");
        conn.setRequestProperty("Content-Length", Integer.toString(postDataLength ));
        try(OutputStream wr = conn.getOutputStream()) {
        int responseCode = conn.getResponseCode();

4. Error Handling

There may be failures when making API requests for various reasons. When an error is returned, the system provides a message indicating more detailed information about the failure. Please adjust accordingly based on this information and retry, or contact our integration engineer for assistance. For more information, please refer to the error codes.