Generate a QR code.
POST/generate/qrcode/encode
Returns a QR code as a PNG image, styled using the provided settings.
Request
Header Parameters
- application/json
Bodyrequired
Numeric
: Only numbers from 0 to 9.Alphanumeric
: Numbers from 0 to 9, latin letters from A to Z (only upper-case), spaces, and the following special characters: $, %, *, +, -, ., /, :.Byte
: Any bytes.L
: 7%M
: 15%Q
: 25%H
: 30%radial
: The gradient starts at the center of the image and moves outwards.linear
: The gradient starts at one side and moves to the other.- Array [
- ]
radial
: The gradient starts at the center of the image and moves outwards.linear
: The gradient starts at one side and moves to the other.- Array [
- ]
radial
: The gradient starts at the center of the image and moves outwards.linear
: The gradient starts at one side and moves to the other.- Array [
- ]
The data that should be encoded
https://wemakefuture.com
The width of the QR code in pixels. Default is 500.
500
The height of the QR code in pixels. Default is 500.
500
The URL of the image that should be put in the middle. By default, no image is used. The image covers up part of the QR code, which can only be recovered using error correction.
https://pbs.twimg.com/profile_images/1325818753842618384/I9aD7jAt_400x400.jpg
The size of the space between the QR code and the border of the image in pixels. Default is 15.
15
qrOptions object
Options for the QR code data.
The type of the QR code. This must be an integer between 1 and 40. The number of dots on each side of the QR code is 4 * type number + 17. If the type is too low to encode all data, the request will fail. By default, the QR code is sized as small as possible.
5
The mode of the QR code. This decides which characters are allowed in the QR code:
For almost all cases, Byte
is the correct choice, including for URLs. Default is Byte
.
Possible values: [Numeric
, Alphanumeric
, Byte
]
Byte
The error correction level. The higher the level is, the more likely it becomes the QR code can still be read in bad conditions, e.g. bad lighting, shaking, or when part of the code is hidden or destroyed. However, error correction also requires more data to be stored in the QR code, meaning the typeNumber
will be higher. These are the approximate percentages of data that can be restored with the respective error correction levels:
Default is Q
.
Possible values: [L
, M
, Q
, H
]
Q
imageOptions object
Options for the image in the center of the QR code.
Whether the dots covered by the image should be hidden. Default is true
.
true
The size of the empty space around the image in pixels. Increasing the margin will decrease the image size. Default is 0.
0
dotsOptions object
Options for the dots that make up most of the QR code.
The style of the dots. Default is square
.
Possible values: [dots
, rounded
, classy
, classy-rounded
, square
, extra-rounded
]
square
The color of the dots as a hexcode. Can only be used if gradient
is not used. Default is #000000
, i.e. black.
Possible values: Value must match regular expression #[A-Fa-f0-9]{6}
#000000
gradient object
Options for a color gradient of the dots. Can only be used if color
is not used.
The type of gradient. This can be one of two options:
Possible values: [radial
, linear
]
linear
The clockwise rotation of the gradient in degrees. Can only be used when type
is linear. Default is no rotation.
colorStops object[]required
The color stops in the gradient.
The offset where this color should be used. Must be between 0 and 1.
0
The color of this color stop as a hexcode.
Possible values: Value must match regular expression #[A-Fa-f0-9]{6}
#FF0000
cornersSquareOptions object
Options for the corner squares. This does not influence the smaller dots inside the corner squares.
The style of the corner squares. Default is square
.
Possible values: [square
, extra-rounded
, dot
]
square
The color of the corner squares as a hexcode. Can only be used if gradient
is not used. Default is #000000
, i.e. black.
Possible values: Value must match regular expression #[A-Fa-f0-9]{6}
#000000
gradient object
Options for a color gradient of the corner squares. Can only be used if color
is not used.
The type of gradient. This can be one of two options:
Possible values: [radial
, linear
]
linear
The clockwise rotation of the gradient in degrees. Can only be used when type
is linear. Default is no rotation.
colorStops object[]required
The color stops in the gradient.
The offset where this color should be used. Must be between 0 and 1.
0
The color of this color stop as a hexcode.
Possible values: Value must match regular expression #[A-Fa-f0-9]{6}
#FF0000
cornersDotOptions object
Options for the corner dots. This does not influence the square border around the corner dots.
The style of the corner dots. Default is square
.
Possible values: [square
, dot
]
square
The color of the corner dots as a hexcode. Can only be used if gradient
is not used. Default is #000000
, i.e. black.
Possible values: Value must match regular expression #[A-Fa-f0-9]{6}
#000000
gradient object
Options for a color gradient of the corner squares. Can only be used if color
is not used.
The type of gradient. This can be one of two options:
Possible values: [radial
, linear
]
linear
The clockwise rotation of the gradient in degrees. Can only be used when type
is linear. Default is no rotation.
colorStops object[]required
The color stops in the gradient.
The offset where this color should be used. Must be between 0 and 1.
0
The color of this color stop as a hexcode.
Possible values: Value must match regular expression #[A-Fa-f0-9]{6}
#FF0000
Responses
- 200
- 400
Success
- application/json
- Schema
- Example (auto)
Schema
{
"imageUrl": "string",
"fileName": "string"
}
Bad Request
- application/json
- Schema
- Example (auto)
Schema
{
"status": 0,
"errorMessage": "string"
}