# DynamicQR: Complete Reference for AI Agents & Developers

Base URL: https://dynamicqr.io
Human Documentation: https://dynamicqr.io/docs
OpenAPI 3.1 Schema: https://dynamicqr.io/openapi.json
MCP Discovery: https://dynamicqr.io/.well-known/mcp.json

## 1. Authentication
Both the public REST API (https://dynamicqr.io/api/v1) and the remote MCP server (https://dynamicqr.io/mcp) authenticate with a personal API key:

```http
Authorization: Bearer dqr_live_<token>
```

Create API keys in the dashboard at https://dynamicqr.io/api-keys (requires an active Pro or Business subscription).
Rate limits: Pro = 60 requests/minute per key; Business = 300 requests/minute per key.

## 2. REST API (/api/v1)

### GET /api/v1/usage
Returns current plan tier, QR code count, active limit, extra packs, paused count and grace status.

### GET /api/v1/qr-codes
Query params: search, type (link|vcard|email|phone|sms|bitcoin|geo|wifi), tag (exact tag/folder label), sort (name|type|slug|created_at), direction (asc|desc), page. Also returns available_tags with counts.

### POST /api/v1/qr-codes
Create any of the 8 QR code types (including vCard 3.0 business cards) with optional styling, CTA frames, custom domain, and smart redirect rules:
```json
{
  "type": "link",
  "name": "Autumn Menu",
  "link": "https://example.com/autumn-menu",
  "slug": "autumn-menu",
  "fg_color": "#465fff",
  "bg_color": "#ffffff",
  "dot_style": "rounded",
  "frame_style": "bottom",
  "frame_label": "SCAN ME",
  "logo_data": "data:image/png;base64,...",
  "routing_rules": [
    {"type": "os", "match": "ios", "url": "https://apps.apple.com/app/example"},
    {"type": "os", "match": "android", "url": "https://play.google.com/store/apps/details?id=com.example"}
  ]
}
```
Supported dot_style values: square, rounded, dots. Supported frame_style values: none, bottom, top, badge with optional frame_label (up to 24 chars, default SCAN ME). Foreground/background colors must be 6-digit hex codes with WCAG contrast >= 2.5. Optional custom slug (3-48 lowercase chars/digits/hyphens), center logo_data (PNG/JPEG/GIF data URI; automatically uses High error correction), CTA frames, expires_at (ISO-8601), max_scans (1..10,000,000), fallback_url, access_password (4-128 chars), custom_domain_id, and routing_rules require Pro or Business.

### GET /api/v1/qr-codes/{id}
Returns full details including link_url (https://dynamicqr.io/qr/{slug} or custom domain), payload, style fields, routing_rules, share_url, paused/expired/limit status, scans_total and inline SVG.

### PATCH /api/v1/qr-codes/{id}
Updates name, target link, tags, custom_domain_id, routing_rules, and optional fg_color / bg_color / dot_style / logo_data / frame_style / frame_label / expires_at / max_scans / fallback_url / access_password of a dynamic link QR code without changing its printed slug.

### PUT /api/v1/qr-codes/{id}/tags
Replaces tags ({"tags": ["Menu", "Berlin"]}) on any QR code type, including static codes.

### DELETE /api/v1/qr-codes/{id}
Deletes the QR code and its scans, and automatically unpauses remaining codes if the account drops within its active limit.

### GET /api/v1/qr-codes/stats and GET /api/v1/qr-codes/{id}/stats
Query params: range (week|month|three_months|inception|custom), start (YYYY-MM-DD), end (YYYY-MM-DD). Returns daily scan points plus privacy-friendly breakdown by device, OS and country. Append /export to download a UTF-8 BOM CSV report.

### POST /api/v1/qr-codes/{id}/share
Enables, regenerates, or disables a public read-only client analytics link (/share/{token}) for a QR code ({"enabled": true, "regenerate": false}). Public JSON is served unauthenticated at GET /api/public/share/{token}. Requires Pro or Business.

### Smart Redirect Rules (routing_rules)
Pass up to 10 ordered routing_rules on POST or PATCH /api/v1/qr-codes (e.g. [{"type":"os","match":"ios","url":"https://apps.apple.com/..."},{"type":"country","match":"DE","url":"https://example.com/de"}]). Supported types: os (ios|android|macos|windows|linux), device (mobile|tablet|desktop), country (2-letter ISO code). Requires Pro or Business.

### GET /api/v1/qr-codes/{id}/download/{format}
format: png (?size=64..4000, default 1000) or svg.

### POST /api/v1/qr-codes/import
Bulk-creates up to 500 dynamic link QR codes atomically from a CSV string ({"csv": "name,link,slug,fg_color,dot_style\n..."}). Supports comma and semicolon delimiters. Requires Pro or Business.

### POST /api/v1/qr-codes/export
Streams a ZIP archive of up to 200 styled QR codes ({"ids": [...], "format": "svg"|"png", "size": 1000}) plus a manifest.csv. Requires Pro or Business.

### POST /api/v1/qr-codes/print-sheet
Streams a print-ready multi-page A4 or US Letter PDF label sheet of up to 120 styled/framed QR codes ({"ids": [...], "paper": "a4"|"letter", "columns": 2|3|4, "show_labels": true, "show_cut_guides": true}). Requires Pro or Business.

### GET / POST / PATCH / DELETE /api/v1/webhooks
Manage up to 5 HTTPS scan webhooks (event: qr.scanned) signed with HMAC-SHA256 (header X-DynamicQR-Signature: t=<unix>,v1=<hex>) for Zapier, Make, n8n or custom servers. Test with POST /api/v1/webhooks/{id}/test. Requires Pro or Business.

### GET / POST / PATCH / DELETE /api/v1/domains
Connect branded custom short domains (e.g. qr.example.com) with DNS verification via POST /api/v1/domains/{id}/verify (CNAME to target host or TXT record) and automatic Let's Encrypt SSL via POST /api/v1/domains/{id}/ssl. Pass custom_domain_id when creating or updating link QR codes. Requires Pro or Business (3 on Pro, 10 on Business).

## 3. Remote MCP Server (https://dynamicqr.io/mcp)
Transport: Streamable HTTP JSON-RPC 2.0 (POST https://dynamicqr.io/mcp) with header Authorization: Bearer dqr_live_...

Example MCP client configuration:
```json
{
  "mcpServers": {
    "dynamicqr": {
      "url": "https://dynamicqr.io/mcp",
      "headers": {
        "Authorization": "Bearer dqr_live_YOUR_API_KEY"
      }
    }
  }
}
```

Available MCP tools (10):
1. get_account_usage: Plan tier, active QR count, limit, extra packs and paused count.
2. list_qr_codes: Search/filter QR codes by search, type, or tag with 7-day scan totals and active/paused status.
3. create_qr_code: Create dynamic link or static QR codes (all 8 types) with brand colors, logos, CTA frames, custom domain, and smart redirect rules.
4. get_qr_code: Retrieve one QR code including redirect URL, fields, routing rules, share link, and inline SVG.
5. update_link_qr_code: Update a link QR code's target URL, name, style, controls, custom domain, or smart redirect rules without changing its printed code.
6. delete_qr_code: Permanently delete a QR code and its scan history.
7. get_qr_scan_stats: Read daily scan time-series and device/OS/country breakdowns for one code or all codes.
8. toggle_qr_share_link: Enable, regenerate, or disable a public read-only client analytics link (/share/{token}).
9. list_custom_domains: List connected custom short domains with DNS verification and automatic SSL status.
10. list_webhooks: List configured outbound scan webhooks (qr.scanned).

## 4. Pricing & Pause Policy
- Free: €0/mo, 3 QR codes always active.
- Pro: €9/mo or €79/yr, 50 dynamic QR codes, custom colors/styles/logos/frames, smart redirects, custom domains, webhooks, client reports, REST API & MCP.
- Business: €29/mo or €249/yr, 500 dynamic QR codes, team workspaces, 10 custom domains, higher API/MCP limits.
- Extra packs: +100 QR codes for €5/mo or €45/yr per pack (stackable).
- Grace period: 14 days after cancellation before codes above the free limit pause (HTTP 402 notice page, never deleted).
