QRdx
HelpGuidesDevelopersReact librarySelf-hosting

Quickstart

Your first QRdx API request in under two minutes, with no key. Then an API key and your first dynamic code.

The QRdx API has two halves. Images need nothing: no account, no key. Dynamic codes, scans and webhooks belong to a workspace, so they need an API key.

Make a QR code (no key)

Run this. It saves a PNG of a QR code that opens qrdx.dev:

curl "https://api.qrdx.dev/v1/qr?data=https://qrdx.dev&format=png" -o qr.png

That's a working API call. The URL itself is the image, so it also works straight in an <img> tag:

<img src="https://api.qrdx.dev/v1/qr?data=https://qrdx.dev&fg=111111&body=circle" alt="QR code for qrdx.dev" />

Change the colors, shapes, size and format with query parameters, or try them in the browser on the Render a QR code image page: its Try it panel sends the request and shows the image. Images don't count against any quota; the limit is 300 requests a minute per IP address.

Create an API key

Everything else in the API acts on a workspace: create dynamic codes, change where they point, read their scans. Those requests carry an API key in the Authorization header.

  1. Open Settings → API keys & apps (sign in first if you need to). The Create key form opens.
  2. Keep Full access and choose Create key.
  3. Copy the key. It's shown once. The dialog also shows a curl request that creates a dynamic code, with your key filled in, if you'd rather paste that.

Export the key for the next steps:

export QRDX_API_KEY=qrdx_...

The key acts as you in the workspace that was open when you made it, and requests with it count against that workspace's daily quota (1,000 requests on Free). API keys covers scopes, teams, expiry and revoking.

Create a dynamic code

A dynamic code is a short link you can point somewhere else after it's printed:

curl -X POST https://api.qrdx.dev/v1/codes \
  -H "Authorization: Bearer $QRDX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destinationUrl": "https://example.com", "title": "My first code"}'

The response is 201 Created with the new code:

{
  "data": {
    "id": "cm5code0spring0menu00001",
    "slug": "aB3dE5f",
    "shortLink": "https://qrdx.dev/q/aB3dE5f",
    "destinationUrl": "https://example.com/",
    "title": "My first code",
    "status": "active",
    "scanCount": 0
  }
}

(Shortened: Create codes shows every field.) The QR code encodes shortLink. Render it with the image API from step 1, https://api.qrdx.dev/v1/qr?data=https://qrdx.dev/q/aB3dE5f, and print it.

Point it somewhere else

Change the destination at any time; the printed code keeps working:

curl -X PATCH https://api.qrdx.dev/v1/codes/$CODE_ID \
  -H "Authorization: Bearer $QRDX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destinationUrl": "https://example.com/new-page"}'

Scan the code once, then read its analytics with GET /v1/codes/$CODE_ID/scans (Get scan analytics).

When something goes wrong

Every error is JSON with a stable code and a message that says what to do:

{
  "code": "UNAUTHORIZED",
  "message": "Missing API key. Send an API key as \"Authorization: Bearer <key>\"; create one at https://qrdx.dev/dashboard?to=settings/developers. OAuth access tokens go in the same header.",
  "status": 401,
  "docs": "https://qrdx.dev/docs/developers/api-keys"
}

The errors page lists every code with its fix.

Acting for other people

An API key acts as you. If your product calls QRdx for other people, register an OAuth app instead: each person approves it once, and your server gets an access token for their account, sent in the same Authorization: Bearer header. Every request above works unchanged with a token in place of the key. See REST API and OAuth and Build an integration.

Next steps

Last updated on

On this page