TypeScript Client

TypeScript SDK for NextRows Open API

The @wordbricks/nextrows-client package provides a fully typed TypeScript client for the NextRows Open API.

Getting Started

API Key

Create your API key in the NextRows dashboard: NextRows Dashboard → Create API Key

Keep your API key secure. Never expose it in client-side code or public repositories.

Documentation

For complete API details, visit the NextRows API Docs.

Installation

npm
npm install @wordbricks/nextrows-client
yarn
yarn add @wordbricks/nextrows-client
pnpm
pnpm add @wordbricks/nextrows-client
bun
bun add @wordbricks/nextrows-client

Quick Start

import { Nextrows } from "@wordbricks/nextrows-client";

const client = new Nextrows({ apiKey: "sk-nr-your-api-key" });

API Methods

Extract Data

Extract structured data from URLs or text content.

const result = await client.extract({
  type: "url",
  data: ["https://example.com/products"],
  prompt: "Extract all product names and prices",
});

if (result.success) {
  console.log(result.data);
}

Using Zod Schema

Use Zod schemas to define the output structure (requires Zod 3.24+).

import { z } from "zod/v4";

const productSchema = z.array(
  z.object({
    name: z.string(),
    price: z.number(),
  })
);

const result = await client.extract({
  type: "url",
  data: ["https://example.com/products"],
  schema: productSchema,
});

Run App (JSON)

Run a published NextRows app and receive JSON output.

const result = await client.runAppJson({
  appId: "abc123xyz",
  inputs: [
    { key: "url", value: "https://example.com/products" },
    { key: "maxItems", value: 10 },
  ],
});

if (result.success && result.data) {
  console.log("Columns:", result.data.columns);
  console.log("Rows:", result.data.rows);
  console.log(`Run ID: ${result.runId}`);
  console.log(`Elapsed time: ${result.elapsedTime}ms`);
}

Typed App Output (Zod Schema Copy)

You can copy the Zod schema for an app's output item directly from the app page: https://nextrows.com/app/[appId].

import { z } from "zod/v4";

const itemSchema = z.object({
  managerFund: z.string(),
  updated: z.string(),
  holdingsUrl: z.string(),
  managerCode: z.string(),
  sourceUrl: z.string(),
});

type Item = z.infer<typeof itemSchema>;

const result = await client.runAppJson<Item>({
  appId: "appid",
  inputs: [],
});

Get Credits

Check your current credit balance.

const result = await client.getCredits();

if (result.success && result.data) {
  console.log(`Remaining credits: ${result.data.credits}`);
}

Configuration

const client = new Nextrows({
  apiKey: "sk-nr-your-api-key",
  baseUrl: "https://api.nextrows.com",
  timeout: 30000,
});

Features

  • Fully Typed: All request and response types are exported for TypeScript support
  • Simple API: Easy-to-use methods that mirror the REST API
  • Configurable: Custom base URL and timeout options
  • Zod Support: Use Zod schemas for type-safe extraction (optional, requires Zod 3.24+)

On this page