Skip to content

JavaScript

SeaTable provides a JavaScript API that works in two contexts: inside SeaTable as a script, or externally via Node.js or a frontend application. Many methods exist in both contexts, but the two are not identical -- most notably, columns can only be created or modified from an external client. Every method that is limited to one context carries a marker on the respective page.

Script vs. External Client

Script in SeaTable External client
Installation None npm install seatable-api
Authentication Not needed (user is already logged in) API token required
Execution In the browser Node.js or frontend app
await required Only for query() and getLinkedRecords() For all calls
Exclusive features Context, Output, Utilities, Filter/QuerySet Constants
Column management Read only Full (create, modify, delete)

Context markers

Methods that are not available in both contexts are marked in the reference pages:

Marker Meaning
Available only in scripts inside SeaTable. Calling it from an external client returns undefined.
Available only in the external seatable-api client. Calling it in a SeaTable script returns undefined.

Methods without a marker work in both contexts.

Installation

npm install seatable-api

Not needed for scripts inside SeaTable.

Authentication

External programs need an API token for authentication. API tokens can be generated in the SeaTable web interface. Scripts inside SeaTable require no authentication.

import { Base } from "seatable-api";

const base = new Base({
  server: "https://cloud.seatable.io",
  APIToken: "your-api-token",
});
await base.auth();

Async Operations

External API calls are asynchronous and return promises. Use await to wait for the result.

In scripting context, most methods are synchronous. The exceptions are query() and getLinkedRecords(), which also require await.

API Limits

JavaScript calls are subject to rate and size limits. Use batch operations (batchAppendRows, batchUpdateRows, batchDeleteRows) whenever possible to reduce the number of API calls.

Looking for examples?

Step-by-step JavaScript script examples are available in the SeaTable User Manual.