2D

QR Code Generator API

"The simplest QR code generator API designed to generate 2D QR Codes. Qr code data are important for products inventory, shipment tracking, and storing important information."

About 2D QR Code

A 2D QR (Quick Response) code is a type of two-dimensional barcode that can encode a variety of data types, including text, URLs, contact information, and more. QR codes are similar to traditional 1D barcodes, but they can store much more information in a smaller space, and they can be read using a smartphone or other mobile device.

QR codes were first developed in Japan by Denso Wave, a subsidiary of Toyota, in 1994. They were originally designed for tracking parts in vehicle manufacturing, but have since become popular in a wide range of applications, such as marketing, payment systems, and authentication.

QR codes can store various types of data, including text, URLs, contact information, and even entire files. To read a QR code, you need a QR code scanner app on your smartphone or other mobile device. Once the app is open, you simply point your device's camera at the QR code, and the app will read the code and display the encoded data.

QR Code API Features

QR codes have become increasingly popular in recent years, as they can be used to quickly and easily share information and URLs, as well as for marketing and advertising purposes. For example, a QR code could be printed on a product label or in a magazine ad, and users could scan the code to access more information or to visit a website. This QR code generator API popular for QR code use in mobile tagging, personal information, URLs, phone numbers, vCard, Wifi sharing, and data sharing. QR Codes can contain large amounts of information in a small space. Following are some features:

  • Capable of containing virtually any data desired.
  • Popular for its use in mobile tagging and data sharing.
  • Can contain large amounts of data and can be spread throughout multiple barcodes.
  • Micro and Standard versions can be used to vary the size of the qrcode.

Your API Authentication Key

We use API keys to authenticate all the requests. You can view and manage your API keys in the My Account -> My APIs Center page. Your API keys can be used to access our all the APIs, So be sure to keep them secure. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

                                                    
                                                        XXXX-XXXX-XXXX-XXXX (login to see your free API Key) 
                                                    
                                                
Signup and activate free trial plan to try our APIs. See Trial Plan.

API Base URL and Endpoints

The API Base URL serves as the foundation or root of the API's endpoints. It represents the common prefix shared by all API endpoints. An Endpoint URL represents a specific operation or resource provided by the API. It is appended to the API Base URL to form a complete URL for a particular API call.


Base URL:

                                                
                                                    https://zerosack.org/marketplace/apis/v1 
                                                
                                            

Endpoint for QR Code Generator:

                                                
                                                    POST /qrcode 
                                                
                                            

API Request Method POST

This API use POST HTTP method to get data from our server. All API requests must be made over HTTPS ("S" stands for secure). Calls made over plain HTTP or without authentication key will not allowed.

Request Parameters

An API endpoint is a URL (Uniform Resource Locator) that is used to access a specific resource on a web server. API endpoints are the URLs that clients use to interact with a web API, and they typically consist of a base URL followed by a path that identifies a specific resource or action.

For QR code request

Parameter Description
key
required
This is your authentication api key to get requested data from our servers. This is mandatory parameter otherwise data request will be failed. Go to API Key.
qr_type
required
This is barcode type. You can see the corresponding values of qr_type from this supported qrcode datatype list.
qr_data
required
QR code posted data / information which you want to convert into QR code. You can see the corresponding format of qr_data for particular QR code type from this supported data format list.
ecl
optional
This parameter used to set the Error Correction Level of QR code. The value should be from (L, M, Q, H). Default value is M.
size
optional
This parameter used to set the matrix points size of QR code. The value range should be from (1 - 10). Default value is 4.
frame_margin
optional
This parameter used to set the outer frame margin from generated QR code. The value range should be from (1 - 100) pixels. Default value is 2.
file_type
optional
This parameter used to set image format of qrcode. The value should be in (png, jpg). Default value is png.

Example Post Data Request (in Json format)

                                                    
                                                    {
    "key": "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)",
    "qr_type": "1",
    "qr_data": {
        "tel": "+918888888888"
    }
} 
                                                    
                                                

Response Format

API response format refers to the format in which data is returned from an API endpoint after a request is made. We use JSON format for API response data. JSON (JavaScript Object Notation): JSON is a lightweight data interchange format that is easy to read and write. It is widely used for API response data because it is easy to parse and manipulate in many programming languages.

QR Code Example Response

