apyhub-logo
30 atoms
Base tier

About

This API lets you dynamically generate QR codes.
This API generates personalized QR Codes by adding colors and logos to make them unique and branded. The generated codes can be scanned using a smartphone or other mobile device, providing quick and easy access to information such as product details, promotions, contact information, or WiFi details. The generated QR codes can be accessed and scanned offline, allowing for easy access to information even in areas with limited internet connectivity.
Try out the API in the API playground and see how this free online QR code generator API can help you generate QR codes, save time, and improve your users and visitors experience with a simple API call.
Select API Endpoints
Output

API Playground

API Documentation

generate qr code file
POST
https://api.apyhub.com/generate/qr-code/file

Request example

1
curl --location --request POST 'https://api.apyhub.com/generate/qr-code/file?output=sample.png' \
2
--header 'apy-token: {{token}}' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{
5
"content": "https://apyhub.com",
6
"logo": "https://apyhub.com/logo.svg",
7
"background_color": "#000000",
8
"foreground_color": ["#e8bf2a", "#e8732a"]
9
}'
Method: POST
Content Type: application/json
Query Parameter(s)
AttributeTypeMandatoryDescription
outputStringNoThe name for the QR code file. If no output attribute is provided, the default file name will be output.png
Request Body
AttributeTypeMandatoryDescription
contentStringYes (If v_card and wifi_info are not provided)Any text or url for which you want to generate QR Code.
logoStringNoUrl of the logo you want in QR Code. Accepts png, jpeg and svg.
background_colorStringNoBackground color of the QR Code in Hexadecimal format. Defaults to #000000 (black).
foreground_colorString or ArrayNoForeground color of the QR Code in Hexadecimal format. Defaults to #ffffff (white). Accepts input as String if one/solid color is used or accepts an Array of String with start and end colors, for a gradient.
v_card.nameStringYesName of the contact.
v_card.phone_numbersArrayYesPhone numbers of the contact.
v_card.organizationStringNoOrganization of the contact.
v_card.job_titleStringNoJob title of the contact.
v_card.addressStringNoAddress of the contact.
v_card.emailStringNoEmail address of the contact.
v_card.websiteStringNoWebsite url of the contact.
v_card.photo_urlStringNoUrl of the photo of the contact.
v_card.birthdayStringNoBirthday of the contact in 'YYYYMMDD' format.
v_card.notesStringNoAny additional notes you want to save for the contact.
wifi_info.ssidStringYesName of the wifi.
wifi_info.passwordStringYes (If auth_type is provided)Password of the wifi, for password protected wifi.
wifi_info.auth_typeStringYes (If password is provided)Authentication type of the wifi, for password protected wifi.
Sample Requests
vCard
1
curl --location --request POST 'https://api.apyhub.com/generate/qr-code/file?output=sample.png' \
2
--header 'apy-token: {{token}}' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{
5
"v_card":{
6
"name": "John Doe",
7
"organization": "ABC Company",
8
"job_title": "Manager",
9
"address": "123 Main Street",
10
"phone_numbers": [
11
"+1234567890",
12
"+9876543210"
13
],
14
"email": "johndoe@example.com",
15
"website": "https://example.com",
16
"photo_url": "https://example.com/photo.jpg",
17
"birthday": "20230612",
18
"notes": "This is a sample vCard"
19
},
20
"logo": "https://apyhub.com/logo.svg",
21
"background_color": "#000000",
22
"foreground_color": ["#e8bf2a", "#e8732a"]
23
}'
Wi-Fi
1
curl --location --request POST 'https://api.apyhub.com/generate/qr-code/file?output=sample.png' \
2
--header 'apy-token: {{token}}' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{
5
"wifi_info": {
6
"ssid": "HUAWEI P9 lite",
7
"password": "asdfghjkl",
8
"auth_type": "WPA"
9
},
10
"logo": "https://apyhub.com/logo.svg",
11
"background_color": "#000000",
12
"foreground_color": ["#e8bf2a", "#e8732a"]
13
}'
Sample Response
A successful request returns the QR code image file.

HTTP Response Codes

The method may return one of the following HTTP status codes:
Status CodeDescription
200The request was successful.
401Required authentication information is either missing or not valid for the resource.
400Invalid input - the content is empty
500If any unexpected error occurs while processing the request

Authentication

All API requests to ApyHub services need to be authenticated. Currently we support tokens or basic authentication mechanisms. You can generate and view your existing credentials from your workspace settings (on the left side of the navbar) and go to “API Keys".
Points to note:
  • Credential secrets are generated on the fly and are not stored in plain text, so on generating a credential please save the secrets somewhere safe.
  • Use the apy-token as the header parameter to pass the token.
  • Use the Authorization header to send the basic authentication credentials.

Error codes

1
{
2
"error": {
3
"code": 105,
4
"message": "Invalid URL"
5
}
6
}
To search for a specific error code, enter the code in the search box below. Alternatively, you can click on the button to view a complete list of all error codes.