> ## 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.

# Introduction

> Everything the Dashlink dashboard does, available over HTTP.

The Dashlink API lets you do programmatically what your team does in the dashboard: create and manage Shortlinks, generate QR codes, organise work into campaigns, connect your own domains, and read the analytics behind all of it.

## Base URL

```
https://api.dashlink.ai
```

Every endpoint lives under `/api/v1/`, in the form `/api/v1/<resource>/<action>`.

## Your first request

Create an API key in the dashboard under **Settings → API Keys**, then:

```bash cURL theme={null}
curl https://api.dashlink.ai/api/v1/shortlinks/get_shortlinks?per_page=5 \
  -H "X-API-Key: dlk_live_..."
```

```javascript Node.js theme={null}
const response = await fetch(
  "https://api.dashlink.ai/api/v1/shortlinks/get_shortlinks?per_page=5",
  { headers: { "X-API-Key": "dlk_live_..." } }
);
const { data } = await response.json();
```

```python Python theme={null}
import requests

response = requests.get(
    "https://api.dashlink.ai/api/v1/shortlinks/get_shortlinks",
    headers={"X-API-Key": "dlk_live_..."},
    params={"per_page": 5},
)
print(response.json()["data"])
```

```go Go theme={null}
req, _ := http.NewRequest("GET",
    "https://api.dashlink.ai/api/v1/shortlinks/get_shortlinks?per_page=5", nil)
req.Header.Set("X-API-Key", "dlk_live_...")
resp, err := http.DefaultClient.Do(req)
```

```ruby Ruby theme={null}
require "net/http"
require "json"

uri = URI("https://api.dashlink.ai/api/v1/shortlinks/get_shortlinks")
uri.query = URI.encode_www_form(per_page: 5)

response = Net::HTTP.get_response(uri, "X-API-Key" => "dlk_live_...")
puts JSON.parse(response.body)["data"]
```

```php PHP theme={null}
<?php
$ch = curl_init("https://api.dashlink.ai/api/v1/shortlinks/get_shortlinks?per_page=5");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: dlk_live_..."]);

$payload = json_decode(curl_exec($ch), true);
curl_close($ch);

print_r($payload["data"]);
```

## How responses are shaped

Every response is wrapped, so one code path handles every endpoint.

A success puts the payload under `data`:

```json theme={null}
{
  "data": {
    "links": [],
    "total_count": 128,
    "total_pages": 13,
    "current_page": 1,
    "per_page": 10
  }
}
```

A failure puts the problem under `error`:

```json theme={null}
{
  "error": {
    "message": "Shortlink not found.",
    "status_code": 404,
    "code": "NOT_FOUND"
  }
}
```

The two keys are mutually exclusive: checking which one is present is enough to know whether the call worked. See [Errors](https://docs.dashlink.ai/api-reference/concepts/errors.md) for the full list of codes.

## What you can do

> [card] [Links](https://docs.dashlink.ai/api-reference/links/overview.md)
>
> Create, update, search and bulk-manage Shortlinks.

> [card] [QR Codes](https://docs.dashlink.ai/api-reference/qr-codes/overview.md)
>
> Generate styled QR codes backed by trackable Shortlinks.

> [card] [App Dynamic Links](https://docs.dashlink.ai/api-reference/app-dynamic-links/overview.md)
>
> Route to a native app when installed, the web when not.

> [card] [Campaigns](https://docs.dashlink.ai/api-reference/campaigns/overview.md)
>
> Group links into campaigns and channels.

> [card] [Analytics](https://docs.dashlink.ai/api-reference/analytics/overview.md)
>
> Clicks, scans and visitors, by organization, link or campaign.

> [card] [Branded Links](https://docs.dashlink.ai/api-reference/branded-links/overview.md)
>
> Serve links from a domain you own.

> [card] [Tags](https://docs.dashlink.ai/api-reference/tags/overview.md)
>
> Organise and filter links and QR codes.

> [card] [UTM Templates](https://docs.dashlink.ai/api-reference/utm-templates/overview.md)
>
> Keep campaign tagging consistent across your team.

## Conventions worth knowing up front

> [accordion] Deletion is bulk-only
>
> There are no single-resource delete endpoints for links, QR codes or UTM templates. To delete one, pass a one-element array to the bulk endpoint. This keeps one code path for deleting one thing and deleting a thousand, and one result shape to interpret. See [Bulk operations](https://docs.dashlink.ai/guides/links/bulk-operations.md).

> [accordion] Writes are form-encoded, not JSON
>
> `POST` bodies use `application/x-www-form-urlencoded`, or `multipart/form-data` when a file is involved. Array parameters such as `tags` or `shortlink_ids` are sent as JSON-encoded strings within the form body.

> [accordion] Another organization's resource returns 404
>
> Asking for a resource that exists but belongs to someone else returns `404`, not `403`. A `403` would confirm the id is real, which would let anyone map out other customers' ids by trying them.

> [accordion] List sizes are clamped, not rejected
>
> `per_page` above the maximum of 100 returns 100 rather than an error. The response echoes the `per_page` actually applied. See [Pagination](https://docs.dashlink.ai/api-reference/concepts/pagination.md).

## Next

> [card] [Authentication](https://docs.dashlink.ai/api-reference/concepts/authentication.md)
>
> Create a key and scope it.

> [card] [Rate limits](https://docs.dashlink.ai/api-reference/concepts/rate-limits.md)
>
> What your plan allows.

> [card] [Errors](https://docs.dashlink.ai/api-reference/concepts/errors.md)
>
> Every code and what to do about it.


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