Skip to Content
SDKsTypeScript / JavaScript SDK

TypeScript / JavaScript SDK

Package: @indox/sdk 0.6.0, for both TypeScript and JavaScript.

Warning

Not yet published

npm install @indox/sdk does not resolve yet. See the SDK status table for the current state of every language.

Set up a client

import { Indox } from "@indox/sdk"; const client = new Indox({ apiKey: process.env.INDOX_API_KEY, baseUrl: process.env.INDOX_BASE_URL || "https://indox.org", }); const health = await client.health.commonHealthViewsHealth();

Keep the API key server-side; never ship it to a browser bundle.

client.health, fonts, pdf, pdfAi, docs, media, conversion, images, videos, models, decks, office, audit, notifications and webhooks are ready to use. Every other generated API class takes the same configuration, for example new AuthenticationUserManagementApi(client.config), PaymentsSubscriptionsApi, UserStorageApi, ShareLinksApi, and the BoxIntegrationApi, DropboxIntegrationApi, GoogleDriveIntegrationApi and OneDriveIntegrationApi classes.

Account operations

The six account operations refuse an API key. Build a second client with the sign-in access token in its place:

const account = new Indox({ apiKey: accessToken });

Errors, retries and timeouts

Every status of 400 or above throws an IndoxApiError with status, detail and the parsed body. It subclasses the generated ResponseError, so err.response still works. ScopeError, GoneError and RateLimitError (with retryAfter in seconds) mark the cases in Errors.

Retrying follows the shared policy. Tune it with new Indox({ maxRetries, maxRetryWaitMs, retryBackoffMs }), whose defaults are DEFAULT_MAX_RETRIES, DEFAULT_MAX_RETRY_WAIT_MS and DEFAULT_RETRY_BACKOFF_MS; maxRetries: 0 turns retrying off. timeoutMs (default 60 000) applies to each attempt.

Upgrading from 0.5

The API changes every client inherits are in Upgrading from 0.5. In TypeScript:

  • Signing: call pdf.appsPdfHandlerViewsSigningOtpViewsRequestOtp first, then submit the signature with { otp }.
  • POST /user/me/email-change/ is not in the generated client yet.

Until it ships, call the API directly

const res = await fetch("https://indox.org/api/v1/health/", { headers: { Authorization: `Bearer ${process.env.INDOX_API_KEY}`, Accept: "application/json", }, signal: AbortSignal.timeout(60_000), }); const body = await res.json();

Conversions are asynchronous: POST the job, poll the returned conversion id with GET /api/v1/conversion/{id}/ until it reaches a terminal status, then download the result. A direct call gets no automatic retries, so handle 429 yourself (Rate limits).