QR code response data in JSON format with base64 image and svg image string. You can store them into your database or use them directly into your project.

                                                    
                                                        {
                                                            "status": 1,
                                                            "status_message": "success",
                                                            "body": {
                                                                "base64_image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQMAAABKLAcXAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAl0lEQVQ4jb2Tuw3EMAxDtQH335IbMBIT5HKdmCKCAfm5oL6u+tokkcVxEXEOaRfRiIB2MfEdAS+oD1iPGnbkLvGvZyuqU+lhO1JnXLqjrwkUGvqxIlJfCaGuGtaEMXoPEpqceyTS2es1WWnEfp1akccB6MplTd6Cia2QvAQg7t+xp54Lz6lkNLVCzGgeRiYkb7l/VUX0rR18IkJTuY4/xQAAAABJRU5ErkJggg==",
                                                                "svg_image": "<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" viewBox="-4 -4 29 29" width="600" height="600" id="qrcode-0109b1d55b543d029bf10b77232076e9">
                                                                <symbol id="tracker"><path d="m 0 7 0 7 7 0 0 -7 -7 0 z m 1 1 5 0 0 5 -5 0 0 -5 z m 1 1 0 3 3 0 0 -3 -3 0 z" style="fill:#000000;stroke:none"></path></symbol>
                                                                <use x="0" y="-7" xlink:href="#tracker"></use>
                                                                <use x="0" y="7" xlink:href="#tracker"></use>
                                                                <use x="14" y="-7" xlink:href="#tracker"></use>
                                                                <path d="M12,0 h1v5h-2v-1h1v-1h-1v-1h1v-2 M9,4 h1v1h1v2h-1v-1h-1v-2 M0,8 h2v1h1v1h1v2h-1v-1h-1v1h-1v1h-1v-3h1v-1h-1v-1 M3,8 h2v1h1v1h-2v-1h-1v-1 M14,8 h1v1h1v2h-1v-1h-1v-2 M7,9 h3v1h-1v1h-1v-1h-1v-1 M12,9 h1v1h1v1h-1v2h-3v-1h1v-2h1v-1 M17,9 h2v1h2v1h-2v1h-1v-2h-1v-1 M7,11 h1v1h1v1h1v1h-2v-1h-2v-1h1v-1 M17,16 h1v1h1v1h2v2h-2v1h-3v-1h-1v1h-1v-1h-1v1h-2v-1h-2v1h-1v-2h2v-1h1v-1h2v-1h-2v1h-1v-1h-1v-1h2v-1h1v1h1v-1h1v-3h1v1h1v-1h1v1h1v2h-1v2 M17,19 v1h1v-1h-1 M16,13 v1h1v-1h-1 M14,15 v1h1v2h-1v1h3v-3h-1v-1h-2 M12,18 v2h1v-2h-1 M8,0 v1h1v-1h-1 M10,1 v1h1v-1h-1 M10,3 v1h1v-1h-1 M12,6 v1h1v-1h-1 M6,8 v1h1v-1h-1 M20,8 v1h1v-1h-1 M6,10 v1h1v-1h-1 M5,11 v1h1v-1h-1 M9,11 v1h1v-1h-1 M2,12 v1h1v-1h-1 M20,12 v1h1v-1h-1 M20,16 v1h1v-1h-1 M8,6 h1v2h-1v-2 M10,8 h2v1h-2v-1 M18,14 h1v1h1v1h-2z M8,16 h1v1h1v1h-2z" style="fill:#000000;stroke:none"></path></svg>"
                                                            }
                                                        } 
                                                    
                                                

In this response base64_image and svg_image qrcode image data request response received successfully. In this case your APIs credit call/request count as 1, Otherwise in fail condition or any other condition you will receive "status": 0, In this case API credit calls/request count as 0.

Sample Code

You can use our api with any programming language as well which can handle http GET requests. Here are some sample code snippets for making a GET request to an API endpoint in multiple programming languages:

JavaScript PHP Python C#
                                                            
                                                                
                                                                    var myHeaders = new Headers();
                                                                    myHeaders.append("Content-Type", "application/json");

                                                                    var postData = JSON.stringify({
                                                                        "key": "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)",
                                                                        "qr_type": "1",
                                                                        "qr_data": {
                                                                            "tel": "+918888888888"
                                                                        }
                                                                    });

                                                                    var requestOptions = {
                                                                        method: "POST",
                                                                        headers: myHeaders,
                                                                        body: postData
                                                                    };

                                                                    fetch("https://zerosack.org/marketplace/apis/v1/qrcode", requestOptions)
                                                                    .then(response => response.json())
                                                                    .then(result => console.log(result))
                                                                    .catch(error => console.log("error", error));
                                                                 
                                                            
                                                        
                                                            
                                                                
                                                                    $curl = curl_init();

                                                                    $postData = json_encode(
                                                                        [
                                                                            "key" => "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)", 
                                                                            "qr_type" => "1", 
                                                                            "qr_data" => [
                                                                                  "tel" => "+918888888888" 
                                                                               ] 
                                                                         ]
                                                                    );
                                                                    
                                                                    curl_setopt_array($curl, array(
                                                                    CURLOPT_URL => "https://zerosack.org/marketplace/apis/v1/qrcode",
                                                                    CURLOPT_RETURNTRANSFER => true,
                                                                    CURLOPT_CUSTOMREQUEST => "POST",
                                                                    CURLOPT_POSTFIELDS => $postData,
                                                                    CURLOPT_HTTPHEADER => array("Content-Type: application/json"),
                                                                    ));
                                                                    
                                                                    $response = curl_exec($curl);
                                                                    
                                                                    curl_close($curl);
                                                                    echo $response;
                                                                 
                                                            
                                                        
                                                            
                                                                
                                                                    import requests
                                                                    import json
                                                                    
                                                                    url = "https://zerosack.org/marketplace/apis/v1/qrcode"
                                                                    
                                                                    payload = json.dumps({
                                                                        "key": "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)",
                                                                        "qr_type": "1",
                                                                        "qr_data": {
                                                                            "tel": "+918888888888"
                                                                        }
                                                                    })
                                                                    
                                                                    headers = {"Content-Type": "application/json"}
                                                                    
                                                                    response = requests.request("POST", url, headers=headers, data=payload)
                                                                    
                                                                    print(response.text)
                                                                 
                                                            
                                                        
                                                            
                                                                
                                                                    var client = new HttpClient();
                                                                    var request = new HttpRequestMessage(HttpMethod.Post, "https://zerosack.org/marketplace/apis/v1/qrcode");
                                                                    request.Headers.Add("Cookie", "PHPSESSID=st6pbm0imcng6n3k8ju6pvg3j3");
                                                                    var content = new StringContent("{\r\n    \"key\": \"XXXX-XXXX-XXXX-XXXX (login to see your free API Key)\",\r\n    \"qr_type\": \"1\",\r\n    \"qr_data\": {\r\n        \"tel\": \"+918888888888\"\r\n    }}", null, "application/json");
                                                                    request.Content = content;
                                                                    var response = await client.SendAsync(request);
                                                                    response.EnsureSuccessStatusCode();
                                                                    Console.WriteLine(await response.Content.ReadAsStringAsync());                                                                                                                                
                                                                 
                                                            
                                                        

