taxvett
v0.1.0
Published
Official TaxVett API client for Node.js and TypeScript
Maintainers
Readme
taxvett
Official TaxVett API client for Node.js and TypeScript.
Note: Not yet published to npm.
Install
npm install taxvettQuick start
import { TaxVett } from 'taxvett'
const client = new TaxVett({ apiKey: 'your-api-key' })
const result = await client.validate('SE556565458501', 'SE')
console.log(result.valid, result.company_name)Methods
validate(number, country?)
Validate a single tax number.
const result = await client.validate('GB123456789')
// result: ValidateResponsevalidateBatch(numbers)
Validate multiple tax numbers in one request.
const { results, count } = await client.validateBatch([
{ number: 'SE556565458501', country: 'SE' },
{ number: 'GB123456789' },
])getStats()
Retrieve usage statistics for your API key.
const stats = await client.getStats()
console.log(stats.total_requests)
console.log(stats.requests_by_country)Error handling
Non-2xx responses throw a TaxVettError with status and body properties.
import { TaxVett, TaxVettError } from 'taxvett'
try {
await client.validate('INVALID')
} catch (error) {
if (error instanceof TaxVettError) {
console.error(`API error ${error.status}:`, error.body)
}
}Requirements
- Node.js 18+ (uses native
fetch) - TypeScript 5+ (optional but recommended)
License
MIT
