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

# Creating QR codes

> Generate a QR code backed by a trackable Shortlink.

Every Dashlink QR code is backed by a Shortlink, so scans are recorded exactly like clicks and appear in the same analytics. That also means you can change where a printed QR code points without reprinting it.

```bash cURL theme={null}
curl -X POST "https://api.dashlink.ai/api/v1/qrcode/create_qr_code" \
  -H "X-API-Key: $DASHLINK_API_KEY" \
  -F "destination_url=https://example.com/menu" \
  -F 'title=Table menu'
```

```javascript Node.js theme={null}
const body = new FormData();
body.append("destination_url", "https://example.com/menu");
body.append("title", "Table menu");

const response = await fetch("https://api.dashlink.ai/api/v1/qrcode/create_qr_code", {
  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/qrcode/create_qr_code',
    headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
    data={
        'destination_url': 'https://example.com/menu',
        'title': 'Table menu',
    },
)
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/qrcode/create_qr_code"
	form0 := url.Values{
		"destination_url": {"https://example.com/menu"},
		"title": {"Table menu"},
	}
	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/qrcode/create_qr_code")
request0 = Net::HTTP::Post.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
request0.set_form_data("destination_url" => "https://example.com/menu", "title" => "Table menu")
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/qrcode/create_qr_code');
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(['destination_url' => 'https://example.com/menu', 'title' => 'Table menu']));
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
```

> [!NOTE]
>
> This endpoint takes `multipart/form-data`, because it can carry a centre logo image.

## From an existing link

Pass `shortlink` instead of `destination_url` to attach a QR code to a link you already have:

```bash theme={null}
-F "shortlink=SHORT-0001"
```

Scans and clicks then accumulate against the same link, which is what you want when the same campaign runs online and in print.

## Alongside a new link

`create_shortlink` can generate one in the same call:

```bash cURL theme={null}
curl -X POST "https://api.dashlink.ai/api/v1/shortlinks/create_shortlink" \
  -H "X-API-Key: $DASHLINK_API_KEY" \
  -F "destination_url=https://example.com/menu" \
  -F "qr_code_enabled=true"
```

```javascript Node.js theme={null}
const body = new FormData();
body.append("destination_url", "https://example.com/menu");
body.append("qr_code_enabled", "true");

const response = await fetch("https://api.dashlink.ai/api/v1/shortlinks/create_shortlink", {
  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/create_shortlink',
    headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
    data={
        'destination_url': 'https://example.com/menu',
        'qr_code_enabled': 'true',
    },
)
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/create_shortlink"
	form0 := url.Values{
		"destination_url": {"https://example.com/menu"},
		"qr_code_enabled": {"true"},
	}
	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/create_shortlink")
request0 = Net::HTTP::Post.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
request0.set_form_data("destination_url" => "https://example.com/menu", "qr_code_enabled" => "true")
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/create_shortlink');
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(['destination_url' => 'https://example.com/menu', 'qr_code_enabled' => 'true']));
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
```

## Getting the image

The create response includes image URLs. To fetch a specific format later:

```bash cURL theme={null}
curl -X GET "https://api.dashlink.ai/api/v1/qrcode/download_qr_code_image?name=QR-0001&format=svg" \
  -H "X-API-Key: $DASHLINK_API_KEY"
```

```javascript Node.js theme={null}
const response = await fetch("https://api.dashlink.ai/api/v1/qrcode/download_qr_code_image?name=QR-0001&format=svg", {
  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/qrcode/download_qr_code_image?name=QR-0001&format=svg',
    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/qrcode/download_qr_code_image?name=QR-0001&format=svg"
	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/qrcode/download_qr_code_image?name=QR-0001&format=svg")
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/qrcode/download_qr_code_image?name=QR-0001&format=svg');
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);
```

`format` is `png`, `jpeg` or `svg`. See [Downloading](https://docs.dashlink.ai/guides/qr-codes/downloading.md).

## Updating

```bash cURL theme={null}
curl -X POST "https://api.dashlink.ai/api/v1/qrcode/edit_qr_code" \
  -H "X-API-Key: $DASHLINK_API_KEY" \
  -F "name=QR-0001" \
  -F "pattern_color=#1A1A1A"
```

```javascript Node.js theme={null}
const body = new FormData();
body.append("name", "QR-0001");
body.append("pattern_color", "#1A1A1A");

const response = await fetch("https://api.dashlink.ai/api/v1/qrcode/edit_qr_code", {
  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/qrcode/edit_qr_code',
    headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
    data={
        'name': 'QR-0001',
        'pattern_color': '#1A1A1A',
    },
)
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/qrcode/edit_qr_code"
	form0 := url.Values{
		"name": {"QR-0001"},
		"pattern_color": {"#1A1A1A"},
	}
	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/qrcode/edit_qr_code")
request0 = Net::HTTP::Post.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
request0.set_form_data("name" => "QR-0001", "pattern_color" => "#1A1A1A")
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/qrcode/edit_qr_code');
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(['name' => 'QR-0001', 'pattern_color' => '#1A1A1A']));
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
```

Changing styling regenerates the image. The encoded URL does not change, so **codes already printed keep working** — restyling is safe after distribution.

To change where it points, update the Shortlink behind it, not the QR code.

## Listing

```bash cURL theme={null}
curl -X GET "https://api.dashlink.ai/api/v1/qrcode/get_qrcodes?per_page=50&sort_by=most_recent&order=desc" \
  -H "X-API-Key: $DASHLINK_API_KEY"
```

```javascript Node.js theme={null}
const response = await fetch("https://api.dashlink.ai/api/v1/qrcode/get_qrcodes?per_page=50&sort_by=most_recent&order=desc", {
  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/qrcode/get_qrcodes?per_page=50&sort_by=most_recent&order=desc',
    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/qrcode/get_qrcodes?per_page=50&sort_by=most_recent&order=desc"
	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/qrcode/get_qrcodes?per_page=50&sort_by=most_recent&order=desc")
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/qrcode/get_qrcodes?per_page=50&sort_by=most_recent&order=desc');
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);
```

Filters match the link list: `tags`, `enabled`, `date_from`, `date_to`.

## Deleting

Bulk-only:

```bash cURL theme={null}
curl -X POST "https://api.dashlink.ai/api/v1/qrcode/bulk_edit" \
  -H "X-API-Key: $DASHLINK_API_KEY" \
  -d "action=delete" \
  -d 'docnames=["QR-0001"]'
```

```javascript Node.js theme={null}
const body = new URLSearchParams();
body.append("action", "delete");
body.append("docnames", "[\"QR-0001\"]");

const response = await fetch("https://api.dashlink.ai/api/v1/qrcode/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/qrcode/bulk_edit',
    headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
    data={
        'action': 'delete',
        'docnames': '["QR-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/qrcode/bulk_edit"
	form0 := url.Values{
		"action": {"delete"},
		"docnames": {"[\"QR-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/qrcode/bulk_edit")
request0 = Net::HTTP::Post.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
request0.set_form_data("action" => "delete", "docnames" => "[\"QR-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/qrcode/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' => 'delete', 'docnames' => '["QR-0001"]']));
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
```

> [!WARNING]
>
> Deleting a QR code also deletes the Shortlink behind it. Every printed copy stops working, permanently. Use `action=disable` if you might want it back.


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