Node.js SDK
The official Taxu Node.js library provides convenient access to the Taxu API from applications written in server-side JavaScript and TypeScript.
What is the Taxu Node.js SDK?
The Taxu Node.js SDK is a production-ready library that enables developers to integrate tax filing, compliance, and financial management capabilities directly into their Node.js applications. Built with modern async/await patterns and full TypeScript support, it provides a seamless developer experience for building tax and finance products.
Whether you're building a payroll platform, managing contractor payments with 1099 forms, or calculating tax obligations, the Node.js SDK handles the complexity of tax regulations, e-filing protocols, and IRS requirements so you can focus on your core product.
Perfect For:
- • SaaS platforms handling contractor payments
- • Payroll and HR systems
- • Accounting and bookkeeping software
- • Marketplace and gig economy platforms
Key Capabilities:
- • IRS-compliant tax form filing (W-2, 1099, W-9)
- • Real-time tax calculations
- • Document extraction and validation
- • Automated compliance monitoring
Installation
Install the package with your preferred package manager:
npm install taxuyarn add taxupnpm add taxuRequirements: Node.js 14.0.0 or higher
Authentication
Initialize the library with your API key. You can find your API keys in your dashboard.
const Taxu = require('taxu');
const taxu = new Taxu('your_api_key_here');
Security: Never commit your API keys to version control. Use environment variables instead.
Basic Usage
Here's a quick example of filing a Form 1099-NEC:
const filing = await taxu.tax.file1099NEC(({
taxYear: 2024,
payer: {
name: 'Acme Corp',
ein: '12-3456789',
address: '123 Business St',
},
recipient: {
name: 'John Contractor',
ssn: '123-45-6789',
address: '456 Worker Ave',
},
nonEmployeeCompensation: 15000
});
console.log(filing.id); // fil_1234567890
TypeScript Support
The library includes TypeScript definitions for all API methods and responses:
import Taxu from 'taxu';
import type { Filing, TaxCalculation } from 'taxu';
const taxu = new Taxu(process.env.TAXU_API_KEY);
const calculation: TaxCalculation = await taxu.tax.calculate(({
income: 75000,
filingStatus: 'single'
});
Full Type Safety
Complete TypeScript definitions for all API endpoints and responses
IntelliSense Support
Auto-completion and inline documentation in VS Code and other IDEs
More Examples
Calculate Federal Tax
const result = await taxu.tax.calculate(({
income: 85000,
filingStatus: 'married_filing_jointly',
deductions: {
standard: true
}
});
// Result:
// { taxLiability: 7488, effectiveRate: 8.8 }
Upload & Extract W-2
const fs = require('fs');
const document = await taxu.documents.upload(({
file: fs.createReadStream('./w2.pdf'),
type: 'w2'
});
// Wait for processing
const extracted = await taxu.documents.retrieve(document.id);
console.log(extracted.data.wages); // 75000
Error Handling
The SDK throws specific error types for different failure scenarios:
try {
const filing = await taxu.tax.file1099(data);
} catch (error) {
if (error instanceof Taxu.errors.TaxuAuthenticationError) {
// Invalid API key
} else if (error instanceof Taxu.errors.TaxuValidationError) {
// Invalid parameters
} else if (error instanceof Taxu.errors.TaxuRateLimitError) {
// Too many requests
}
}
TaxuAuthenticationErrorInvalid API key or authentication failure
TaxuValidationErrorInvalid request parameters or missing required fields
TaxuRateLimitErrorAPI rate limit exceeded
TaxuAPIErrorGeneral API error or server-side issue