Create a click
Records a click and returns its id ({"id": "..."}) for use as click_id when creating a conversion. Identify the affiliate with referral_code (lower-cased and looked up in your account) or with asset_id plus source_id. A source_id sent with referral_code takes precedence over the code’s own source.
ip, user_agent, referrer and landing_page are stored only as sent, not taken from the HTTP request. Click reports derive country and device from ip and user_agent. meta_data keeps at most 10 pairs and truncates keys to 64 and values to 255 bytes. It silently drops pairs whose value is empty or 0, whose key is a whole number such as 1, or whose key or value contains any of " | : { } \ ' /.
Errors: 400 Program is archived. 400 with the generic message Bad Request when neither identification is sent, ip is not a valid IP address, or the affiliate is not an approved member of the program. 404 when the referral code, asset or source is not found.
You can learn how to set up a full REST-only integration in our REST integration guide.
curl --request POST \
--url https://api.tapfiliate.com/1.6/clicks/ \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"referral_code": "janejameson",
"source_id": "1-aaaaaa",
"meta_data": {
"foo": "bar"
},
"referrer": "https://their-site.com",
"landing_page": "https://my-site.com",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36"
}
'const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
referral_code: 'janejameson',
source_id: '1-aaaaaa',
meta_data: {foo: 'bar'},
referrer: 'https://their-site.com',
landing_page: 'https://my-site.com',
user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36'
})
};
fetch('https://api.tapfiliate.com/1.6/clicks/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tapfiliate.com/1.6/clicks/"
payload = {
"referral_code": "janejameson",
"source_id": "1-aaaaaa",
"meta_data": { "foo": "bar" },
"referrer": "https://their-site.com",
"landing_page": "https://my-site.com",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36"
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tapfiliate.com/1.6/clicks/",
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([
'referral_code' => 'janejameson',
'source_id' => '1-aaaaaa',
'meta_data' => [
'foo' => 'bar'
],
'referrer' => 'https://their-site.com',
'landing_page' => 'https://my-site.com',
'user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.tapfiliate.com/1.6/clicks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"referral_code\": \"janejameson\",\n \"source_id\": \"1-aaaaaa\",\n \"meta_data\": {\n \"foo\": \"bar\"\n },\n \"referrer\": \"https://their-site.com\",\n \"landing_page\": \"https://my-site.com\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36\"\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tapfiliate.com/1.6/clicks/"
payload := strings.NewReader("{\n \"referral_code\": \"janejameson\",\n \"source_id\": \"1-aaaaaa\",\n \"meta_data\": {\n \"foo\": \"bar\"\n },\n \"referrer\": \"https://their-site.com\",\n \"landing_page\": \"https://my-site.com\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<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://api.tapfiliate.com/1.6/clicks/")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"referral_code\": \"janejameson\",\n \"source_id\": \"1-aaaaaa\",\n \"meta_data\": {\n \"foo\": \"bar\"\n },\n \"referrer\": \"https://their-site.com\",\n \"landing_page\": \"https://my-site.com\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36\"\n}")
.asString();This response has no body data.{
"errors": [
{
"message": "Missing mandatory parameter(s)"
}
]
}{
"message": "Authentication Failed.",
"code": 401
}{
"message": "Forbidden",
"code": 403,
"traceId": "04ed655728a22bc0d39f"
}{
"message": "Not Found",
"code": 404,
"traceId": "7ae8e92b77572da03805"
}curl --request POST \
--url https://api.tapfiliate.com/1.6/clicks/ \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"referral_code": "janejameson",
"source_id": "1-aaaaaa",
"meta_data": {
"foo": "bar"
},
"referrer": "https://their-site.com",
"landing_page": "https://my-site.com",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36"
}
'const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
referral_code: 'janejameson',
source_id: '1-aaaaaa',
meta_data: {foo: 'bar'},
referrer: 'https://their-site.com',
landing_page: 'https://my-site.com',
user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36'
})
};
fetch('https://api.tapfiliate.com/1.6/clicks/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tapfiliate.com/1.6/clicks/"
payload = {
"referral_code": "janejameson",
"source_id": "1-aaaaaa",
"meta_data": { "foo": "bar" },
"referrer": "https://their-site.com",
"landing_page": "https://my-site.com",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36"
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tapfiliate.com/1.6/clicks/",
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([
'referral_code' => 'janejameson',
'source_id' => '1-aaaaaa',
'meta_data' => [
'foo' => 'bar'
],
'referrer' => 'https://their-site.com',
'landing_page' => 'https://my-site.com',
'user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.tapfiliate.com/1.6/clicks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"referral_code\": \"janejameson\",\n \"source_id\": \"1-aaaaaa\",\n \"meta_data\": {\n \"foo\": \"bar\"\n },\n \"referrer\": \"https://their-site.com\",\n \"landing_page\": \"https://my-site.com\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36\"\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tapfiliate.com/1.6/clicks/"
payload := strings.NewReader("{\n \"referral_code\": \"janejameson\",\n \"source_id\": \"1-aaaaaa\",\n \"meta_data\": {\n \"foo\": \"bar\"\n },\n \"referrer\": \"https://their-site.com\",\n \"landing_page\": \"https://my-site.com\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<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://api.tapfiliate.com/1.6/clicks/")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"referral_code\": \"janejameson\",\n \"source_id\": \"1-aaaaaa\",\n \"meta_data\": {\n \"foo\": \"bar\"\n },\n \"referrer\": \"https://their-site.com\",\n \"landing_page\": \"https://my-site.com\",\n \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36\"\n}")
.asString();This response has no body data.{
"errors": [
{
"message": "Missing mandatory parameter(s)"
}
]
}{
"message": "Authentication Failed.",
"code": 401
}{
"message": "Forbidden",
"code": 403,
"traceId": "04ed655728a22bc0d39f"
}{
"message": "Not Found",
"code": 404,
"traceId": "7ae8e92b77572da03805"
}