Skip to content
Navigation
View as Markdown

TypeScript SDK

The SDK is a fully typed client over the REST API: every method, input, and output below is derived from the same contract that defines the API itself.

npm install thinkbench
import { createThinkBench } from "thinkbench";

const tb = createThinkBench({ apiKey: process.env.THINKBENCH_API_KEY! });

const { item, markdown } = await tb.documents.read({
  documentId: "<documentId>",
});

Configuration

Option Description
apiKey Required. An API key from Settings → API keys.
agent (optional) Names the software making requests so its edits are attributed to it. Unnecessary for agent keys, which already carry one.
baseUrl (optional) Defaults to https://app.thinkbench.com/api/v1.

Behavior

  • Payloads are plain JSON over the wire, so timestamps arrive as ISO strings.
  • Failed calls throw an ORPCError carrying the API's error envelope — there are no silent empty results.

Methods

Method Summary
tb.documents.read(input) Read a ThinkBench document and return its current content as Markdown.
tb.driveItems.sharedWithMe(input) List items shared directly with the user via share grants.
tb.driveItems.get(input) Read a drive item with its drive, children, visible ancestors, and shares.
tb.driveItems.rename(input) Rename a drive item.
tb.driveItems.move(input) Move an item to another folder or drive.
tb.driveItems.createChild(input) Create a folder or document inside a folder.
tb.driveItems.shareSuggestions(input) Organization members who could be given access to this item.
tb.driveItems.share(input) Grant a person access to an item by email.
tb.driveItems.updateShare(input) Change an existing share grant's permission.
tb.driveItems.removeShare(input) Revoke a share grant.
tb.driveItems.setPublication(input) Publish or unpublish a document to the web.
tb.drives.list(input) List every drive the user can access, each with its items and members.
tb.drives.create(input) Create a shared drive in the active organization.
tb.drives.rename(input) Rename a drive.
tb.drives.createItem(input) Create a folder or document at the drive's root.
tb.drives.upsertMember(input) Add an organization member to a shared drive or change their role.
tb.drives.removeMember(input) Remove a member from a shared drive.