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

# Styling QR codes

> Colours, patterns, logos and frames -- and how far you can push them before scanners stop reading.

## Find out what is accepted

Rather than guessing at values, ask:

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

```javascript Node.js theme={null}
const response = await fetch("https://api.dashlink.ai/api/v1/qrcode/get_qrcode_options", {
  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_qrcode_options',
    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_qrcode_options"
	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_qrcode_options")
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_qrcode_options');
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);
```

This returns the valid patterns, corner styles, shapes and frames. An invalid value returns `400` with `INVALID_PARAMETER`.

## The fields

> [accordion] Pattern and shape
>
> ```bash theme={null}
> -F "code_pattern=rounded" \
> -F "code_corner_style=circle" \
> -F "code_shape=square"
> ```

> [accordion] Colours
>
> ```bash theme={null}
> -F "pattern_color=#1A1A1A" \
> -F "corner_color=#565ADD" \
> -F "background_color=#FFFFFF"
> ```
>
> For a gradient background, set `background_style` and `background_color_secondary`. For no background at all, `is_transparent_background=true` — useful over a printed design, risky over a busy one.

> [accordion] Centre logo
>
> ```bash theme={null}
> -F "center_logo_image=@logo.png" \
> -F "center_logo_size_rem=3.0"
> ```
>
> Or text instead of an image with `center_logo_text`.

> [accordion] Frame and caption
>
> ```bash theme={null}
> -F "frame=rounded" \
> -F "frame_text=Scan to order" \
> -F "frame_color=#565ADD"
> ```
>
> A frame with a short instruction measurably improves scan rates in print — people need to be told the code is for them.

## Staying scannable

QR codes tolerate damage, which is what lets you put a logo in the middle. That tolerance is finite, and three things spend it:

> [accordion] Contrast is not optional
>
> The pattern must be substantially darker than the background. Light grey on white looks refined and fails in poor lighting, which is most of the places a QR code gets scanned.
>
> Dark pattern on light background. Inverting — light pattern on dark — is rejected outright by some scanners.

> [accordion] Keep the logo small
>
> Around 3rem is a reasonable ceiling. A logo past that eats the error correction budget, and the first thing to fail is a code that is slightly dirty, slightly creased, or scanned at an angle — in other words, a real one.

> [accordion] Longer URLs make denser codes
>
> The destination is encoded in the pattern, so a long URL means finer detail, which means a larger print size to stay readable. A short back half is not just tidier, it is a smaller printable code.

> [!WARNING]
>
> Test the actual exported file, at the actual size, on a phone that is not yours. A code that scans from your screen at 400px may not scan from a poster at arm's length.

## Consistent styling across a set

Keep the style in one place and spread it across every call:

```python theme={null}
BRAND_QR = {
    "code_pattern": "rounded",
    "code_corner_style": "circle",
    "pattern_color": "#1A1A1A",
    "corner_color": "#565ADD",
    "background_color": "#FFFFFF",
    "frame": "rounded",
}

def create_branded_qr(destination_url, title, **overrides):
    return requests.post(
        f"{BASE}/qrcode/create_qr_code",
        headers=HEADERS,
        data={"destination_url": destination_url, "title": title, **BRAND_QR, **overrides},
    ).json()["data"]
```

Restyling later is safe — printed codes keep working, because the encoded URL does not change.


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