> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dashlink.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Bulk operations

> Create, update and delete many links in one request, and read the result properly.

Bulk endpoints exist for volume, and because deletion is bulk-only they are also how you delete a single link.

| 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

```bash cURL theme={null}
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"}
  ]'
```

```javascript Node.js theme={null}
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();
```

```python Python theme={null}
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()
```

```go Go theme={null}
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))
}

```

```ruby Ruby theme={null}
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 PHP theme={null}
<?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);
```

Each object takes the same fields as `create_shortlink`, except the image upload.

## Deleting

Including a single link — there is no other way to delete one:

```bash cURL theme={null}
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"]'
```

```javascript Node.js theme={null}
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();
```

```python Python theme={null}
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()
```

```go Go theme={null}
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))
}

```

```ruby Ruby theme={null}
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 PHP theme={null}
<?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:

```bash cURL theme={null}
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"]'
```

```javascript Node.js theme={null}
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();
```

```python Python theme={null}
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()
```

```go Go theme={null}
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))
}

```

```ruby Ruby theme={null}
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 PHP theme={null}
<?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 returns `200` even when individual items failed. The request succeeded; some items did not.

```json theme={null}
{
  "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`.

> [!WARNING]
>
> `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.

```python theme={null}
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. Pass `stop_on_error=true` to abort and roll back at the first failure instead:

```bash theme={null}
-d "stop_on_error=true"
```

Use it when a partially-applied batch would be worse than none of it — for example when links are being created in a fixed set that has to be complete.

## Processing more than 100

Chunk, and pace yourself against the rate limit:

```python theme={null}
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
```

> [!WARNING]
>
> `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:

```bash cURL theme={null}
curl -X GET "https://api.dashlink.ai/api/v1/plans/get_feature_limits" \
  -H "X-API-Key: $DASHLINK_API_KEY"
```

```javascript Node.js theme={null}
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();
```

```python Python theme={null}
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()
```

```go Go theme={null}
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))
}

```

```ruby Ruby theme={null}
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 PHP theme={null}
<?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);
```

Running out mid-batch surfaces as `FEATURE_LIMIT_EXCEEDED` on the remaining items.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.