autotask-node
v1.0.0
Published
Feature-complete NodeJS client for Kaseya Autotask PSA REST API with TypeScript support, comprehensive testing, and CLI tools.
Downloads
67
Maintainers
Readme
Autotask API Wrapper
A comprehensive TypeScript/Node.js client library for the Autotask REST API with optimized testing infrastructure.
Features
- Full CRUD for all Autotask REST API entities (Tickets, Accounts, Projects, Contracts, etc.)
- Automatic API zone detection (no region configuration needed)
- Filtering, sorting, pagination, batch operations
- Programmatic metadata for AI/automation
- Observability (Winston)
- Structured errors, debug logs, retry/backoff
- TypeScript typings
- ESM + CJS support
- CLI for npx usage
Installation
npm install autotask-node
# or use npx for CLIUsage (Library)
import { AutotaskClient } from 'autotask-node';
const client = await AutotaskClient.create({
username: '[email protected]',
integrationCode: 'YOUR_INTEGRATION_CODE',
secret: 'YOUR_SECRET',
// API URL is automatically detected
});
const ticket = await client.tickets.create({ title: 'Test', ... });
const contract = await client.contracts.create({ accountId: 123, contractType: 'Service' });Usage (CLI)
# List tickets with status filter
npx autotask-node tickets list '{"status":4}'
# Create a new contract
npx autotask-node contracts create '{"accountId":123,"contractType":"Service"}'
# Get contract by ID
npx autotask-node contracts get 456Environment Variables
AUTOTASK_USERNAME: Your Autotask API usernameAUTOTASK_INTEGRATION_CODE: Your Autotask API integration codeAUTOTASK_SECRET: Your Autotask API secretAUTOTASK_API_URL: (Optional) Override the API URL
The client will automatically detect the correct API zone for your account using your credentials. You do not need to specify a region.
Using .env Files
You can store your environment variables in a .env file:
[email protected]
AUTOTASK_INTEGRATION_CODE=YOUR_INTEGRATION_CODE
AUTOTASK_SECRET=YOUR_SECRETPlace this file:
- In the root of your project when using the library
- In the directory where you run the CLI command
The library will automatically load these variables when the client is created.
Development
- Build:
npm run build
