Skip to main content

Endpoint

method
string
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

url
string
required
The URL to generate a QR code for.
size
number
default:"600"
The size of the QR code in pixels.
level
enum
default:"L"
The level of error correction to use for the QR code.Options: L, M, Q, H
  • L - Low (7% error correction)
  • M - Medium (15% error correction)
  • Q - Quartile (25% error correction)
  • H - High (30% error correction)
fgColor
string
default:"#000000"
The foreground color of the QR code in hex format.
bgColor
string
default:"#ffffff"
The background color of the QR code in hex format.
margin
number
default:"4"
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.
Content-Type
string
image/png

Examples

curl -X GET "https://api.dub.co/qr?url=https://dub.sh/example&size=600"

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

Build docs developers (and LLMs) love