# QR Decoder API

> Read the contents of a QR code from an image URL or base64 data.

Downloads or decodes the image you point it at, finds the QR code in it and returns the encoded text. Remote images are capped at 8 MB, and URLs that resolve to private or loopback addresses are refused.

- **Endpoint:** `GET https://api.zactonz.com/qr/dec/`
- **Category:** Media
- **Version:** 1
- **Status:** stable
- **Authentication:** `Authorization: Bearer YOUR_API_KEY`
- **Reference page:** https://developers.zactonz.com/apis/qr-decoder/

## Parameters

Send parameters in the query string.

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `image` | string | yes |  | An `http` or `https` URL of the image, or the base64-encoded image bytes when `format=base64`. A `data:image/...;base64,` prefix is accepted and stripped. |
| `format` | enum | no | `url` | How `image` should be read. `link` is an alias of `url`. Allowed values: `url`, `base64`. |

## Example request

```bash
curl "https://api.zactonz.com/qr/dec/?image=https%3A%2F%2Fapi.zactonz.com%2Fqr%2Fenc%2Fi%2FqDB76_184XsQzKpYx4e.png&format=url" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Response

On success `data` is the decoded text.

| Field | Type | Description |
|---|---|---|
| `status` | integer | `200` on success. See status codes below. |
| `data` | string | The text encoded in the QR code, or an error message for non-200 statuses. |

```json
{
    "status": 200,
    "data": "https://zactonz.com"
}
```

## Status codes

The outcome is reported in the JSON `status` field. General rules: https://developers.zactonz.com/apis/errors.md

| status | Meaning | Description |
|---|---|---|
| `200` | OK | A code was found and decoded. |
| `400` | Missing image | `image` was empty or absent. |
| `401` | Image not usable | The URL was invalid, not `http(s)`, pointed at a private host, exceeded 8 MB, or the base64 payload could not be decoded. `data` says which. |
| `422` | No QR code found | The image loaded but no QR code could be read from it. |

## Notes

GET is fine for image URLs. When sending base64 data, use POST with the same field names so the payload is not limited by URL length.
