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

# QR Code API

> Generate QR code images that link to arbitrary URLs, WhatsApp deep links, or pre-filled SMS — for print, in-store, or kiosk use cases.

# QR Code API

Server-rendered QR code images. Useful for print collateral, in-store posters, kiosk touchpoints, and "scan to start chatting" prompts.

**Base path:** `/api/v1/qr`

**Authentication:** API key (`X-API-Key`) or session JWT.

**Limits:** Image size (`size`) must be between 50 × 50 and 1024 × 1024 pixels. Defaults to 300 × 300 if omitted.

| Method | Path                  | Purpose                                        |
| ------ | --------------------- | ---------------------------------------------- |
| `GET`  | `/api/v1/qr/generate` | Generate a QR for arbitrary data (URL or text) |
| `GET`  | `/api/v1/qr/whatsapp` | Generate a "click to chat" WhatsApp QR         |
| `GET`  | `/api/v1/qr/sms`      | Generate a pre-filled SMS QR                   |

## Shared parameters

Every route accepts the same two rendering parameters:

| Parameter | Type              | Default | Description                                                  |
| --------- | ----------------- | ------- | ------------------------------------------------------------ |
| `size`    | integer (50–1024) | `300`   | Width and height of the QR image, in pixels.                 |
| `format`  | `png` \| `json`   | `png`   | Response format — see [Response formats](#response-formats). |

## Response formats

By default every route returns raw `image/png` bytes (`Content-Type: image/png`), ready to embed in a print template or `<img>` tag. Pass `?format=json` to receive a base64 data URL inside the standard JSON envelope instead — useful when you want to render the QR client-side or store the image alongside its source values.

```json theme={null}
{
  "data": {
    "qr_data_url": "data:image/png;base64,iVBORw0KGgoAAAANSU...",
    "data": "https://orb.li/spring-sale",
    "size": 400
  }
}
```

The `qr_data_url` field is a ready-to-use `data:` URL you can drop straight into an `<img src="...">`. The `/whatsapp` and `/sms` routes additionally return the encoded deep link (`whatsapp_link` / `sms_link`) and the normalized `phone`.

## Generate — arbitrary URL or text

`GET /api/v1/qr/generate` encodes any URL or plain-text string you provide.

| Parameter | Type                  | Default      | Description                                                                                                                           |
| --------- | --------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| `data`    | string (1–2048 chars) | — (required) | The URL or text to encode. Script-execution URL schemes (`javascript:`, `data:`, `vbscript:`, and similar) are rejected with a `400`. |

```bash theme={null}
curl "https://api.orbit.devotel.io/api/v1/qr/generate?data=https%3A%2F%2Forb.li%2Fspring-sale&size=400" \
  -H "X-API-Key: dv_live_sk_your_key_here" \
  -o generate-qr.png
```

Request the JSON envelope instead of the raw image:

```bash theme={null}
curl "https://api.orbit.devotel.io/api/v1/qr/generate?data=https%3A%2F%2Forb.li%2Fspring-sale&size=400&format=json" \
  -H "X-API-Key: dv_live_sk_your_key_here"
```

## WhatsApp click-to-chat poster

`GET /api/v1/qr/whatsapp` encodes a `https://wa.me/{phone}` deep link that opens a pre-filled WhatsApp chat.

| Parameter | Type                  | Default      | Description                                                      |
| --------- | --------------------- | ------------ | ---------------------------------------------------------------- |
| `phone`   | string                | — (required) | Destination number in international format (e.g. `14155552671`). |
| `message` | string (≤ 1024 chars) | `""`         | Pre-filled chat text.                                            |

```bash theme={null}
curl "https://api.orbit.devotel.io/api/v1/qr/whatsapp?phone=14155552671&message=Hi%20there&size=400" \
  -H "X-API-Key: dv_live_sk_your_key_here" \
  -o whatsapp-qr.png
```

Returns a PNG. Embed directly in a print template or `<img>` tag.

## SMS deep link

`GET /api/v1/qr/sms` encodes an `sms:{phone}?body={message}` URI that opens the native SMS composer.

| Parameter | Type                  | Default      | Description                                 |
| --------- | --------------------- | ------------ | ------------------------------------------- |
| `phone`   | string                | — (required) | Destination number in international format. |
| `message` | string (≤ 1024 chars) | `""`         | Pre-filled SMS body.                        |

```bash theme={null}
curl "https://api.orbit.devotel.io/api/v1/qr/sms?phone=14155552671&message=Quote%20SAVE10&size=400&format=json" \
  -H "X-API-Key: dv_live_sk_your_key_here"
```
