# Click API
advanced expert team enterprise
Click API is an app interface to run Keitaro campaign remotely.
# Click API clients
Official clients:
Third party:
# How it works
To get access to the API you need a campaign token
Click API endpoint:
/click_api/v3?
Example:
curl -I "http://domain/click_api/v3?token=q831vzbxkbcnyk23z3jwww4pbhhtpxpm&log=1&info=1"
1
Response (JSON):
{
    "body": null,
    "contentType": "text/html; charset=utf-8",
    "headers": [
        "Location: https://domain.com/?data=&utm-campaign=aff1"
    ],
    "info": {
        "campaign_id": 2,
        "stream_id": 1117,
        "sub_id": "o2q6e42hs08jq",
        "type": "location",
        "url": "https://domain.com/?data=$keyword&utm-campaign=aff1"
    },
    "log": [
        "Processing campaign 2",
        "Referrer: ",
        "Source: ",
        "Keyword: ",
        "IP: 127.0.0.1",
        "UserAgent: HTTPie/0.6.0",
        "Language: ",
        "Is unique in campaign: no",
        "Checking stream #1282",
        "Filter  \"uniqueness\": allow",
        "Filter \"uniqueness\": rejected",
        "Checking stream #1343",
        "Filter \"region\": rejected",
        "Checking stream #1355",
        "Filter  \"limit\": allow",
        "Filter \"ip\": rejected",
        "Checking stream #1117",
        "Accepted by filters",
        "Stream #1117",
        "Send headers: Location: http://domain.com/?data=&utm-campaign=aff1",
        "[Profiler] 0.101 sec.  1 sql queries, 9MB (+7MB)"
    ],
    "uniqueness_cookie": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjoie1wic3RyZWFtc1wiOntcIjExMTdcIjoxNDkwNzA1MTQyfSxcImNhbXBhaWduc1wiOntcIjJcIjoxNDkwNzA1MTQyfSxcInRpbWVcIjoxNDkwNzA1MTQyfSJ9._u5H9oOOdyp02VTnDN8VG47oLDoqRHHKyYI3ChxRqw8"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Request parameters
- version. Version of Click API (current is 3).
- ip. IP address of the IPv4 type.
- user_agent. Raw browser user agent.
- language. Language ISO code.
- landing_id. Is used to specify from what landing page the request was made. Keitaro uses it for statistics.
- uniqueness_cookie. Send cookies from the browser.
- x_requested_with. Browsers x_requested_withheader.
- log. Use 1 to add traffic log to the response.
- info. Use 1 to add the additional information to the response.
- force_redirect_offer. Use 1to get redirect to the offer in response body. Leave empty to get_tokento make Offer URL.
# Response
Response type json.
| Field | Value type | Description | 
|---|---|---|
| headers | string[] | Array of header responses | 
| status | string | HTTP Status Code (optional) | 
| body | string | Body of the response (for example, the page text) | 
| contentType | string | Response type (example, application/json; charset=utf-8) | 
| uniqueness_cookie | string | Cookie that you must send in further requests to Click API | 
| cookies_ttl | int | How many hours to store cookies on website side | 
| log | string[] | Contents of the click processing log (optional) | 
| info | object | Container with information by click | 
| info.sub_id | string | Unique click ID | 
| info.campaign_id | int | Campaign ID | 
| info.stream_id | int | Flow ID | 
| info.landing_id | int | Landing ID | 
| info.offer_id | int[] | Offer ID | 
| info.token | string | Offer token for Offer URL | 
| info.uniqueness | array | Click uniqueness data array | 
| info.uniqueness.campaign | boolean | Unique for a campaign | 
| info.uniqueness.stream | boolean | Unique for a flow | 
| info.uniqueness.global | boolean | Unique for the tracker | 
| info.is_bot | boolean | Detected as bot | 
# Http responses
HTTP/1.1 200 Ok: indicates that the request has succeeded;
HTTP/1.1 401 Unauthorized: invalid API token specified;
HTTP/1.1 401 Unauthorized: API token campaign not found;
HTTP/1.1 409 Conflict: click API feature is turned off.
# Click API FAQ
How to create Offer URL?
Create the link of the following format:
http://trackerdomain.com/?_lp=1&_token=info.token
You'll get info.token at your first API request.
How to get a subid?
Example:
$url = "https://domain_tracker/click_api/v3?token=szvkqdf1tk28n9pkwwk3t8tbv4v9&info=1";
$response = json_decode (file_get_contents ($url));
$subid = $response->info->sub_id;
var_dump($subid)
1
2
3
4
2
3
4
