@docstudio/api-client

中文文档
168.21.0发布于 2026/11/01MITTypeScriptESM + CJS

DocStudio API client

原始使用文档
文档目录7 节
  1. Requirements
  2. Installation
  3. Getting started
  4. Authentication
  5. Binary responses
  6. Releasing
  7. License

DocStudio API client for Node.js

TypeScript client for the DocStudio API, generated from the server's OpenAPI document with openapi-generator (typescript-axios).

  • API version: R168.21
    • Generator version: 7.24.0
  • Build package: org.openapitools.codegen.languages.TypeScriptAxiosClientCodegen

Requirements

package.json and the tsconfigs are hand-maintained; the generator's copies are discarded.

Node.js 18 or later. axios is the only runtime dependency; the package ships CommonJS and ES module builds plus TypeScript declarations.

Installation

npm install @docstudio/api-client

Getting started

import {
    AuthenticationControllerApi,
    MailboxControllerApi,
    Configuration,
} from '@docstudio/api-client';

const basePath = 'https://api.docstudio.com';

const auth = new AuthenticationControllerApi(new Configuration({ basePath }));
const { data: session } = await auth.login({ login: email, password });

const config = new Configuration({ basePath, accessToken: session.token });
const mailboxes = new MailboxControllerApi(config);

const { data } = await mailboxes.getAllForUser();

Most endpoints are scoped to a mailbox and take its UUID as the mailbox argument, which the client sends as the Mailbox header.

Authentication

Set exactly one credential per Configuration.

// user API - bearer token
new Configuration({ basePath, accessToken: token });

// form API - form token, with the prefix included in the value
new Configuration({ basePath, apiKey: `Form ${formToken}` });

Both credentials travel in the Authorization header. A handful of endpoints accept either; if both are set the form token is applied last and wins, which is why a Configuration should carry only one.

Binary responses

Endpoints that return a file resolve to an ArrayBuffer. The client sets responseType for them, because axios would otherwise decode the body as UTF-8 text and corrupt it. Note the generated signature says File - that is the generator's label for a binary body, not the runtime type.

const { data } = await envelopes.downloadFinalPdf(id, documentId, mailbox);
await writeFile('envelope.pdf', Buffer.from(data as unknown as ArrayBuffer));

Releasing

This package is generated from the DocStudio OpenAPI document; the API version above is the API release it was generated from. Releases are cut by the DocStudio team from internal tooling.

License

MIT

版本与发布记录

@docstudio/api-client 共发布 3 个版本,首次发布于 2026/10/28;过去 12 个月发布了 3 个版本。

版本发布日期距今
168.21.0latest2026/11/012 天前
168.18.02026/10/286 天前
0.0.0-stage2026/10/286 天前

关于 @docstudio/api-client 的常见问题

@docstudio/api-client 是什么?

DocStudio API客户端

如何安装 @docstudio/api-client?

在项目目录运行 npm install @docstudio/api-client,或使用 pnpm add / yarn add / bun add。

@docstudio/api-client 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@docstudio/api-client 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@docstudio/api-client 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@docstudio/api-client 可以商用吗?

@docstudio/api-client 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@docstudio/api-client 还在维护吗?

最新版本 168.21.0 发布于 2026/11/01(2 天前);至今共发布 3 个版本,其中过去 12 个月发布了 3 个;首次发布于 2026/10/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。