A comprehensive, fully-typed TypeScript/JavaScript client library for the Unitag API v2. Generate, manage, and analyze QR codes with ease.
- ✅ Full TypeScript support with comprehensive type definitions
- ✅ Complete API coverage: QR codes, domains, campaigns, filters, and analytics
- ✅ Modern async/await syntax
- ✅ Custom error handling with specific error types
- ✅ Works in Node.js and browsers
- ✅ Zero dependencies (except dev dependencies)
- ✅ Comprehensive test suite with Vitest
- ✅ Helper utilities for common tasks
- ✅ Production and sandbox environments
npm install unitag-api-clientyarn add unitag-api-clientpnpm add unitag-api-clientimport{UnitagApi}from"unitag-api-client";// Initialize the clientconstapi=newUnitagApi({apiKey: "your-api-key",sandbox: true,// Use sandbox for testing});// Create a QR codeconstqrCode=awaitapi.createQRCode({data: {type: "URL",resolution: "dynamic",url: "https://example.com",label: "My Website",},});console.log("QR Code created:",qrCode.short_url);- Sandbox (Testing): console.sandbox.unitag.io/settings
- Production: console.unitag.io/settings
📚 Full Documentation - Comprehensive guides, API reference, and examples
- Getting Started Guide - Installation and first steps
- Configuration - Client setup and options
- Error Handling - Handling errors properly
- QR Codes API - QR code operations
- Examples - Code examples
constqrCode=awaitapi.createQRCode({data: {type: "URL",resolution: "dynamic",url: "https://example.com",label: "Example",},settings: {layout: {type: "gradient",gradient_type: "vertical",color_one: "#FF0000",color_two: "#0000FF",},},});constresult=awaitapi.getQRCodes({maxRows: 10,page: 1,sortField: "creation_date",sortOrder: "desc",});console.log(`Total: ${result.total_records}`);constblob=awaitapi.downloadQRCode({asset_uuid: "qrcode-uuid",format: "png",size: 500,});constanalytics=awaitapi.getAnalytics({time_range: {type: 1,number: 7,unit: "days",},});console.log(`Visits: ${analytics.visits_count}`);import{UnitagValidationError,UnitagRateLimitError,isUnitagError}from'unitag-api-client';try{constqrCode=awaitapi.createQRCode({...});}catch(error){if(errorinstanceofUnitagValidationError){console.error('Validation failed:',error.details);}elseif(errorinstanceofUnitagRateLimitError){console.error('Rate limit exceeded. Retry after:',error.retryAfter);}elseif(isUnitagError(error)){console.error('Unitag API error:',error.message);}else{console.error('Unexpected error:',error);}}See the Error Handling Guide for comprehensive error handling patterns.
Full TypeScript support with comprehensive type definitions:
import{UnitagApi,CreateQRCodeRequest,QRCodeData,Campaign,AnalyticsResponse}from'unitag-api-client';constapi=newUnitagApi({apiKey: 'your-key'});constqrCode: QRCodeData=awaitapi.createQRCode({...});# Install dependencies
npm install
# Run tests
npm test# Run tests in watch mode
npm run test:watch
# Build the library
npm run build
# Type checking
npm run typecheck
# Lint
npm run lintContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT
- Documentation - Full documentation
- Unitag Official API Docs - Official Unitag API documentation
- Sandbox Console - Test environment
- Production Console - Production environment
For issues related to this library, please open an issue.
For Unitag API support, contact Unitag through your console dashboard.