curl --request POST \
--url https://api.datalyr.com/v1/links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"link": {
"name": "<string>",
"destination_url": "<string>",
"tracking_identifier": "<string>",
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_term": "<string>",
"utm_content": "<string>",
"domain_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"target": "web",
"ios_url": "<string>",
"android_url": "<string>"
},
"dry_run": false
}
'import requests
url = "https://api.datalyr.com/v1/links"
payload = {
"link": {
"name": "<string>",
"destination_url": "<string>",
"tracking_identifier": "<string>",
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_term": "<string>",
"utm_content": "<string>",
"domain_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"target": "web",
"ios_url": "<string>",
"android_url": "<string>"
},
"dry_run": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
link: {
name: '<string>',
destination_url: '<string>',
tracking_identifier: '<string>',
utm_source: '<string>',
utm_medium: '<string>',
utm_campaign: '<string>',
utm_term: '<string>',
utm_content: '<string>',
domain_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
slug: '<string>',
target: 'web',
ios_url: '<string>',
android_url: '<string>'
},
dry_run: false
})
};
fetch('https://api.datalyr.com/v1/links', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datalyr.com/v1/links",
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([
'link' => [
'name' => '<string>',
'destination_url' => '<string>',
'tracking_identifier' => '<string>',
'utm_source' => '<string>',
'utm_medium' => '<string>',
'utm_campaign' => '<string>',
'utm_term' => '<string>',
'utm_content' => '<string>',
'domain_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'slug' => '<string>',
'target' => 'web',
'ios_url' => '<string>',
'android_url' => '<string>'
],
'dry_run' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.datalyr.com/v1/links"
payload := strings.NewReader("{\n \"link\": {\n \"name\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_identifier\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"domain_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"slug\": \"<string>\",\n \"target\": \"web\",\n \"ios_url\": \"<string>\",\n \"android_url\": \"<string>\"\n },\n \"dry_run\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.datalyr.com/v1/links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"link\": {\n \"name\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_identifier\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"domain_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"slug\": \"<string>\",\n \"target\": \"web\",\n \"ios_url\": \"<string>\",\n \"android_url\": \"<string>\"\n },\n \"dry_run\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"link\": {\n \"name\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_identifier\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"domain_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"slug\": \"<string>\",\n \"target\": \"web\",\n \"ios_url\": \"<string>\",\n \"android_url\": \"<string>\"\n },\n \"dry_run\": false\n}"
response = http.request(request)
puts response.read_body{
"dry_run": true,
"applied": true,
"diff": {
"action": "<string>",
"resource": {
"type": "conversion_rule",
"id": "<string>",
"label": "<string>"
},
"prior_state": {},
"new_state": {},
"changes": [
{
"field": "<string>",
"from": "<unknown>",
"to": "<unknown>"
}
],
"effects": [
{
"type": "postback_target",
"summary": "<string>",
"platform": "<string>",
"ad_account_id": "<string>",
"asset_id": "<string>",
"asset_field": "<string>",
"endpoint_url_masked": "<string>",
"trigger_event": "<string>",
"trigger_event_source": "<string>",
"platform_event": "<string>",
"active": true,
"operation": "put",
"key": "<string>",
"path": "<string>",
"requires_approval": true,
"approver_roles": [
"<string>"
],
"review_surface": "<string>",
"supersedes": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
]
},
"audit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"dry_run": true,
"applied": true,
"diff": {
"action": "<string>",
"resource": {
"type": "conversion_rule",
"id": "<string>",
"label": "<string>"
},
"prior_state": {},
"new_state": {},
"changes": [
{
"field": "<string>",
"from": "<unknown>",
"to": "<unknown>"
}
],
"effects": [
{
"type": "postback_target",
"summary": "<string>",
"platform": "<string>",
"ad_account_id": "<string>",
"asset_id": "<string>",
"asset_field": "<string>",
"endpoint_url_masked": "<string>",
"trigger_event": "<string>",
"trigger_event_source": "<string>",
"platform_event": "<string>",
"active": true,
"operation": "put",
"key": "<string>",
"path": "<string>",
"requires_approval": true,
"approver_roles": [
"<string>"
],
"review_surface": "<string>",
"supersedes": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
]
},
"audit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"destination_url": "<string>",
"tracking_identifier": "<string>",
"slug": "<string>",
"domain_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"target": "<string>",
"ios_url": "<string>",
"android_url": "<string>",
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_term": "<string>",
"utm_content": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>"
}{
"error": "<string>",
"code": "insufficient_scope",
"required_scope": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Create a trackable link
Create a trackable link.
Supplying a verified domain_id makes it a redirect link served at the edge as https://<domain>/<slug>, where the click is counted exactly. Without one it is a plain link carrying UTM and lyr parameters on the destination URL.
Every new link gets an exact tracking identity. Supply tracking_identifier to set the lyr value yourself; omit it and one is generated from the name. A redirect link mirrors its slug into the identifier. A dry run reports a generated slug as (generated) — the real one is drawn at insert time so that previewing does not consume a candidate value.
curl --request POST \
--url https://api.datalyr.com/v1/links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"link": {
"name": "<string>",
"destination_url": "<string>",
"tracking_identifier": "<string>",
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_term": "<string>",
"utm_content": "<string>",
"domain_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"target": "web",
"ios_url": "<string>",
"android_url": "<string>"
},
"dry_run": false
}
'import requests
url = "https://api.datalyr.com/v1/links"
payload = {
"link": {
"name": "<string>",
"destination_url": "<string>",
"tracking_identifier": "<string>",
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_term": "<string>",
"utm_content": "<string>",
"domain_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"target": "web",
"ios_url": "<string>",
"android_url": "<string>"
},
"dry_run": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
link: {
name: '<string>',
destination_url: '<string>',
tracking_identifier: '<string>',
utm_source: '<string>',
utm_medium: '<string>',
utm_campaign: '<string>',
utm_term: '<string>',
utm_content: '<string>',
domain_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
slug: '<string>',
target: 'web',
ios_url: '<string>',
android_url: '<string>'
},
dry_run: false
})
};
fetch('https://api.datalyr.com/v1/links', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datalyr.com/v1/links",
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([
'link' => [
'name' => '<string>',
'destination_url' => '<string>',
'tracking_identifier' => '<string>',
'utm_source' => '<string>',
'utm_medium' => '<string>',
'utm_campaign' => '<string>',
'utm_term' => '<string>',
'utm_content' => '<string>',
'domain_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'slug' => '<string>',
'target' => 'web',
'ios_url' => '<string>',
'android_url' => '<string>'
],
'dry_run' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.datalyr.com/v1/links"
payload := strings.NewReader("{\n \"link\": {\n \"name\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_identifier\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"domain_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"slug\": \"<string>\",\n \"target\": \"web\",\n \"ios_url\": \"<string>\",\n \"android_url\": \"<string>\"\n },\n \"dry_run\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.datalyr.com/v1/links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"link\": {\n \"name\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_identifier\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"domain_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"slug\": \"<string>\",\n \"target\": \"web\",\n \"ios_url\": \"<string>\",\n \"android_url\": \"<string>\"\n },\n \"dry_run\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"link\": {\n \"name\": \"<string>\",\n \"destination_url\": \"<string>\",\n \"tracking_identifier\": \"<string>\",\n \"utm_source\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"domain_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"slug\": \"<string>\",\n \"target\": \"web\",\n \"ios_url\": \"<string>\",\n \"android_url\": \"<string>\"\n },\n \"dry_run\": false\n}"
response = http.request(request)
puts response.read_body{
"dry_run": true,
"applied": true,
"diff": {
"action": "<string>",
"resource": {
"type": "conversion_rule",
"id": "<string>",
"label": "<string>"
},
"prior_state": {},
"new_state": {},
"changes": [
{
"field": "<string>",
"from": "<unknown>",
"to": "<unknown>"
}
],
"effects": [
{
"type": "postback_target",
"summary": "<string>",
"platform": "<string>",
"ad_account_id": "<string>",
"asset_id": "<string>",
"asset_field": "<string>",
"endpoint_url_masked": "<string>",
"trigger_event": "<string>",
"trigger_event_source": "<string>",
"platform_event": "<string>",
"active": true,
"operation": "put",
"key": "<string>",
"path": "<string>",
"requires_approval": true,
"approver_roles": [
"<string>"
],
"review_surface": "<string>",
"supersedes": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
]
},
"audit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"dry_run": true,
"applied": true,
"diff": {
"action": "<string>",
"resource": {
"type": "conversion_rule",
"id": "<string>",
"label": "<string>"
},
"prior_state": {},
"new_state": {},
"changes": [
{
"field": "<string>",
"from": "<unknown>",
"to": "<unknown>"
}
],
"effects": [
{
"type": "postback_target",
"summary": "<string>",
"platform": "<string>",
"ad_account_id": "<string>",
"asset_id": "<string>",
"asset_field": "<string>",
"endpoint_url_masked": "<string>",
"trigger_event": "<string>",
"trigger_event_source": "<string>",
"platform_event": "<string>",
"active": true,
"operation": "put",
"key": "<string>",
"path": "<string>",
"requires_approval": true,
"approver_roles": [
"<string>"
],
"review_surface": "<string>",
"supersedes": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
]
},
"audit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"destination_url": "<string>",
"tracking_identifier": "<string>",
"slug": "<string>",
"domain_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"target": "<string>",
"ios_url": "<string>",
"android_url": "<string>",
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_term": "<string>",
"utm_content": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>"
}{
"error": "<string>",
"code": "insufficient_scope",
"required_scope": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Headers
Retry-safe token for this create. The first request performed under a given key has its response kept for 24 hours; an identical retry returns that same response with Idempotent-Replay: true instead of creating a second resource. The record covers the request body, so reusing a key with different content is a new request rather than a replay. Ignored on a dry run, which creates nothing to be idempotent about.
255Response
Nothing was written. The body describes the change that would have been made, including every effect beyond the row itself.
Was this page helpful?