Create a link
curl --request POST \
--url https://trimyourl.com/api/v1/links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"destination": "https://northwind.com/spring",
"slug": "spring-launch",
"title": "Spring launch",
"tags": [
"launch",
"instagram"
]
}
'import requests
url = "https://trimyourl.com/api/v1/links"
payload = {
"destination": "https://northwind.com/spring",
"slug": "spring-launch",
"title": "Spring launch",
"tags": ["launch", "instagram"]
}
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({
destination: 'https://northwind.com/spring',
slug: 'spring-launch',
title: 'Spring launch',
tags: ['launch', 'instagram']
})
};
fetch('https://trimyourl.com/api/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://trimyourl.com/api/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([
'destination' => 'https://northwind.com/spring',
'slug' => 'spring-launch',
'title' => 'Spring launch',
'tags' => [
'launch',
'instagram'
]
]),
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://trimyourl.com/api/v1/links"
payload := strings.NewReader("{\n \"destination\": \"https://northwind.com/spring\",\n \"slug\": \"spring-launch\",\n \"title\": \"Spring launch\",\n \"tags\": [\n \"launch\",\n \"instagram\"\n ]\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://trimyourl.com/api/v1/links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"destination\": \"https://northwind.com/spring\",\n \"slug\": \"spring-launch\",\n \"title\": \"Spring launch\",\n \"tags\": [\n \"launch\",\n \"instagram\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://trimyourl.com/api/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 \"destination\": \"https://northwind.com/spring\",\n \"slug\": \"spring-launch\",\n \"title\": \"Spring launch\",\n \"tags\": [\n \"launch\",\n \"instagram\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "8f3c1a2b-4d5e-6789-abcd-ef0123456789",
"title": "Spring launch",
"slug": "spring-launch",
"shortUrl": "https://go.northwind.com/spring-launch",
"destination": "https://northwind.com/spring",
"domain": "go.northwind.com",
"folderId": null,
"campaignId": null,
"tags": [
"launch",
"instagram"
],
"note": null,
"humanClicks": 42,
"clicks": 50,
"health": "ok",
"expiresAt": null,
"passwordProtected": false,
"iosUrl": null,
"androidUrl": null,
"fallbackUrl": null,
"redirectCode": 302,
"utm": {
"source": "instagram",
"medium": "social",
"campaign": "spring",
"term": null,
"content": null,
"append": true
}
}{
"error": "<string>"
}{
"error": "<string>"
}Links
Create a link
Creates a short link. If slug is omitted, TrimYourl suggests one from the destination page. If domainId is omitted, the workspace default domain is used. UTM append defaults to on.
POST
/
api
/
v1
/
links
Create a link
curl --request POST \
--url https://trimyourl.com/api/v1/links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"destination": "https://northwind.com/spring",
"slug": "spring-launch",
"title": "Spring launch",
"tags": [
"launch",
"instagram"
]
}
'import requests
url = "https://trimyourl.com/api/v1/links"
payload = {
"destination": "https://northwind.com/spring",
"slug": "spring-launch",
"title": "Spring launch",
"tags": ["launch", "instagram"]
}
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({
destination: 'https://northwind.com/spring',
slug: 'spring-launch',
title: 'Spring launch',
tags: ['launch', 'instagram']
})
};
fetch('https://trimyourl.com/api/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://trimyourl.com/api/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([
'destination' => 'https://northwind.com/spring',
'slug' => 'spring-launch',
'title' => 'Spring launch',
'tags' => [
'launch',
'instagram'
]
]),
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://trimyourl.com/api/v1/links"
payload := strings.NewReader("{\n \"destination\": \"https://northwind.com/spring\",\n \"slug\": \"spring-launch\",\n \"title\": \"Spring launch\",\n \"tags\": [\n \"launch\",\n \"instagram\"\n ]\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://trimyourl.com/api/v1/links")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"destination\": \"https://northwind.com/spring\",\n \"slug\": \"spring-launch\",\n \"title\": \"Spring launch\",\n \"tags\": [\n \"launch\",\n \"instagram\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://trimyourl.com/api/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 \"destination\": \"https://northwind.com/spring\",\n \"slug\": \"spring-launch\",\n \"title\": \"Spring launch\",\n \"tags\": [\n \"launch\",\n \"instagram\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "8f3c1a2b-4d5e-6789-abcd-ef0123456789",
"title": "Spring launch",
"slug": "spring-launch",
"shortUrl": "https://go.northwind.com/spring-launch",
"destination": "https://northwind.com/spring",
"domain": "go.northwind.com",
"folderId": null,
"campaignId": null,
"tags": [
"launch",
"instagram"
],
"note": null,
"humanClicks": 42,
"clicks": 50,
"health": "ok",
"expiresAt": null,
"passwordProtected": false,
"iosUrl": null,
"androidUrl": null,
"fallbackUrl": null,
"redirectCode": 302,
"utm": {
"source": "instagram",
"medium": "social",
"campaign": "spring",
"term": null,
"content": null,
"append": true
}
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Body
application/json
Response
The new link.