Publisher Integration
Getting Started

Overview of Website Access

Linkbest API provides a range of functionalities that allow publishers to effectively monetize their traffic and optimize their advertising strategies. By integrating with this API, publishers can:

  • Access Advertising Campaigns: Retrieve detailed information about available advertising campaigns, including campaign descriptions, commission rates, and promotional materials.
  • Generate Affiliate Links: Generate unique affiliate links for specific products or promotions, enabling publishers to track referrals and earn commissions for successful sales.
  • Track Conversions: Monitor and track conversions generated through affiliate links, allowing publishers to measure the effectiveness of their promotional efforts and optimize their marketing strategies.
  • Get Earnings and Statistics Data: Real-time access to earnings and performance statistics such as click counts, conversions, and commissions, to understand the performance and revenue of advertising campaigns.

Integration Steps

1. Create Website & Obtain APP_KEY and Secret Key (APP_SECRET)

After registering and logging in to Linkbest, go to "My Alliance". Click on "Website Management" in the promotion management section and click "Add Website" to create a website.

Note: To facilitate easier promotion for regular users, the system will create a default website for you after successful registration. You can also create additional website according to your specific needs.

After successful creation, your dedicated customer service will review your website within one working day. You can also contact your dedicated customer service to expedite the website review process.

Once the website is created, you can obtain the APP_KEY and APP_SECRET, which will be used for API calls. View API Integration Documentation

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 form data, set the HTTP Content-Type header to application/x-www-form-urlencoded. If encoding the request body as JSON, set it to application/json. If you need to upload files as part of the request, use multipart/form-data.

  • Linkbest API Endpoint:
  • Request Parameter Format Requirements:

    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. Signature Authentication

Below is an example of calling the Get Promotion Conversion Links ( interface.

Parameter Example

// Public parameters
// API parameters

1. Concatenate the public parameters in alphabetical

{"Timestamp":"1692696195","Url":"","SiteId":"1026"} (opens in a new tab)

2. Append the post request JSON parameters

/AppKey/{"Timestamp":"1692696195","Url":"","SiteId":"1026"} (opens in a new tab)

3. Append the app_secret=(website's push hash)

AppSecret/AdsName/{"Timestamp":"1692696195","Url":"","SiteId":"1026"}AppSecret (opens in a new tab)

4. MD5 hash the resulting signature string and convert it to uppercase to obtain the sign parameter


5. Concatenate the public parameters as query parameters to form the request URL

6. Set the HTTP request headers and use the API parameters as the JSON body

4. Request Example

cURL Example
# Example curl command
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -d 'sign=**********' \
    -d 'app_key=**********' \
    -d 'timestamp=**********' \
    -d 'service=**********' 
php Request Example
   $AppKey = "your key";
   $AppSecret = "your secret";
   $header = [
       "Content-Type" => "application/json"
   $Url = "/{$AppKey}/";
   $Body = [
       "Timestamp" => time(),
       "Url"=> "",
   $SignStr = json_encode($Body, JSON_UNESCAPED_SLASHES);
   $body["Sign"] = strtoupper(md5($AppSecret . $Url . $SignStr . $AppSecret));
   try {
       $client = new \GuzzleHttp\Client();
       $response = $client->request('POST', sprintf("%s%s", '', $Url), [
           "verify" => false,
           "headers" => $header,
           "body" => json_encode($body, JSON_UNESCAPED_UNICODE)
   } catch (ClientException $e) {
       $response = $e->getResponse();
   echo $response->getStatusCode();
   echo $response->getHeaderLine('content-type');
   echo $response->getBody()->getContents();
golang Request Example
package main

import (

func main() {
	AppKey := "your key"
	AppSecret := "your secret"

	Url := fmt.Sprintf("/%s/", AppKey)
	Body := map[string]interface{}{
		"Timestamp": time.Now().Unix(),
		"Stime":     time.Now().Unix(),
		"Etime":     time.Now().Unix(),

	// sort keys
	BodyKeys := make([]string, 0, len(Body))
	for k := range Body {
		BodyKeys = append(BodyKeys, k)

	sortedMap := make(map[string]interface{})
	for _, k := range BodyKeys {
		sortedMap[k] = Body[k]

	bodyStr, _ := json.Marshal(sortedMap)


	Sign := fmt.Sprintf("%X", md5.Sum([]byte(AppSecret+Url+string(bodyStr)+AppSecret)))
	Body["Sign"] = Sign

	client := &http.Client{}

	bodyStr, _ = json.Marshal(Body)
	req, err := http.NewRequest("POST", fmt.Sprintf("%s%s", "", Url), strings.NewReader(string(bodyStr)))
	if err != nil {
		fmt.Println("Error creating request:", err)
	req.Header.Set("Content-Type", "application/json")
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("Error sending request:", err)
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("Error reading response:", err)
	fmt.Println("Status Code:", resp.StatusCode)
	fmt.Println("Content-Type:", resp.Header.Get("Content-Type"))
	fmt.Println("Response:", string(body))
java Request Example
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.*;

public class Main {
  public static void main(String[] args) throws JsonProcessingException {
    String appKey = "your key";
    String appSecret = "your secret";
    String url = "/" + appKey + "/";
    Map<String, Object> body = new TreeMap<>();
    body.put("Timestamp", new Date().getTime() / 1000);
    body.put("Stime", new Date().getTime() / 1000);
    body.put("Etime", new Date().getTime() / 1000);

    ObjectMapper objectMapper = new ObjectMapper();
    String signStr = objectMapper.writeValueAsString(body);
    String sign = md5(appSecret + url + signStr + appSecret);
    body.put("Sign", sign);


    try {
      URI uri = new URI("" + url);
      HttpRequest request =
              .header("Content-Type", "application/json")
      String result =
          HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()).body();

    } catch (Exception e) {

  private static String md5(String input) {
    try {
      MessageDigest md = MessageDigest.getInstance("MD5");
      byte[] messageDigest = md.digest(input.getBytes());
      StringBuilder hexString = new StringBuilder();
      for (byte b : messageDigest) {
        hexString.append(String.format("%02X", b));
      return hexString.toString();
    } catch (NoSuchAlgorithmException e) {
      return null;

5. Error Handling

There may be cases where the API request fails due to various reasons. When an error is returned, the system will provide a message indicating more detailed information about the failure. Adjust your request based on this information and retry, or contact our integration engineer for assistance. Please refer to the Error Codes for more details.