Skip to main content
POST
/
qrcode
/
validate-info
/
curl --request POST \
--url https://management.scanova.io/qrcode/validate-info/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form category=1 \
--form 'info={"type":"url","data":{"url":"https://example.com"}}'
"valid"

Purpose

Use this endpoint to validate QR Code data before creation.
It checks that the category and info parameters match expected JSON structure for that QR type (e.g., URL, Social Media, Business Card, etc.).
This helps catch issues like:
  • Missing required fields
  • Invalid URLs
  • Wrong type values
  • Malformed JSON strings

Request Body (Form Data)

FieldTypeRequiredDescriptionExample
categorystringYesQR code category ID1
infostringYesQR code info JSON data{"type":"url","data":{"url":"http://google.com"}}

Examples

Validate Website URL QR Code Data

curl -X POST "https://management.scanova.io/qrcode/validate-info/" \
  -H "Authorization: YOUR_API_KEY" \
  -F "category=1" \
  -F "info={\"type\":\"url\",\"data\":{\"url\":\"https://example.com\"}}"

Validate Social Media QR Code Data

curl -X POST "https://management.scanova.io/qrcode/validate-info/" \
  -H "Authorization: YOUR_API_KEY" \
  -F "category=15" \
  -F "info={\"type\":\"sMedia\",\"data\":{\"facebook\":\"https://facebook.com/example\",\"instagram\":\"https://instagram.com/example\"}}"

Validate Business Card QR Code Data

curl -X POST "https://management.scanova.io/qrcode/validate-info/" \
  -H "Authorization: YOUR_API_KEY" \
  -F "category=24" \
  -F "info={\"type\":\"businessCard\",\"data\":{\"name\":\"John Doe\",\"email\":\"john@example.com\",\"phone\":\"+1234567890\"}}"

Validate Event QR Code Data

curl -X POST "https://management.scanova.io/qrcode/validate-info/" \
  -H "Authorization: YOUR_API_KEY" \
  -F "category=20" \
  -F "info={\"type\":\"event\",\"data\":{\"title\":\"Tech Conference 2025\",\"date\":\"2025-06-15\",\"location\":\"Convention Center\"}}"

Successful Response (200)

If the provided data is valid, the API returns a simple success message:
"valid"
HTTP Status: 200 OK

Error Responses

400 Bad Request — Invalid Data

The info object failed validation.
Common issues include missing fields, invalid type, or incorrect data formats.
Example - Invalid Type Values
{
  "info": [
    "'invalid_type' is not one of ['url', 'email', 'phone', 'text']"
  ]
}
Example - Missing Required Fields
{
  "info": [
    "This field is required."
  ]
}
Example - Invalid URL Format
{
  "info": [
    "Enter a valid URL."
  ]
}
Example - Invalid Email Format
{
  "info": [
    "Enter a valid email address."
  ]
}
Example - Invalid Phone Format
{
  "info": [
    "Enter a valid phone number."
  ]
}

Integration Examples

JavaScript Form Validation

async function validateQRCodeData(category, infoData) {
  try {
    const formData = new FormData();
    formData.append('category', category);
    formData.append('info', JSON.stringify(infoData));
    
    const response = await fetch('https://management.scanova.io/qrcode/validate-info/', {
      method: 'POST',
      headers: {
        'Authorization': 'YOUR_API_KEY'
      },
      body: formData
    });
    
    if (response.ok) {
      const result = await response.text();
      if (result === '"valid"') {
        return { valid: true, message: 'Data is valid' };
      }
    } else {
      const error = await response.json();
      return { valid: false, message: error.info[0] };
    }
  } catch (error) {
    return { valid: false, message: 'Validation failed' };
  }
}

// Usage
const result = await validateQRCodeData(1, {
  type: 'url',
  data: { url: 'https://example.com' }
});

if (result.valid) {
  // Proceed with QR code creation
  console.log('Data is valid, creating QR code...');
} else {
  // Show error to user
  console.error('Validation error:', result.message);
}

Python Validation

import requests
import json

def validate_qr_code_data(category, info_data):
    url = "https://management.scanova.io/qrcode/validate-info/"
    headers = {"Authorization": "YOUR_API_KEY"}
    
    data = {
        'category': str(category),
        'info': json.dumps(info_data)
    }
    
    try:
        response = requests.post(url, headers=headers, data=data)
        
        if response.status_code == 200:
            result = response.text.strip('"')
            if result == 'valid':
                return {"valid": True, "message": "Data is valid"}
        elif response.status_code == 400:
            error_data = response.json()
            return {"valid": False, "message": error_data['info'][0]}
        
        return {"valid": False, "message": "Validation failed"}
        
    except Exception as e:
        return {"valid": False, "message": f"Error: {str(e)}"}

# Usage
result = validate_qr_code_data(1, {
    "type": "url",
    "data": {"url": "https://example.com"}
})

if result["valid"]:
    print("Data is valid, creating QR code...")
else:
    print(f"Validation error: {result['message']}")

PHP Validation

<?php
function validateQRCodeData($category, $infoData) {
    $url = "https://management.scanova.io/qrcode/validate-info/";
    $headers = [
        "Authorization: YOUR_API_KEY"
    ];
    
    $data = [
        'category' => (string)$category,
        'info' => json_encode($infoData)
    ];
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    
    if ($httpCode === 200) {
        $result = trim($response, '"');
        if ($result === 'valid') {
            return ["valid" => true, "message" => "Data is valid"];
        }
    } elseif ($httpCode === 400) {
        $errorData = json_decode($response, true);
        return ["valid" => false, "message" => $errorData['info'][0]];
    }
    
    return ["valid" => false, "message" => "Validation failed"];
}

// Usage
$result = validateQRCodeData(1, [
    "type" => "url",
    "data" => ["url" => "https://example.com"]
]);

if ($result["valid"]) {
    echo "Data is valid, creating QR code...";
} else {
    echo "Validation error: " . $result["message"];
}
?>

Notes & Best Practices

  • Always validate before creating or updating dynamic QR Codes — this ensures error-free QR landing pages.
  • The validation engine mimics internal creation logic, so a passing validation guarantees successful QR creation (if unchanged).
  • Recommended especially when:
    • Building integrations that generate multiple QR codes in bulk
    • Accepting user-provided input through a form or external data source
  • Use this endpoint in your pre-deployment QA pipeline to validate info templates for all categories.

Authorizations

Authorization
string
header
required

API key authentication. Enter your API key directly in the Authorization header.

Body

multipart/form-data
category
string
required

QR code category ID

Example:

"1"

info
string
required

QR code info JSON data

Example:

"{\"type\":\"url\",\"data\":{\"url\":\"http://google.com\"}}"

Response

Valid QR code info data

The response is of type string.

Example:

"valid"