QR Code Generator

The /qrcode_generator endpoint generates QR code from the given piece of text, with customizable options like error correction level etc. It returns the code in the form of SVG or Base64 text.

Method: POST

To make a request, send the required parameters with the authorization header, to the /qrcode_generator endpoint.

Parameters

This endpoint accepts three parameters:

  • data is the text from which the QR code, is to be created.
  • format is the format, in which, the QR code should be generated. It can be either svg or base64.
  • options contains the options for customizing the QR code. It accepts three values
    • error_correction_level refers to the level, to which, the QR code can sustain damage, while still being readable. The levels of error-correction are:
      • L: Low, recovers up to 7% of the data.
      • M: Medium, recovers up to 15% of the data. It is the default option.
      • Q: Quartile, recovers up to 25% of the data.
      • H: High, recovers up to 30% of the data.
    • width is only for Base64 format, and is the width for the QR code image. It accepts only number. The default width is 300.

Responses

The success response, looks like this, where image contains the image in the format in the specified format.

{
  "status": "success", 
  "data": {
    "source_data": "Cats", 
    "image": "<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 29 29' shape-rendering='crispEdges'><path fill='#ffffff' d='M0 0h29v29H0z'/><path stroke='#000000' d='M4 4.5h7m3 0h2m2 0h7M4 5.5h1m5 0h1m1 0h3m3 0h1m5 0h1M4 6.5h1m1 0h3m1 0h1m2 0h1m4 0h1m1 0h3m1 0h1M4 7.5h1m1 0h3m1 0h1m2 0h1m1 0h2m1 0h1m1 0h3m1 0h1M4 8.5h1m1 0h3m1 0h1m1 0h2m1 0h2m1 0h1m1 0h3m1 0h1M4 9.5h1m5 0h1m3 0h2m2 0h1m5 0h1M4 10.5h7m1 0h1m1 0h1m1 0h1m1 0h7M4 12.5h1m1 0h1m1 0h1m1 0h1m2 0h1m2 0h1m3 0h1m2 0h1M4 13.5h2m1 0h2m3 0h4m1 0h1m1 0h1m1 0h1m1 0h2M7 14.5h2m1 0h2m1 0h1m1 0h1m1 0h3m1 0h4M5 15.5h4m5 0h4m1 0h2m3 0h1M8 16.5h3m1 0h4m1 0h3m1 0h1m2 0h1M12 17.5h1m5 0h1m4 0h1M4 18.5h7m3 0h1m1 0h1m3 0h1m1 0h3M4 19.5h1m5 0h1m3 0h1m3 0h1m4 0h1M4 20.5h1m1 0h3m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h2m1 0h2M4 21.5h1m1 0h3m1 0h1m3 0h2m1 0h1m1 0h1m1 0h1m1 0h1M4 22.5h1m1 0h3m1 0h1m1 0h2m1 0h1m1 0h3m1 0h1m2 0h1M4 23.5h1m5 0h1m3 0h4m1 0h3m1 0h1M4 24.5h7m1 0h1m2 0h1m1 0h3m2 0h3'/></svg>\n", 
    "format": "svg", 
    "options_applied": {
      "error_correction_level": "M"
    }
  },
  "message": "Successfully created QR Code in \"svg\" format with the given data."
}

And if some error occurs, like the format is not provided, the response looks like as below:

{
  "status": "error", 
  "error": {
    "code": "INVALID_REQUEST",
    "message": "'format' parameter must be either 'base64' or 'svg' and cannot be empty.",
    "details": "'format' must be provided and be either 'base64' or 'svg'."
  }
}