QRdx
HelpGuidesDevelopersReact librarySelf-hosting

Report a conversion

Attributes a sale, sign-up or other conversion to the scan that brought the visitor (Business).

From your server, send a token and the scan's sid, or the code id as code. From the browser, conversions.js sends sid with no token, for codes with conversion tracking turned on. An id, such as your order id, makes retries safe: a repeat returns 200 with duplicate: true. More in Tracking and conversions.

POST
/conversions

Authorization

oauth2 codes:write
headerAuthorizationBearer <token>

An OAuth 2.0 access token, sent as Authorization: Bearer <token>. Register an app in Settings → Developers, send the user through authorization (PKCE S256), then exchange the code for a token. Access tokens last 1 hour; refresh tokens 30 days. Step by step.

Scope: codes:write

Request Body

application/json
  1. body
sid?string

The qrdx_sid the short link appended to your page URL

Lengthlength <= 200
code?string

The code id, when no scan is known (token requests only)

Match^[A-Za-z0-9_-]{1,64}$
name?string

What happened, e.g. purchase or signup

Match^[\p{L}\p{N} _.:/-]+$
Length1 <= length <= 64
Default"conversion"
value?|

Amount, as a number or string with up to 2 decimals

currency?string

ISO 4217 code; USD when a value has none

Match^[A-Z]{3}$
id?string

Your id for it (order id, ...); repeats are ignored

Length1 <= length <= 128
metadata?

Up to 20 extra keys

Response Body

Already recorded (same id)

application/json
  1. response
id*string

Conversion id (derived from id when you send one)

codeId*string
scanId*|

The attributed scan, or null when reported by code id

duplicate*boolean

True when a conversion with the same id was already recorded (status 200)

Example Request
curl -X POST 'https://api.qrdx.dev/v1/conversions' \  -H 'Content-Type: application/json' \  -d '{  "sid": "eyJjIjoiY201Y29kZSIsInMiOiJjbTVzY2FuIn0.sig",  "name": "purchase",  "value": 49.9,  "currency": "EUR",  "id": "order_1042"}'
Example Response
{  "id": "cv_3f1c2a9d0b7e4f6a8c5d1e2f3a4b5c6d",  "codeId": "cm5code0spring0menu00001",  "scanId": "cm5scan0berlin0000000001",  "duplicate": true}

Last updated on