Skip to main content

Official SDKs

Speed up your development with our official SDKs and libraries.

Installation

JavaScript/Node.js

npm install @scanova/api-client
import { ScanovaAPI } from '@scanova/api-client';

const scanova = new ScanovaAPI('YOUR_API_KEY');

// Create a QR code
const qrCode = await scanova.qrCodes.create({
  name: 'My QR Code',
  category: '1',
  qr_type: 'dy',
  info: {
    type: 'url',
    data: { url: 'https://scanova.io' }
  }
});

Python

pip install scanova-api-client
from scanova import ScanovaAPI

scanova = ScanovaAPI('YOUR_API_KEY')

# Create a QR code
qr_code = scanova.qr_codes.create(
    name='My QR Code',
    category='1',
    qr_type='dy',
    info={
        'type': 'url',
        'data': {'url': 'https://scanova.io'}
    }
)

PHP

composer require scanova/api-client
<?php
require_once 'vendor/autoload.php';

use Scanova\API\ScanovaAPI;

$scanova = new ScanovaAPI('YOUR_API_KEY');

// Create a QR code
$qrCode = $scanova->qrCodes->create([
    'name' => 'My QR Code',
    'category' => '1',
    'qr_type' => 'dy',
    'info' => [
        'type' => 'url',
        'data' => ['url' => 'https://scanova.io']
    ]
]);

Community Libraries

Webhooks

Set up real-time notifications for QR code events.
// Express.js webhook handler
app.post('/webhook', express.raw({type: 'application/json'}), (req, res) => {
  const signature = req.headers['x-scanova-signature'];
  const payload = req.body;
  
  // Verify webhook signature
  if (scanova.webhooks.verify(payload, signature)) {
    const event = JSON.parse(payload);
    
    switch (event.type) {
      case 'qr_code.scanned':
        console.log('QR code scanned:', event.data);
        break;
      case 'qr_code.created':
        console.log('QR code created:', event.data);
        break;
    }
  }
  
  res.status(200).send('OK');
});

Rate Limits

The Scanova API has the following rate limits:
  • Free Plan: 100 requests per minute
  • Pro Plan: 1,000 requests per minute
  • Enterprise Plan: 10,000 requests per minute
Rate limit headers are included in all API responses:
  • X-RateLimit-Limit: Maximum requests per minute
  • X-RateLimit-Remaining: Remaining requests in current window
  • X-RateLimit-Reset: Time when the rate limit resets

Best Practices

Error Handling

try {
  const qrCode = await scanova.qrCodes.create(data);
} catch (error) {
  if (error.status === 401) {
    console.error('Invalid API key');
  } else if (error.status === 429) {
    console.error('Rate limit exceeded');
  } else {
    console.error('API error:', error.message);
  }
}

Retry Logic

async function createQRCodeWithRetry(data, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await scanova.qrCodes.create(data);
    } catch (error) {
      if (error.status === 429 && i < maxRetries - 1) {
        // Wait before retrying
        await new Promise(resolve => setTimeout(resolve, 1000 * (i + 1)));
        continue;
      }
      throw error;
    }
  }
}

Testing

Sandbox Environment

Use our sandbox environment for testing:
const scanova = new ScanovaAPI('YOUR_SANDBOX_API_KEY', {
  baseURL: 'https://sandbox.scanova.io'
});

Mock Responses

For unit testing, you can mock API responses:
// Jest example
jest.mock('@scanova/api-client');

const mockCreate = jest.fn().mockResolvedValue({
  id: 123,
  qrid: 'Qr123456789',
  name: 'Test QR Code'
});

ScanovaAPI.prototype.qrCodes = { create: mockCreate };

Support