McAPI - QR API Overview

Create QR codes as SVG or PNG. Encode URLs, email addresses, sms or plain text. Set colors, dot styles and shape. The QR generator is very fast and fully Unicode compatible. Sample code illustrates QR code creation in Node / JS, Python, Ruby and many other languages and environments.

Content types:

  • Plain text (max. 2,000 chars): "123456abcdefÄÖÜ日本語"
  • URL: Specify data param like so: "https://example.com"
  • Email: Specify data param like so: "mailto:info@example.com"
  • Phone no: Specify data param like so: "tel:+18005551234"
  • SMS: Specify data param like so: "smsto:44044"

Specify params as follows:

  • data: Data to encode, String, required
  • dotSize: Size of a single dot in pixels, number, optional, default: 10
  • dotColor: Color of dot, HEX RGB string, optional, default: "#000000"
  • finderColor: Color of finder pattern, HEX RGB string, optional, default: "#000000"
  • dotStyle: Style of dots, number, optional, standard: 0, separated: 1, default: 0
  • dotShape: Shape of dots, number, optional, square: 0, disc: 1, diamond: 2, star: 3, default: 0
  • ecc: QR ECC level, number, optional, M: 0, L: 1, H: 2, Q: 3, default: 0
  • format: Image format, string, optional, supported: "svg", "png", default: "svg". Raster format PNG is created with 72dpi resolution. SVGs are created with 96dpi base resolution as is assumed by CSS and all major browsers.

Call returns the generated QR code as a base64 encoded SVG or as base64 encoded PNG.

McAPI QR API - Plans and pricing

We provide a generous free plan with this API. See the RapidAPI listing for all plans and pricing.

McAPI QR API - Specifications

Version:

V1.1

Protocol:

https

URL:

https://mcapi-qr.p.rapidapi.com

Endpoint:

/

Method:

POST

McAPI QR API - Sample cURL call

Shown is a cURL request to create and return a QR code with the text https://mcapi.io in red and blue colors (replace YOUR_API_KEY with your RapidAPI key):
curl --request POST \
--url https://mcapi-qr.p.rapidapi.com/ \
--header 'content-type: application/json' \
--header 'x-rapidapi-host: mcapi-qr.p.rapidapi.com' \
--header 'x-rapidapi-key: YOUR_API_KEY' \
--data '{
  "data": "https://mcapi.io",
  "dotSize": 10,
  "finderColor": "#0000FF",
  "dotColor": "#FF0000",
  "dotStyle": 1,
  "dotShape": 1,
  "format": "png"
}'

McAPI QR API - Sample response

Shown is the response from the cURL request above (the returned PNG is shortened):
{
  "service":"McAPI QR Code Generator, https://mcapi.io"
  "version":"V1"
  "format":"png"
  "code":"data:image/png;base64,iVBORw ... 0KGgo"
}

McAPI QR API - Sample QR barcode

Shown is the returned code from the cURL call above:

Image of McAPI QR API Sample Barcode

McAPI QR API - Error codes and messages

With any error, the API will return a status code of 400. Also provided is a status text with more information. The following example shows the response for a messed up data package (with the cURL above we changed the JSON block from "finderColor": "#0000FF" to "finderColor: "#0000FF"):

Malformed event parameter

Other error messages:

  • No data specified - data property absent or empty string
  • Data length > 2.000 chars. - data string too long
  • Code parameters invalid - Catch all error for invalid arguments for the QR code:
    • dotSize not between 2 and 1000
    • dotSize not numeric
    • ecc not between 0 and 3
    • ecc not numeric
    • dotStyle not between 0 and 1
    • dotStyle not numeric
    • dotShape not between 0 and 3
    • dotShape not numeric
    • dotColor / finderColor not a valid RGB HEX color string
    • format invalid

McAPI QR API - Sample code and snippets

For more sample code open the QR list item in the sidebar and select your language or environment.