Endpoint
GET
Authentication
This endpoint does not require authentication for basic usage. Authentication is required for:- Custom logos (paid plans only)
- Hiding the default Dub logo (paid plans only)
Query Parameters
The URL to generate a QR code for.
The size of the QR code in pixels.
The level of error correction to use for the QR code.Options:
L, M, Q, HL- Low (7% error correction)M- Medium (15% error correction)Q- Quartile (25% error correction)H- High (30% error correction)
The foreground color of the QR code in hex format.
The background color of the QR code in hex format.
The size of the margin around the QR code.
The logo to include in the QR code. Can only be used with a paid plan on Dub.Requires authentication.
Whether to hide the logo in the QR code. Can only be used with a paid plan on Dub.Requires authentication.
Response
Returns a PNG image of the QR code.image/pngExamples
Usage Notes
Error Correction Levels
Choose the appropriate error correction level based on your needs:- L (Low): Use when the QR code will be displayed in clean environments
- M (Medium): Good balance for most use cases
- Q (Quartile): Better for QR codes that might be partially obscured
- H (High): Best for QR codes with logos or in challenging environments
Custom Logos
When using a custom logo:- The logo will be centered in the QR code
- Logo size is automatically set to 1/4 of the QR code size
- Use higher error correction levels (Q or H) when including logos
- Requires a paid Dub plan
Color Customization
For best scanning results:- Ensure high contrast between foreground and background colors
- Dark foreground on light background works best
- Test the QR code with multiple scanning apps before deploying
CORS
This endpoint supports Cross-Origin Resource Sharing (CORS) with the following headers:Access-Control-Allow-Origin: *Access-Control-Allow-Methods: GET, OPTIONS