vatcheckapi-js
v0.1.1
Published
Node.js client for the vatcheckapi.com API (status, check)
Maintainers
Readme
vatcheckapi-js
Node.js client for the vatcheckapi.com API.
- Website:
https://vatcheckapi.com/
This SDK wraps public endpoints and supports authentication via apikey header (default) or apikey query parameter.
Installation
npm install vatcheckapi-js
# or
yarn add vatcheckapi-js
# or
pnpm add vatcheckapi-jsQuickstart
import VatcheckApiClient from 'vatcheckapi-js';
const client = new VatcheckApiClient({ apiKey: process.env.VATCHECK_API_KEY });
// Check a VAT number
const res = await client.check({ vat_number: 'DE123456789' });
console.log(res);
// Get API status/quota
const status = await client.status();
console.log(status);Authentication
You can pass your API key via an apikey HTTP header (default) or as a query parameter.
// Header-based (default)
const client = new VatcheckApiClient({ apiKey: 'your_api_key' });
// Query-param based
const clientQueryAuth = new VatcheckApiClient({ apiKey: 'your_api_key', authInQuery: true });API
All methods return parsed JSON. Errors throw with error.status and error.details.
check(params)- Example:
{ vat_number: 'DE123456789' } - See docs for more options:
https://vatcheckapi.com/docs/
- Example:
status()- Retrieves API availability and quota information.
Configuration
const client = new VatcheckApiClient({
apiKey: 'your_api_key',
baseUrl: 'https://api.vatcheckapi.com/v2',
authInQuery: false,
headerName: 'apikey',
timeoutMs: 10_000,
defaultHeaders: { 'X-App': 'my-app' }
});License
MIT
