Blog: Retarget your visitors who click on your shared links that you don’t own

API Documentation

9 / 100

Creating Links via API

If users have api.access permission, they will be able to create links via dgLnk API.

API Endpoint

Requests should be sent to /api/links/create endpoint via POST request and include user api_token. For example: API token will be automatically generated for each user and it can be found in user account settings page, under password panel.

Request Parameters

A number of parameters can be used when creating links. All parameters except long_url or multiple_urls are optional. Parameters should be sent as POST request body in JSON format.

aliasstringCustom ID for link, if empty, random string will be generated.
long_urlstringDestination url.
multiple_urlsarrayArray of multiple urls. Separate link will be created for each one. Can’t be used together with long_url parameter.
domain_idnumberID of custom domain that should be attached to this link.
passwordstringPassword for the link.
disabledbooleanWhether link should be active or not.
titlestringShort title for link. If empty, title of destination url will be used.
descriptionstringShort description for link. If empty, meta description of destination url will be used.
tagsarrayArray of tags that should be attached to this link.
expires_atstringUntil when link should be active. Format example: 2019-08-23 13:24:00
pixelsarrayArray of tracking pixel IDs that should be attached to this link.
rulesarrayArray of country and device rules. Format example:
{key: “ru”, value: “”, type: “geo”},
{key: “phone”, value: “”, type: “device”}


Successful response structure will look like this. If multiple_urls parameter is used, response will contain links property instead, with array of all created links in the same format as single link.

  "status": "success",
  "link": {
    "type": "direct",
    "title": "Google",
    "description": "Description",
    "hash": "oV5Ox",
    "long_url": "",
    "expires_at": null,
    "disabled": false,
    "user_id": 1,
    "domain_id": null,
    "alias": null,
    "has_password": false,
    "updated_at": "2019-08-21 13:33:17",
    "created_at": "2019-08-21 13:33:17",
    "id": 80,
    "short_url": ""

 If there were any errors when creating a link, Error response with below format will be returned instead:

  "status": "error",
  "messages": {
    "long_url": [
      "This url is not valid."

Example with PHP and CURL


$url = "";

$curl = curl_init();

$params = json_encode([
    'long_url' => '',

curl_setopt_array($curl, [
    CURLOPT_URL => $url,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $params,
        'Content-Type: application/json',
        'Content-Length: ' . strlen($params)
$response = json_decode(curl_exec($curl));

// $response can now be used, see above for how it's formated

For any support, please reach out to [email protected]