Integration / TypeScript

Call Routeser from TypeScript.

The published @routeser/client package is the supported TypeScript surface. It reuses Routeser's shared contracts, authenticates with a tenant API key, and exposes bounded async waiters instead of long-held create requests.

Install

One dependency, shared contracts.

Add the client with npm install @routeser/client. It reuses the same request and response schemas the API validates against, so your types match production behavior.

The package is published to npm: @routeser/client on npm.

extract.tsTypeScript client
import { RouteserClient } from "@routeser/client";

const client = new RouteserClient({
  apiKey: process.env.ROUTESER_API_KEY!,
  baseUrl: process.env.ROUTESER_API_BASE_URL!,
  tenantId: "ten_example123"
});

// Presigned regional upload, job creation, bounded wait.
const { result } = await client.extractFile({
  file,
  idempotencyKey: "invoice-2048",
  input: {
    fileName: "invoice.pdf",
    mediaType: "application/pdf",
    sizeBytes: file.size
  },
  schema: {
    version: "1",
    fields: [
      { name: "invoice_number", type: "string" },
      { name: "vendor_name", type: "string" },
      { name: "total_due", type: "number" }
    ]
  }
});
Auth

Tenant API-key requests

Every Routeser API call is authenticated with your tenant API key. Store the key as a server secret; never ship it to a browser bundle.

Upload

Direct to the region

Upload initiation returns a short-lived regional presigned PUT. The client forwards upload-initiation headers exactly and preserves the object version header so create-job can reference the uploaded bytes.

Waiters

Bounded status polling

Create-job returns quickly. The client's waiters poll job status within bounds rather than holding a request open, matching Routeser's asynchronous contract.

Integration path

From key to validated result.

  1. Provision a tenant API key in the console and load it from server configuration.
  2. Request an upload URL, then PUT your document directly to regional storage.
  3. Create an extraction job with your schema and an idempotency key.
  4. Await the terminal result with a bounded waiter, then validate it against your schema.

Questions, answered plainly

Frequently asked questions

Where is the client published?

The supported TypeScript client is published to npm as @routeser/client and reuses Routeser's shared request and response contracts.

Can I call the API from the browser?

Do not ship a tenant API key to the browser. Call Routeser from a server or trusted backend; browsers may only perform the presigned direct upload.

Does the client hold the create request open?

No. Create-job returns quickly and the client exposes bounded status waiters that poll for the terminal result.

Next step

Get an API key

Open the console to provision a tenant API key and start integrating with the TypeScript client.

Open console