Skip to content

About

MonitorHQ SDK for JavaScript and TypeScript: Australian company, trust, sole trader and ABN monitoring.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

MonitorHQ SDK for JavaScript and TypeScript

Official TypeScript and JavaScript SDK for the MonitorHQ API: Australian company, trust, sole trader and ABN monitoring. Track ASIC and ABR changes, PPSR registrations, trade marks and licence registers, read entity snapshots and history, and verify webhooks.

Install

npm install monitorhq

Node 18+, Deno, Bun and edge runtimes. No dependencies. TypeScript 5+ for the types.

Quick start

import { MonitorHQ } from 'monitorhq';

const mhq = new MonitorHQ(process.env.MONITORHQ_API_KEY!);

const { data } = await mhq.monitorings.add({ acn: '123 456 789', risk_level: 'standard' });
const entity = await mhq.monitorings.get(data.uuid);
console.log(entity.entity_state?.acn_status, entity.registrations);

What you can monitor

Companies by ACN, and any other entity with an ABN: trusts, sole traders, partnerships and more.

  • ABR: ABN status, GST registration and business names (every entity)
  • ASIC company details: status, addresses and lodged documents (companies)
  • PPSR security interest registrations (ACN, ARBN and ARSN entities, not ABN-only)
  • ASIC insolvency notices (companies)
  • IP Australia trade marks owned by the entity
  • ASIC AFS and credit licences and representatives, and the ACNC charity register

Entities are matched by ABN or ACN, never by name.

Authentication

Use an API token with the abilities you need (read, create, update, delete). Keep it on the server.

new MonitorHQ(apiKey, { baseUrl, timeoutMs: 30_000, maxRetries: 2, maxReportBytes, userAgentSuffix, fetch });

baseUrl must be https (http only for localhost). Redirects are never followed.

Methods

Method Route
account.get() GET /account
subscription.get() GET /subscription
identifiers.check(id) POST /identifier/check
monitorings.list(params), listAll(params) GET /monitorings
monitorings.findByAcn(acn), findByAbn(abn) GET /monitorings?acn=
monitorings.add(params), bulkAdd(entities) POST /monitorings, /monitorings/bulk
monitorings.get(uuid) GET /monitorings/{uuid}
monitorings.history(uuid, params), historyAll(...) GET /monitorings/{uuid}/history
monitorings.update(uuid, { risk_level }) PUT /monitorings/{uuid}
monitorings.stop(uuid) DELETE /monitorings/{uuid}
monitorings.report(uuid, { includeRecent }) GET /monitorings/{uuid}/report (PDF bytes and filename)

Risk level is 'high' | 'standard' | 'low'. add strips spaces from acn and abn.

Pagination

Lists have no total, only links.next. The iterators fetch every page and stop at maxPages (default 1000).

for await (const m of mhq.monitorings.listAll({ risk_level: 'high' })) console.log(m.uuid);
for await (const h of mhq.monitorings.historyAll(uuid, { detected_since: new Date('2026-10-12') })) console.log(h.title);

Errors

All extend MonitorHQError (status, body, code, requestId).

  • AuthenticationError 401, PermissionError 403, NotFoundError 404, ConflictError 409
  • ValidationError 422 with fieldErrors; AlreadyMonitoredError (uuid) and CapacityExceededError extend it
  • RateLimitError 429 with retryAfterSeconds, ServerError 5xx
  • ConnectionError, TimeoutError

Webhooks

Pass the raw request body. A parsed and re-serialised body fails the check.

import express from 'express';
import { constructWebhookEvent, WebhookSignatureError } from 'monitorhq/webhooks';

app.post('/hooks/monitorhq', express.raw({ type: 'application/json' }), async (req, res) => {
  try {
    const event = await constructWebhookEvent(req.body, req.headers['x-monitorhq-signature'], process.env.MONITORHQ_WEBHOOK_SECRET!);
    if (event.event === 'change_detected') event.events.forEach((e) => console.log(e.history_id, e.event_type));
    res.sendStatus(200);
  } catch (e) {
    res.sendStatus(e instanceof WebhookSignatureError ? 400 : 500);
  }
});

verifyWebhookSignature(body, header, secret, { toleranceSeconds, now }) returns a boolean. Tolerance defaults to 300 seconds. Dedupe on delivery_id and each history_id. Unknown event types become other_change.

Retries and limits

The API allows 60 requests a minute per token and 30 for reports. GET and DELETE retry on network errors and 5xx with backoff. POST and PUT never retry on 5xx or timeout. A 429 retries for any method when Retry-After is 30 seconds or less.

Licence

MIT

About

MonitorHQ SDK for JavaScript and TypeScript: Australian company, trust, sole trader and ABN monitoring.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages