Skip to main content

Open API, Automation & Calendars

Customer API & webhooks

TypeScript SDK (@tenantoffice/sdk) & Tenant Office

Developers building custom property websites, internal BI pipelines, or event-driven automations can skip boilerplate fetch wrappers with `@tenantoffice/sdk`. Built with zero third-party runtime dependencies on standard Web Fetch and Web Crypto APIs, the SDK provides typed `properties.listAll()` async cursor pagination, automatic `429` `Retry-After` backoff retries, constant-time `verifyTenantOfficeWebhook` HMAC-SHA256 verification, and built-in iCal (`.ics`) and MITS 4.1 XML feed helpers.

Estimated setup time
10–15 minutes
Required role
Developer or operations engineer
Connection method
Customer API & webhooks

Setup path: Zero-dependency TypeScript/JavaScript client connecting directly to Tenant Office’s v1 Customer API, signed webhooks, iCal feeds, and MITS 4.1 XML feed using an administrator-issued bearer credential.

What connects

What flows between TypeScript SDK (@tenantoffice/sdk) and Tenant Office.

  • Typed async cursor iteration across `GET /api/v1/customer/properties` via `client.properties.listAll()`
  • Automatic HTTP `429` `Retry-After` backoff and bounded retry handling across rate-limited batch jobs
  • Constant-time HMAC-SHA256 webhook signature and timestamp replay verification via `verifyTenantOfficeWebhook`
  • Built-in fetch helpers for RFC 5545 `.ics` calendar feeds and MITS 4.1 `GET /api/v1/customer/listings.xml`

Before you start

Prerequisites for setting up TypeScript SDK (@tenantoffice/sdk).

Confirm these items before starting so your setup completes cleanly in 10–15 minutes.

  • Node.js 20+ (or any modern runtime with standard `fetch` and Web Crypto support — zero third-party runtime dependencies).
  • An administrator-issued, property-scoped Tenant Office Customer API bearer credential.
  • Your Tenant Office API base URL and, if verifying webhooks, your subscription signing secret.

Step-by-step tutorial

4 steps to set up TypeScript SDK (@tenantoffice/sdk).

Follow these steps as an developer or operations engineer to configure and test your TypeScript SDK (@tenantoffice/sdk) workflow.

  1. Issue a property-scoped API credential

    Have an organization administrator create a read-only Customer API bearer credential scoped to the exact properties your application needs.

  2. Initialize the zero-dependency SDK client

    Configure `createTenantOfficeClient` with your Tenant Office API base URL and bearer credential loaded from your server’s environment variables.

  3. Iterate properties or fetch syndication feeds

    Use `for await (const property of client.properties.listAll())` to paginate automatically with built-in `429` `Retry-After` backoff, or call the MITS XML and iCal helpers.

  4. Verify inbound webhooks over raw bytes

    Pass the unparsed raw request body, headers, and signing secret into `verifyTenantOfficeWebhook` before processing any event payload.

End-to-end example workflow

How property teams run TypeScript SDK (@tenantoffice/sdk) day to day

A developer maintaining a property management company’s custom marketing site installs `@tenantoffice/sdk` into a nightly Next.js revalidation worker. Using `client.properties.listAll()` and the MITS 4.1 XML feed helper with built-in `429` `Retry-After` backoff, the worker syncs current vacant-ready units to the company website, while a companion webhook route uses `verifyTenantOfficeWebhook` to authenticate signed test and operational notifications in five lines of TypeScript.

Field mapping & reference

Exact fields, endpoints, and data mapping.

Reference how Tenant Office records, headers, or API endpoints align with TypeScript SDK (@tenantoffice/sdk) before running your first live workflow.

