QR Codes & Barcodes

Notes
Expert level
The API key should be sent as a Bearer token in the Authorization header of the request. Get your API key.
Generate QR Code (Instant)

Generate a vector SVG QR code on the fly without saving it to database.

API endpoint:

GET | POST
https://2if.net/api/v1/qr-codes/generate

Request example (JSON Data URL output):

curl --location --request POST 'https://2if.net/api/v1/qr-codes/generate' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}' \
--data-urlencode 'text=https://example.com' \
--data-urlencode 'size=300' \
--data-urlencode 'color=#000000' \
--data-urlencode 'response_type=json'
Parameter
Type
Description
text
required string
The text or URL to encode inside the QR code.
size
optional integer
Width & height of the QR code in pixels (default: 300, min: 50, max: 2000).
color
optional hex
Foreground color hex code, e.g. #000000.
bg_color
optional hex
Background color hex code, e.g. #ffffff.
margin
optional integer
Quiet zone margin in pixels (default: 0).
error_correction
optional string
Error correction level: L, M, Q, H (default: M).
response_type
optional string
Response format: "raw" (direct SVG image) or "json" (Base64 data URL & SVG code).
Generate 1D Barcode (Code-128)

Generate a standard Code-128 linear 1D barcode vector SVG for products, inventory, SKUs, or tracking numbers.

API endpoint:

GET | POST
https://2if.net/api/v1/barcodes/generate

Request example:

curl --location --request POST 'https://2if.net/api/v1/barcodes/generate' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}' \
--data-urlencode 'text=PRD-99812' \
--data-urlencode 'height=60' \
--data-urlencode 'show_text=1'
Parameter
Type
Description
text
required string
The alphanumeric string or SKU code to encode into the linear barcode.
type
optional string
Barcode symbology: "code128" (default).
height
optional integer
Height of the bars in pixels (default: 60, min: 20, max: 500).
width
optional integer
Module bar width scale factor (default: 2, min: 1, max: 10).
show_text
optional boolean
Render human-readable text label below bars (1 or 0, default: 1).
color
optional hex
Bar color hex code, e.g. #000000.
response_type
optional string
Response format: "raw" or "json".
List QR Codes

API endpoint:

GET
https://2if.net/api/v1/qr-codes

Request example:

curl --location --request GET 'https://2if.net/api/v1/qr-codes' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}'
Store QR Code

API endpoint:

POST
https://2if.net/api/v1/qr-codes

Request example:

curl --location --request POST 'https://2if.net/api/v1/qr-codes' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}' \
--data-urlencode 'name=My Campaign QR' \
--data-urlencode 'url=https://example.com/promo'
Parameter
Type
Description
name
required string
Name of the QR code.
url
required url
Destination target URL.
link_id
optional integer
Existing short link ID to associate with.
style
optional json
Custom styling options (color, pattern, frame, corner).
Show QR Code

Retrieve details and configuration of a specific saved QR code belonging to your account.

API endpoint:

GET
https://2if.net/api/v1/qr-codes/{id}

Request example:

curl --location --request GET 'https://2if.net/api/v1/qr-codes/{id}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}'

Response example:

{
    "data": {
        "id": 12,
        "name": "Summer Campaign",
        "url": "https://example.com/summer",
        "link_id": 45,
        "short_url": "https://2if.test/summer26",
        "style": {
            "color": "#176b5b",
            "bg_color": "#ffffff"
        },
        "created_at": "2026-10-14T12:00:00.000000Z",
        "updated_at": "2026-10-14T12:00:00.000000Z"
    },
    "status": 200
}
Update QR Code

Update the name, destination URL, or styling of an existing QR code.

API endpoint:

PUT | PATCH
https://2if.net/api/v1/qr-codes/{id}

Request example:

curl --location --request PUT 'https://2if.net/api/v1/qr-codes/{id}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}' \
--data-urlencode 'name=Updated Summer Campaign' \
--data-urlencode 'url=https://example.com/autumn'
Parameter
Type
Description
name
optional string
Updated name of the QR code.
url
optional url
Updated destination target URL.
style
optional json
Updated custom styling properties.
Get QR Code SVG Image

Directly fetches the rendered vector SVG image for a saved QR code. Ideal for embedding into web pages, mobile apps, or design tools.

API endpoint:

GET
https://2if.net/api/v1/qr-codes/{id}/image

Request example:

curl --location --request GET 'https://2if.net/api/v1/qr-codes/{id}/image?size=400' \
--header 'Authorization: Bearer {api_key}' \
--output qrcode.svg

HTML embed example:

<img src="https://2if.net/api/v1/qr-codes/12/image?size=300" width="300" height="300" alt="QR Code" />
Parameter
Type
Description
size
optional integer
Rendered dimensions in pixels (default: 300, min: 50, max: 2000).
Delete QR Code

Permanently removes a QR code from your account. Due to strict user isolation (ownership check), you can only delete QR codes that belong to your account.

API endpoint:

DELETE
https://2if.net/api/v1/qr-codes/{id}

Request example:

curl --location --request DELETE 'https://2if.net/api/v1/qr-codes/{id}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {api_key}'

Response example:

{
    "id": 12,
    "object": "qr_code",
    "deleted": true,
    "status": 200
}