{"id":50735404,"url":"https://github.com/wyre-technology/node-kaseya-vsa","last_synced_at":"2026-06-10T13:01:23.606Z","repository":{"id":359174082,"uuid":"1225847115","full_name":"wyre-technology/node-kaseya-vsa","owner":"wyre-technology","description":"Comprehensive Node.js/TypeScript client library for the Kaseya VSA REST API","archived":false,"fork":false,"pushed_at":"2026-06-09T01:59:12.000Z","size":457,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-09T03:21:09.315Z","etag":null,"topics":["api-client","kaseya","msp","rmm","sdk","typescript","vsa"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wyre-technology.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-30T17:49:36.000Z","updated_at":"2026-06-09T01:56:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wyre-technology/node-kaseya-vsa","commit_stats":null,"previous_names":["wyre-technology/node-kaseya-vsa"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wyre-technology/node-kaseya-vsa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyre-technology%2Fnode-kaseya-vsa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyre-technology%2Fnode-kaseya-vsa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyre-technology%2Fnode-kaseya-vsa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyre-technology%2Fnode-kaseya-vsa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wyre-technology","download_url":"https://codeload.github.com/wyre-technology/node-kaseya-vsa/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyre-technology%2Fnode-kaseya-vsa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34153483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","kaseya","msp","rmm","sdk","typescript","vsa"],"created_at":"2026-06-10T13:01:22.762Z","updated_at":"2026-06-10T13:01:23.598Z","avatar_url":"https://github.com/wyre-technology.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @wyre-technology/node-kaseya-vsa\n\nComprehensive, fully-typed Node.js / TypeScript client library for the\nKaseya VSA REST API.\n\n[![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n\n## Features\n\n- Full coverage of core VSA resources: agents, audit, patches, procedures, alarms, tickets, organizations, machine groups\n- Two authentication modes: legacy local users (two-step token exchange) **and** Kaseya One SSO\n- Automatic token caching with single-flight refresh on 401\n- OData pagination via async iterators (`$top`, `$skip`, `$filter`, `$orderby`)\n- Token-bucket rate limiting tuned for VSA's defensive defaults\n- Typed error hierarchy including `KaseyaVsaApplicationError` for HTTP 200 + non-zero `ResponseCode`\n- ESM and CommonJS dual exports, full `.d.ts` types\n- Zero `any` in the public API\n\n## Install\n\n```bash\nnpm install @wyre-technology/node-kaseya-vsa\n```\n\nThe package is published to GitHub Packages under the `@wyre-technology` scope.\nAdd this to a project-local `.npmrc`:\n\n```\n@wyre-technology:registry=https://npm.pkg.github.com\n```\n\n## Quick start\n\nVSA is per-tenant: each MSP has a private base URL such as\n`https://vsa.example-msp.com/api/v1.0`. **There is no shared default**; you must\nprovide the `baseUrl`.\n\n```typescript\nimport { KaseyaVsaClient } from '@wyre-technology/node-kaseya-vsa';\n\n// Local user (legacy) auth\nconst client = new KaseyaVsaClient({\n  baseUrl: 'https://vsa.example-msp.com/api/v1.0',\n  username: process.env.VSA_USER!,\n  password: process.env.VSA_PASS!,\n});\n\n// Or Kaseya One SSO\nconst ssoClient = new KaseyaVsaClient({\n  baseUrl: 'https://vsa.example-msp.com',\n  kaseyaOneToken: process.env.KASEYA_ONE_TOKEN!,\n});\n\n// Iterate every agent, fetching pages on demand\nfor await (const agent of client.agents.listAll({ top: 500 })) {\n  console.log(agent.AgentId, agent.ComputerName);\n}\n```\n\n## Authentication\n\n### Legacy / local users — two-step token exchange\n\nThe SDK builds the `Authorization: Basic` header automatically:\n\n1. Generate a 20-character random nonce.\n2. Compute `SHA-256( SHA-256(password+username) + nonce )` → `pass2`.\n3. Compute `SHA-1( SHA-1(password+username) + nonce )` → `pass1`.\n4. Send `Basic user=\u003cu\u003e,pass2=\u003csha256\u003e,pass1=\u003csha1\u003e,rand2=\u003cnonce\u003e` to `GET /auth`.\n5. Use the returned `Result.Token` as `Authorization: Bearer \u003ctoken\u003e` on every subsequent call.\n\n### Kaseya One SSO\n\nWhen a `kaseyaOneToken` is provided, the SDK uses `GET /auth/sso` with that\ntoken as a bearer. The response shape and refresh behavior are identical.\n\n### Token lifecycle\n\n- Tokens default to ~15-minute lifetime (`Token-Expires-In` is honored if returned).\n- Refreshes happen ~5 minutes before expiry.\n- On 401 from any non-auth call, the SDK invalidates the cache, **single-flights**\n  the re-auth (so concurrent in-flight requests share one refresh), and retries\n  the original request once.\n\n## Pagination\n\nVSA list endpoints use OData `$top` / `$skip`:\n\n| Param      | Default | Max    |\n|------------|---------|--------|\n| `$top`     | 100     | 1000   |\n| `$skip`    | 0       | —      |\n| `$filter`  | none    | —      |\n| `$orderby` | none    | —      |\n\nBoth single-page and async-iterator helpers are exposed:\n\n```typescript\n// Single page\nconst page = await client.agents.list({ top: 100 });\n\n// Auto-paging iterator\nfor await (const agent of client.agents.listAll({ filter: \"Online eq true\" })) {\n  // ...\n}\n```\n\n## API surface\n\n```typescript\nclient.agents.list({ top, skip, filter, orderby })\nclient.agents.listAll(params)\nclient.agents.get(agentId)\n\nclient.audit.listSoftware(agentId)\nclient.audit.getHardware(agentId)\n\nclient.patches.getStatus(agentId)\nclient.patches.deployNow(agentId)\n\nclient.procedures.list(agentId)\nclient.procedures.runNow(agentId, procId)\n\nclient.alarms.list({ filter: \"AlarmState eq 'Open'\" })\nclient.alarms.listAll(params)\n\nclient.tickets.list(params)        // 404s if Service Desk module disabled\nclient.tickets.listAll(params)\nclient.tickets.get(ticketId)\n\nclient.organizations.list(params)\nclient.machineGroups.list(params)\n```\n\n## Error handling\n\nThe SDK never lets the raw VSA envelope leak to the caller; it unwraps to the\n`Result` field automatically and throws `KaseyaVsaApplicationError` when the\nenvelope reports failure (`ResponseCode != 0` or non-null `Error`) on an\notherwise-successful HTTP 200.\n\n```typescript\nimport {\n  KaseyaVsaError,\n  KaseyaVsaAuthenticationError,\n  KaseyaVsaApplicationError,\n  KaseyaVsaForbiddenError,\n  KaseyaVsaNotFoundError,\n  KaseyaVsaRateLimitError,\n  KaseyaVsaServerError,\n} from '@wyre-technology/node-kaseya-vsa';\n\ntry {\n  await client.agents.get('123');\n} catch (err) {\n  if (err instanceof KaseyaVsaRateLimitError) {\n    await new Promise((r) =\u003e setTimeout(r, err.retryAfter));\n  } else if (err instanceof KaseyaVsaApplicationError) {\n    console.error('VSA app error', err.responseCode, err.response);\n  } else {\n    throw err;\n  }\n}\n```\n\n## Known gotchas\n\n- **Trailing slashes.** VSA redirects `/api/v1.0/agents` → `/agents/` (HTTP 301),\n  and Node's `fetch` strips the `Authorization` header on cross-origin redirect.\n  The SDK normalizes every path to its trailing-slash form before sending so the\n  redirect never fires.\n- **Concurrent token refresh.** Multiple in-flight requests racing on a 401\n  would each try to re-auth. The SDK wraps re-auth in a single-flight mutex.\n- **Tenant URL forms.** Both `https://vsa.example.com` and\n  `https://vsa.example.com/api/v1.0` are accepted and normalized.\n- **HTTP 200 + `ResponseCode != 0`.** Treated as a business-logic failure and\n  raised as `KaseyaVsaApplicationError` with VSA's `Error` field as the message.\n- **Service Desk 404.** When the SD module is not enabled on the tenant, ticket\n  endpoints return 404. The SDK surfaces this as a friendly\n  `KaseyaVsaNotFoundError` mentioning the SD module.\n\n## Development\n\n```bash\nnpm install\nnpm test\nnpm run typecheck\nnpm run lint\nnpm run build\n```\n\n## License\n\nApache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyre-technology%2Fnode-kaseya-vsa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwyre-technology%2Fnode-kaseya-vsa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyre-technology%2Fnode-kaseya-vsa/lists"}