Skip to main content
GET
/
qr
Python
from dub import Dub


with Dub(
    token="DUB_API_KEY",
) as d_client:

    res = d_client.qr_codes.get(request={
        "url": "https://needy-newsstand.biz/",
        "hide_logo": True,
        "include_margin": False,
    })

    # Handle response
    print(res)
declare(strict_types=1);

require 'vendor/autoload.php';

use Dub;
use Dub\Models\Operations;

$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();

$request = new Operations\GetQRCodeRequest(
url: 'https://needy-newsstand.biz/',
hideLogo: true,
includeMargin: false,
);

$response = $sdk->qrCodes->get(
request: $request
);

if ($response->res !== null) {
// handle response
}
package main

import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)

func main() {
ctx := context.Background()

s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)

res, err := s.QRCodes.Get(ctx, operations.GetQRCodeRequest{
URL: "https://needy-newsstand.biz/",
HideLogo: dubgo.Pointer(true),
IncludeMargin: dubgo.Pointer(false),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
require 'dub'

Models = ::OpenApiSDK::Models
s = ::OpenApiSDK::Dub.new(
security: Models::Shared::Security.new(
token: 'DUB_API_KEY',
),
)

req = Models::Operations::GetQRCodeRequest.new(
url: 'https://needy-newsstand.biz/',
hide_logo: true,
include_margin: false,
)

res = s.qr_codes.get(request: req)

unless res.nil?
# handle response
end
import { Dub } from "dub";

const dub = new Dub({
token: "DUB_API_KEY",
});

async function run() {
const result = await dub.qrCodes.get({
url: "https://needy-newsstand.biz/",
hideLogo: true,
includeMargin: false,
});

console.log(result);
}

run();
curl --request GET \
--url https://api.dub.co/qr
const options = {method: 'GET'};

fetch('https://api.dub.co/qr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
HttpResponse<String> response = Unirest.get("https://api.dub.co/qr")
.asString();
"<string>"
{
"error": {
"code": "bad_request",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#bad-request"
}
}
{
"error": {
"code": "unauthorized",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#unauthorized"
}
}
{
"error": {
"code": "forbidden",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#forbidden"
}
}
{
"error": {
"code": "not_found",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#not-found"
}
}
{
"error": {
"code": "conflict",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#conflict"
}
}
{
"error": {
"code": "invite_expired",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#invite-expired"
}
}
{
"error": {
"code": "unprocessable_entity",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#unprocessable-entity"
}
}
{
"error": {
"code": "rate_limit_exceeded",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#rate-limit_exceeded"
}
}
{
"error": {
"code": "internal_server_error",
"message": "The requested resource was not found.",
"doc_url": "https://dub.co/docs/api-reference/errors#internal-server_error"
}
}

Query Parameters

url
string
required

The URL to generate a QR code for.

Maximum string length: 32000

The logo to include in the QR code. Can only be used with a paid plan on Dub.

size
number
default:600

The size of the QR code in pixels. Defaults to 600 if not provided.

level
enum<string>
default:L

The level of error correction to use for the QR code. Defaults to L if not provided.

Available options:
L,
M,
Q,
H
fgColor
string
default:#000000

The foreground color of the QR code in hex format. Defaults to #000000 if not provided.

bgColor
string
default:#FFFFFF

The background color of the QR code in hex format. Defaults to #ffffff if not provided.

Whether to hide the logo in the QR code. Can only be used with a paid plan on Dub.

margin
number
default:2

The size of the margin around the QR code. Defaults to 2 if not provided.

includeMargin
boolean
default:true
deprecated

DEPRECATED: Margin is included by default. Use the margin prop to customize the margin size.

Response

The QR code

The response is of type string.