NAV
bash javascript php python

Authentication

The RetargetKit API uses API tokens to authenticate requests. You can manage your API tokens in the RetargetKit Dashboard

Do not share your API tokens in publicly accessible areas such as client-side code, and so forth.

Authentication to the API is performed via bearer auth. Use -H "Authorization: Bearer {token}"

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Campaigns

List all campaigns


Requires authentication

Example request:

curl -X GET \
    -G "https://api.retargetkit.com/v1/campaigns" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer {token}" \
    -d '{"workspace_id":1}'
const url = new URL(
    "https://api.retargetkit.com/v1/campaigns"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {token}",
};

let body = {
    "workspace_id": 1
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get(
    'https://api.retargetkit.com/v1/campaigns',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'Authorization' => 'Bearer {token}',
        ],
        'json' => [
            'workspace_id' => 1,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://api.retargetkit.com/v1/campaigns'
payload = {
    "workspace_id": 1
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers, json=payload)
response.json()

Example response (200):

{
    "data": [
        {
            "id": 1,
            "name": "Campaign One"
        },
        {
            "id": 2,
            "name": "Campaign Two"
        }
    ]
}

Example response (404):

{
    "data": []
}

HTTP Request

GET v1/campaigns

Body Parameters

Parameter Type Status Description
workspace_id integer required The id of the workspace.

Retargeted Short Links

Create a retargeted short link


Requires authentication

Example request:

curl -X POST \
    "https://api.retargetkit.com/v1/retargeted-short-links" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer {token}" \
    -d '{"campaign_id":1,"destination_url":"https:\/\/example.com"}'
const url = new URL(
    "https://api.retargetkit.com/v1/retargeted-short-links"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {token}",
};

let body = {
    "campaign_id": 1,
    "destination_url": "https:\/\/example.com"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://api.retargetkit.com/v1/retargeted-short-links',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'Authorization' => 'Bearer {token}',
        ],
        'json' => [
            'campaign_id' => 1,
            'destination_url' => 'https://example.com',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://api.retargetkit.com/v1/retargeted-short-links'
payload = {
    "campaign_id": 1,
    "destination_url": "https:\/\/example.com"
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {token}'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (201):

{
    "message": "Retargeted short link created",
    "short_url": "https:\/\/rgkit.co\/my-short-url"
}

Example response (403):

{
    "error": "You cannot create more then 100 retargeted short links. Please upgrade your workspace subscription plan."
}

Example response (422):

{
    "destination_url": "You cannot use this destination URL for your CTA campaign. RetargetKit uses iframe technology to load web pages and we only support sites that allow their pages to be iframed."
}

Example response (422):

{
    "short_url": "The short url has already been taken."
}

HTTP Request

POST v1/retargeted-short-links

Body Parameters

Parameter Type Status Description
campaign_id integer required The id of the campaign.
destination_url string required The destination url you want to short.

Workspaces

List all workspaces


Requires authentication

Example request:

curl -X GET \
    -G "https://api.retargetkit.com/v1/workspaces" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer {token}"
const url = new URL(
    "https://api.retargetkit.com/v1/workspaces"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {token}",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

$client = new \GuzzleHttp\Client();
$response = $client->get(
    'https://api.retargetkit.com/v1/workspaces',
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'Authorization' => 'Bearer {token}',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://api.retargetkit.com/v1/workspaces'
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {token}'
}
response = requests.request('GET', url, headers=headers)
response.json()

Example response (200):

{
    "data": [
        {
            "id": 1,
            "name": "Workspace One",
            "avatar": "https:\/\/www.gravatar.com\/avatar\/110?s=400&d=identicon&r=PG"
        },
        {
            "id": 2,
            "name": "Workspace Two",
            "avatar": "https:\/\/www.gravatar.com\/avatar\/978?s=400&d=identicon&r=PG"
        }
    ]
}

HTTP Request

GET v1/workspaces