QR Code API

Overview

The QR Code API is an HTTP API that can be use for creating custom QR Codes programmatically. Every QR Code will contain a unique Branch link which you can deep link and track analytics with.

📘

QR Code API

The QR Code API is available for enterprise customers. Please reach out to your CSM or submit a ticket to activate this feature.

Create a QR Code

Endpoint

POST /v1/qr-code
Content-Type: application/json

Rate Limits

  • 25 requests per second
  • 100 requests per minute
  • 1000 requests per hour

Parameters

Parameter

Type

Definition

branch_key (REQUIRED)

String

The Branch key of the originating app; from your Branch Settings Dashboard

data (Optional)

JSON

The dictionary to embed link data behind the QR Code. Accessed as session or install parameters from the SDK. Use the data dictionary for all link control parameters that you'll find here.

Branch analytics parameters (Optional)

String

It's important to tag your links with an organized structure of analytics labels so that the data appears consistent and readable in the dashboard.

qr_code_settings (Optional)

JSON

If this nor any of the key/value pairs are not present, we will utilize your app defaults. See table below for setting details.

qr_code_settings

Parameter

Type

Definition

code_color

String

Hex color value of the QR Code itself.

background_color

String

Hex color value of the background of the QR code itself.

margin

Integer (Pixels)

The number of pixels you want for the margin. Max 20.

width

Integer (Pixels)

Output size of QR Code image. Min 500px. Max 2000px. (Only applicable to JPEG/PNG)

image_format

String

“JPEG”, “PNG”

center_logo_url

String (HTTP URL)

URL to the image you want as a center logo e.g. “https://cdn.branch.io/branch-assets/1598575682753-og_image.png”

Sample Request

curl -X POST \
  https://api2.branch.io/v1/qr-code \
  -d '{
  "campaign": "qr_campaign",
  "channel": "flyer_1",
  "feature": "qr_codes",
  "data": {
    "$canonical_identifier": "content/123",
    "$og_title": "Title from Deep Link",
    "$og_description": "Description for QR code",
    "$og_image_url": "http://www.lorempixel.com/400/400/",
    "$canonical_url": "http://www.example.com/content/123",
    "custom_string": "anything"
  },
  "qr_code_settings": {
    "center_logo_url": "https://cdn.branch.io/branch-assets/1598575682753-og_image.png",
    "image_format": "png",
    "width": 512
  },
  "branch_key": "XXXXX_BRANCH_KEY_GOES_HERE_XXXXX"
}' --output qr_code.png

📘

Image Ouput

Note that the output of this cURL requests will be saved in the current directory as the file name indicated at the end of the request e.g. qr_code.png.

Result

Updated 10 days ago


QR Code API


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.