QR Code Generator

QR Code Generator

Data Generator Image Generator Credits / request: 5

Generates QR codes containing text, URL, e-mail, phone number, SMS, Geo, vCard or Wi-Fi information.

POST https://api.apikodu.com/api/v1/qrcodegenerator
Documentation
Overview

Generates a QR code and returns a download URL.

Authentication

Every request requires the x-api-key header. Credits used and remaining quota are returned in response headers (x-api-credits-used, x-api-remaining-credits, x-rate-limit-*).

Request
POST https://api.apikodu.com/api/v1/qrcodegenerator
JSON body. Extra fields depend on type (url, text, email, wifi, vcard ...).
Parameters
Name Type Required Default Options Description
type integer * Required — 1=text 2=url 3=email 4=phone 5=sms 6=geo 7=wifi 8=vcard QR content type.
url / text / ... string * Required — — Primary content field depends on type. Example: url is required when type=2.
encryption string Optional png png webp jpeg svg Output format.
size integer Optional 200 — Edge size in pixels. 50–2048.
foregroundcolor string Optional #000000 — Foreground color (hex). JSON field: foregroundColor.
backgroundcolor string Optional #FFFFFF — Background color (hex). JSON field: backgroundColor.
usemargin boolean Optional false true false Quiet zone margin. JSON field: useMargin.
iconbase64 string Optional — — Center icon (base64). Playground sends a file. JSON: iconBase64.
iconsizepercent integer Optional 20 — Icon size percent. 1–50. JSON: iconSizePercent.
iconborderwidth integer Optional 5 — Icon border width. JSON: iconBorderWidth.
Response
Name Type Description
downloadUrl string Signed download URL (X-Amz-Expires). Becomes invalid after expires.
type string Generated content type. Example: Url, Text, Wifi, Vcard.
format string File format: png, webp, jpeg or svg.
correction string QR error-correction level. L / M / Q / H. Default M.
expires number Unix epoch expiry of the download URL (seconds).
Errors
HTTP code Description
400 -187 JSON body is missing.
400 -195 Unsupported type. Must be 1–8 (text, url, email, phone, sms, geo, wifi, vcard).
400 -189 type=1 (text) and text is empty.
400 -190 type=2 (url) and url is invalid.
400 -191 type=3 (email) and the email is invalid.
400 -192 type=4/5 (phone/sms) and phone is empty.
400 -193 type=7 (wifi) SSID empty, or type=8 (vcard) firstName empty.
400 -202 iconBase64 could not be decoded or is an unsupported image.
500 -196 Generated QR could not be stored.
500 -197 Download URL could not be created.
401 -100 x-api-key is missing, empty, malformed, inactive, banned, expired, IP-restricted, or not allowed for this API.
429 -221 Per-minute request limit exceeded. Response headers: x-rate-limit-limit, x-rate-limit-remaining, x-rate-limit-reset.
429 — Package credit quota cannot cover this request. Body may be { error, limit, currentUsage, requestCost } (no code field).
500 -1 Unexpected server error. message is a generic error text without technical details.
Notes
  • Success body is { data: { ... } }. Error body is { code, message }. code is an ApiResponseCode enum value (negative integer).

Sample response

{
  "data": {
    "downloadUrl": "https://files.erseapi.com/images/sample/output.png?X-Amz-Expires=86400",
    "type": "Url",
    "format": "png",
    "correction": "M",
    "expires": 1771891200
  }
}

Code samples

  
      const response = await fetch('https://api.apikodu.com/api/v1/qrcodegenerator', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'x-api-key': 'YOUR_API_KEY'
        },
        body: JSON.stringify({
          name: 'example',
          value: 123
        })
      });

      const data = await response.json();
      console.log(data);
  
  
      import requests

      headers = {
          'Content-Type': 'application/json',
          'x-api-key': 'YOUR_API_KEY'
      }

      payload = {
          'name': 'example',
          'value': 123
      }

      response = requests.post('https://api.apikodu.com/api/v1/qrcodegenerator', headers=headers, json=payload)
      data = response.json()
      print(data)
  
  
      using var client = new HttpClient();
      client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");

      var payload = new { name = "example", value = 123 };
      var json = JsonSerializer.Serialize(payload);
      var content = new StringContent(json, Encoding.UTF8, "application/json");

      var response = await client.PostAsync("https://api.apikodu.com/api/v1/qrcodegenerator", content);
      response.EnsureSuccessStatusCode();

      var data = await response.Content.ReadAsStringAsync();
      Console.WriteLine(data);
  
 
     $data = [
         'name' => 'example',
         'value' => 123
     ];

     $response = file_get_contents('https://api.apikodu.com/api/v1/qrcodegenerator', false, stream_context_create([
         'http' => [
             'header' => "x-api-key: YOUR_API_KEY"
         ],
         'method'  => 'POST',"
         'content' => json_encode($data)
      ]));

      print_r(json_decode($response, true));
 
  
      curl -X POST 'https://api.apikodu.com/api/v1/qrcodegenerator' \
        -H 'Content-Type: application/json' \
        -H 'x-api-key: YOUR_API_KEY' \
        -d '{
          "name": "example",
          "value": 123
        }'
  

Start building in minutes

Create a free account, get your API key and send your first request in minutes.

Get started free