| Operation | Endpoint | Max per call |
|---|---|---|
| Create | bulk_create_shortlinks | 100 |
| Update | bulk_update_shortlinks | 100 |
| Delete | bulk_delete_shortlinks | 100 |
| Delete / enable / disable | bulk_edit | 100 |
Creating
curl -X POST "https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks" \
-H "X-API-Key: $DASHLINK_API_KEY" \
-d 'shortlinks=[
{"destination_url":"https://example.com/a","title":"Page A"},
{"destination_url":"https://example.com/b","title":"Page B"}
]'
const body = new URLSearchParams();
body.append("shortlinks", "[\n {\"destination_url\":\"https://example.com/a\",\"title\":\"Page A\"},\n {\"destination_url\":\"https://example.com/b\",\"title\":\"Page B\"}\n ]");
const response = await fetch("https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks", {
method: "POST",
headers: { "X-API-Key": process.env.DASHLINK_API_KEY },
body,
});
const payload = await response.json();
import os
import requests
response = requests.post(
'https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks',
headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
data={
'shortlinks': '[\n {"destination_url":"https://example.com/a","title":"Page A"},\n {"destination_url":"https://example.com/b","title":"Page B"}\n ]',
},
)
payload = response.json()
package main
import (
"fmt"
"io"
"net/http"
"os"
"net/url"
"strings"
)
func main() {
endpoint0 := "https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks"
form0 := url.Values{
"shortlinks": {"[\n {\"destination_url\":\"https://example.com/a\",\"title\":\"Page A\"},\n {\"destination_url\":\"https://example.com/b\",\"title\":\"Page B\"}\n ]"},
}
req0, err0 := http.NewRequest("POST", endpoint0, strings.NewReader(form0.Encode()))
if err0 != nil {
panic(err0)
}
req0.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req0.Header.Set("X-API-Key", os.Getenv("DASHLINK_API_KEY"))
resp0, err0b := http.DefaultClient.Do(req0)
if err0b != nil {
panic(err0b)
}
defer resp0.Body.Close()
body0, _ := io.ReadAll(resp0.Body)
fmt.Println(string(body0))
}
require "net/http"
require "json"
require "uri"
uri0 = URI("https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks")
request0 = Net::HTTP::Post.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
request0.set_form_data("shortlinks" => "[\n {\"destination_url\":\"https://example.com/a\",\"title\":\"Page A\"},\n {\"destination_url\":\"https://example.com/b\",\"title\":\"Page B\"}\n ]")
response0 = Net::HTTP.start(uri0.hostname, uri0.port, use_ssl: true) do |http|
http.request(request0)
end
payload0 = JSON.parse(response0.body)
<?php
$ch0 = curl_init('https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks');
curl_setopt($ch0, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch0, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch0, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("DASHLINK_API_KEY"),
]);
curl_setopt($ch0, CURLOPT_POSTFIELDS, http_build_query(['shortlinks' => '[
{"destination_url":"https://example.com/a","title":"Page A"},
{"destination_url":"https://example.com/b","title":"Page B"}
]']));
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
create_shortlink, except the image upload.
Deleting
Including a single link — there is no other way to delete one:curl -X POST "https://api.dashlink.ai/api/v1/shortlinks/bulk_delete_shortlinks" \
-H "X-API-Key: $DASHLINK_API_KEY" \
-d 'shortlink_ids=["SHORT-0001"]'
const body = new URLSearchParams();
body.append("shortlink_ids", "[\"SHORT-0001\"]");
const response = await fetch("https://api.dashlink.ai/api/v1/shortlinks/bulk_delete_shortlinks", {
method: "POST",
headers: { "X-API-Key": process.env.DASHLINK_API_KEY },
body,
});
const payload = await response.json();
import os
import requests
response = requests.post(
'https://api.dashlink.ai/api/v1/shortlinks/bulk_delete_shortlinks',
headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
data={
'shortlink_ids': '["SHORT-0001"]',
},
)
payload = response.json()
package main
import (
"fmt"
"io"
"net/http"
"os"
"net/url"
"strings"
)
func main() {
endpoint0 := "https://api.dashlink.ai/api/v1/shortlinks/bulk_delete_shortlinks"
form0 := url.Values{
"shortlink_ids": {"[\"SHORT-0001\"]"},
}
req0, err0 := http.NewRequest("POST", endpoint0, strings.NewReader(form0.Encode()))
if err0 != nil {
panic(err0)
}
req0.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req0.Header.Set("X-API-Key", os.Getenv("DASHLINK_API_KEY"))
resp0, err0b := http.DefaultClient.Do(req0)
if err0b != nil {
panic(err0b)
}
defer resp0.Body.Close()
body0, _ := io.ReadAll(resp0.Body)
fmt.Println(string(body0))
}
require "net/http"
require "json"
require "uri"
uri0 = URI("https://api.dashlink.ai/api/v1/shortlinks/bulk_delete_shortlinks")
request0 = Net::HTTP::Post.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
request0.set_form_data("shortlink_ids" => "[\"SHORT-0001\"]")
response0 = Net::HTTP.start(uri0.hostname, uri0.port, use_ssl: true) do |http|
http.request(request0)
end
payload0 = JSON.parse(response0.body)
<?php
$ch0 = curl_init('https://api.dashlink.ai/api/v1/shortlinks/bulk_delete_shortlinks');
curl_setopt($ch0, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch0, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch0, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("DASHLINK_API_KEY"),
]);
curl_setopt($ch0, CURLOPT_POSTFIELDS, http_build_query(['shortlink_ids' => '["SHORT-0001"]']));
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
bulk_edit covers disable and enable as well:
curl -X POST "https://api.dashlink.ai/api/v1/shortlinks/bulk_edit" \
-H "X-API-Key: $DASHLINK_API_KEY" \
-d "action=disable" \
-d 'docnames=["SHORT-0001","SHORT-0002"]'
const body = new URLSearchParams();
body.append("action", "disable");
body.append("docnames", "[\"SHORT-0001\",\"SHORT-0002\"]");
const response = await fetch("https://api.dashlink.ai/api/v1/shortlinks/bulk_edit", {
method: "POST",
headers: { "X-API-Key": process.env.DASHLINK_API_KEY },
body,
});
const payload = await response.json();
import os
import requests
response = requests.post(
'https://api.dashlink.ai/api/v1/shortlinks/bulk_edit',
headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
data={
'action': 'disable',
'docnames': '["SHORT-0001","SHORT-0002"]',
},
)
payload = response.json()
package main
import (
"fmt"
"io"
"net/http"
"os"
"net/url"
"strings"
)
func main() {
endpoint0 := "https://api.dashlink.ai/api/v1/shortlinks/bulk_edit"
form0 := url.Values{
"action": {"disable"},
"docnames": {"[\"SHORT-0001\",\"SHORT-0002\"]"},
}
req0, err0 := http.NewRequest("POST", endpoint0, strings.NewReader(form0.Encode()))
if err0 != nil {
panic(err0)
}
req0.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req0.Header.Set("X-API-Key", os.Getenv("DASHLINK_API_KEY"))
resp0, err0b := http.DefaultClient.Do(req0)
if err0b != nil {
panic(err0b)
}
defer resp0.Body.Close()
body0, _ := io.ReadAll(resp0.Body)
fmt.Println(string(body0))
}
require "net/http"
require "json"
require "uri"
uri0 = URI("https://api.dashlink.ai/api/v1/shortlinks/bulk_edit")
request0 = Net::HTTP::Post.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
request0.set_form_data("action" => "disable", "docnames" => "[\"SHORT-0001\",\"SHORT-0002\"]")
response0 = Net::HTTP.start(uri0.hostname, uri0.port, use_ssl: true) do |http|
http.request(request0)
end
payload0 = JSON.parse(response0.body)
<?php
$ch0 = curl_init('https://api.dashlink.ai/api/v1/shortlinks/bulk_edit');
curl_setopt($ch0, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch0, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch0, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("DASHLINK_API_KEY"),
]);
curl_setopt($ch0, CURLOPT_POSTFIELDS, http_build_query(['action' => 'disable', 'docnames' => '["SHORT-0001","SHORT-0002"]']));
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
action is delete, disable or enable. Disabling is reversible and keeps analytics; deleting is neither.
Reading the result
A bulk call returns200 even when individual items failed. The request succeeded; some items did not.
{
"data": {
"status": "partial_success",
"summary": { "total": 3, "succeeded": 1, "failed": 1, "skipped": 1 },
"results": [
{ "index": 0, "outcome": "success", "name": "SHORT-0001", "error": null },
{ "index": 1, "outcome": "skipped", "name": "SHORT-0002",
"error": { "message": "Not found.", "code": "NOT_FOUND" } },
{ "index": 2, "outcome": "error", "name": "SHORT-0003",
"error": { "message": "Permission denied.", "code": "PERMISSION_DENIED" } }
]
}
}
status grades the whole call: success, partial_success, or error. Each item carries outcome, which is success, error or skipped.
summary.succeeded + summary.failed + summary.skipped always equals the length of results. If you only check the HTTP status, a batch where every item failed looks identical to one where every item worked.result = response.json()["data"]
if result["status"] != "success":
for item in result["results"]:
if item["outcome"] != "success":
print(f"{item['index']}: {item['name']} -- {item['error']['message']}")
All-or-nothing
By default a batch processes every item and reports what happened. Passstop_on_error=true to abort and roll back at the first failure instead:
-d "stop_on_error=true"
Processing more than 100
Chunk, and pace yourself against the rate limit:def chunked(items, size=100):
for start in range(0, len(items), size):
yield items[start:start + size]
def bulk_create_all(links):
created, failed = [], []
for batch in chunked(links, 100):
response = requests.post(
f"{BASE}/shortlinks/bulk_create_shortlinks",
headers=HEADERS,
data={"shortlinks": json.dumps(batch)},
)
if response.status_code == 429:
time.sleep(int(response.headers.get("Retry-After", 5)))
continue # retry this batch rather than skipping it
result = response.json()["data"]
for item in result["results"]:
(created if item["outcome"] == "success" else failed).append(item)
return created, failed
continue after a 429 re-sends the same batch. Advancing past it on a rate-limit response silently drops those links, which is the kind of bug you find weeks later.Before a large create
Check your plan allowance first, so you fail before doing half the work:curl -X GET "https://api.dashlink.ai/api/v1/plans/get_feature_limits" \
-H "X-API-Key: $DASHLINK_API_KEY"
const response = await fetch("https://api.dashlink.ai/api/v1/plans/get_feature_limits", {
headers: { "X-API-Key": process.env.DASHLINK_API_KEY },
});
const payload = await response.json();
import os
import requests
response = requests.get(
'https://api.dashlink.ai/api/v1/plans/get_feature_limits',
headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
)
payload = response.json()
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
endpoint0 := "https://api.dashlink.ai/api/v1/plans/get_feature_limits"
req0, err0 := http.NewRequest("GET", endpoint0, nil)
if err0 != nil {
panic(err0)
}
req0.Header.Set("X-API-Key", os.Getenv("DASHLINK_API_KEY"))
resp0, err0b := http.DefaultClient.Do(req0)
if err0b != nil {
panic(err0b)
}
defer resp0.Body.Close()
body0, _ := io.ReadAll(resp0.Body)
fmt.Println(string(body0))
}
require "net/http"
require "json"
require "uri"
uri0 = URI("https://api.dashlink.ai/api/v1/plans/get_feature_limits")
request0 = Net::HTTP::Get.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
response0 = Net::HTTP.start(uri0.hostname, uri0.port, use_ssl: true) do |http|
http.request(request0)
end
payload0 = JSON.parse(response0.body)
<?php
$ch0 = curl_init('https://api.dashlink.ai/api/v1/plans/get_feature_limits');
curl_setopt($ch0, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch0, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch0, CURLOPT_HTTPHEADER, [
"X-API-Key: " . getenv("DASHLINK_API_KEY"),
]);
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
FEATURE_LIMIT_EXCEEDED on the remaining items.