Tenant Office field / endpointTypeScript SDK (@tenantoffice/sdk) field / targetMapping notes
createTenantOfficeClient({ baseUrl, bearerCredential })Zero-dependency TypeScript SDK clientAttaches bearer auth headers, parses typed v1 envelopes, and enforces explicit request timeouts.
client.properties.listAll()Async iterator over GET /api/v1/customer/propertiesAutomatically follows `nextCursor` pagination without loading unbounded pages blindly into memory.
Automatic HTTP 429 retry handlerHonors Retry-After header with bounded backoffSmoothly absorbs 60 req/60s rate limits during scheduled batch reads without crashing jobs.
verifyTenantOfficeWebhook(rawBody, headers, secret)Constant-time HMAC-SHA256 + timestamp replay guardValidates webhook authenticity over raw bytes and rejects replayed payloads outside the tolerance window.
iCal (.ics) & MITS 4.1 XML feed helpersTyped fetchers for calendar & GET /api/v1/customer/listings.xmlLets web and automation apps pull RFC 5545 schedules and MITS 4.1 vacant-ready listings from one client.

Verification & troubleshooting

How to verify TypeScript SDK (@tenantoffice/sdk) is working.

Run through these checks after completing setup to confirm clean delivery, scoping, and audit trails.

  • Instantiate the SDK client with your credential in a local script and iterate `client.properties.listAll()` to confirm expected property and unit counts.
  • Pass a captured `webhook.test` raw request body and headers into `verifyTenantOfficeWebhook` and confirm it returns valid.
  • Mutate one byte of the test payload and confirm `verifyTenantOfficeWebhook` rejects it.
  • Fetch the MITS 4.1 XML feed or `.ics` schedule helper and confirm clean UTF-8 output with expected headers.

Common issues & fixes

Quick symptom, cause, and resolution guidance for the edge cases property teams encounter most often with TypeScript SDK (@tenantoffice/sdk).

  • TypeScript reports missing `fetch` or `crypto.subtle` in an older runtime.

    Likely cause
    The zero-dependency SDK targets standard Web APIs built into Node.js 20+, Deno, Bun, and modern edge runtimes.
    How to fix
    Upgrade the runtime to Node.js 20 LTS or newer, or pass a custom `fetch` implementation into the client options.
  • `verifyTenantOfficeWebhook` throws an invalid signature error inside Express or Next.js.

    Likely cause
    The route handler parsed `req.json()` before verification instead of reading `await req.text()` / raw Buffer bytes.
    How to fix
    Read the unmodified raw request body first, verify the signature with `verifyTenantOfficeWebhook`, and only then call `JSON.parse()`.
  • SDK calls fail immediately with HTTP 401.

    Likely cause
    The credential was revoked, expired, or copied with trailing whitespace in your environment variable.
    How to fix
    Trim whitespace in your environment config or have an organization administrator issue a fresh scoped credential.

Questions (6)

TypeScript SDK (@tenantoffice/sdk) FAQ

Detailed answers covering workflow scope, role permissions, pricing, edge cases, and data ownership.

What runtime dependencies does @tenantoffice/sdk require?

Zero. The SDK relies solely on standard Web `fetch` and Web Crypto APIs built into Node.js 20+, Deno, Bun, and modern edge runtimes, keeping your supply chain minimal.

How does `properties.listAll()` handle large portfolios and HTTP 429 limits?

`properties.listAll()` returns an async iterator that follows `nextCursor` automatically across pages, and the client honors `429` `Retry-After` headers with bounded exponential backoff so scheduled sync jobs finish cleanly.

Why must `verifyTenantOfficeWebhook` receive the raw request body?

HMAC-SHA256 signatures are computed over the exact transmitted bytes. Parsing and re-stringifying JSON changes whitespace or key order and causes legitimate signatures to fail verification.

Does using @tenantoffice/sdk require an enterprise API plan?

No. Both the Customer API and `@tenantoffice/sdk` work on Tenant Office’s standard operations package without an enterprise API surcharge.

Can @tenantoffice/sdk write ledger entries or update leases?

No. In v1, customer objects are strictly read-only over authorized properties and units, with write helpers limited to managing your credential’s own webhook subscriptions, test events, and controlled replays.

What happens if we rotate or revoke the credential used by the SDK?

Revocation takes effect immediately on the next request (returning a typed `401` authentication error), allowing clean zero-downtime key rotation by issuing a new credential before revoking the old one.