Also you can use Postman platform which enables you to create mock servers to assist with API development and testing. A mock server simulates the behavior of a real API server by accepting requests and returning responses. By adding a mock server to your collection and adding examples to your requests, you can simulate the behavior of a real API.

Do you Need Help? Contact us.

Disclaimers: This APIs is provided "as is" without warranty of any kind. If you have issue / feedback / bug report regarding the same, You can reach out to us.

QR Code Types & Data Format Close

This is the list of supported QR code types and their posted JSON data format for this API.

QR Code Type qr_type Value qr_data Format
Telephone 1
                                                    
                                                        {
                                                            "tel": "+918888888888"
                                                        }
                                                    
                                                
  • please note Mobile number with country code. eg: if country code is +91 and mobile number is 8888888888, then type +918888888888
SMS 2
                                                    
                                                        {
                                                            "sms": "+918888888888"
                                                        }
                                                    
                                                
  • please note Mobile number with country code. eg: if country code is +91 and mobile number is 8888888888, then type +918888888888
Email 3
                                                    
                                                        {
                                                            "email": "test@example.com"
                                                        }
                                                    
                                                
Extended Email 4
                                                    
                                                        {
                                                            "email": "test@example.com",
                                                            "subject": "this is email subject.",
                                                            "body": "this is email body content."
                                                        }
                                                    
                                                
Wifi 5
                                                    
                                                        {
                                                            "type": "WPA", 
                                                            "ssd": "Wifi Name",
                                                            "password": "123456",
                                                            "hidden": "false"
                                                        }
                                                    
                                                
  • type Wifi security network protocol values (WEP | WPA | blank)
  • hidden Is this Wifi hidden network values (true | false)
Website URL 6
                                                    
                                                        {
                                                            "url": "http://example.com"
                                                        }
                                                    
                                                
WhatsApp

(For Chat, Voice Call, and Video Call)

7
                                                    
                                                        {
                                                            "whatapp_number": "918888888888",
                                                            "welcome_text": "Hi, How are you"
                                                        }
                                                    
                                                
  • welcome_text Include country code without + symbol. Eg. if country code is +91 and WhatsApp number is 9000012345, then type 919000012345.
  • whatapp_number Automatically include this text when a user clicks/scan your WhatsApp QR code, making it easy to start a conversation.
Simple vCard 8
                                                    
                                                        {
                                                            "name": "John Deo",
                                                            "phone_number": "+918888888888"
                                                        }
                                                    
                                                
  • phone_number this could be mobile number or landline number.
Extended vCard 9
                                                    
                                                        {
                                                            "name": "John Deo",
                                                            "title": "CEO",
                                                            "mobile_number": "+918888888888",
                                                            "phone_number_home": "+918888888888",
                                                            "phone_number_work": "+918888888888",
                                                            "email": "john@example.com",
                                                            "website": "http://example.com",
                                                            "company": "Google inc.",
                                                            "address": {
                                                                "street": "60 Wall Street",
                                                                "city": "New York City",
                                                                "state": "New York",
                                                                "postal_code": "10005",
                                                                "country": "United States"
                                                            },
                                                            "note": "any note upto 500 characters"
                                                        }
                                                    
                                                
Raw Data / Text 10
                                                    
                                                        {
                                                            "text": "any text string"
                                                        }