@docuseal/api

中文文档
1.0.25发布于 2026/08/24MITTypeScriptESM + CJS零依赖近 30 天下载 13.8万

JavaScript / TypeScript library for the DocuSeal API

原始使用文档
文档目录31 节
  1. Documentation
  2. Requirements
  3. Installation
  4. Usage
  5. Configuration
  6. API Methods
  7. listSubmissions(params)
  8. getSubmission(id)
  9. getSubmissionDocuments(id)
  10. createSubmission(data)
  11. createSubmissionFromPdf(data)
  12. createSubmissionFromDocx(data)
  13. createSubmissionFromHtml(data)
  14. updateSubmission(id, data)
  15. archiveSubmission(id)
  16. listSubmitters(params)
  17. getSubmitter(id)
  18. updateSubmitter(id, data)
  19. listTemplates(params)
  20. getTemplate(id)
  21. createTemplateFromPdf(data)
  22. createTemplateFromDocx(data)
  23. createTemplateFromHtml(data)
  24. cloneTemplate(id, data)
  25. mergeTemplates(data)
  26. updateTemplate(id, data)
  27. updateTemplateDocuments(id, data)
  28. archiveTemplate(id)
  29. Configuring Timeouts
  30. Support
  31. License

DocuSeal JavaScript / Typescript

The DocuSeal JavaScript / Typescript library provides seamless integration with the DocuSeal API, allowing developers to interact with DocuSeal's electronic signature and document management features directly within JS/TS applications. This library is designed to simplify API interactions and provide tools for efficient implementation.

Documentation

Detailed documentation is available at DocuSeal API Docs.

Requirements

Node 14 or higher.

Installation

To install the library, run:

npm install @docuseal/api

or:

yarn add @docuseal/api

Usage

Configuration

Set up the library with your DocuSeal API key based on your deployment. Retrieve your API key from the appropriate location:

Global Cloud

API keys for the global cloud can be obtained from your Global DocuSeal Console.

const docuseal = require("@docuseal/api");

docuseal.configure({ key: "your_api_key_here" });

Or initiate a new api client object:

const { DocusealApi } = require("@docuseal/api");

const docuseal = new DocusealApi({ key: "your_api_key_here" });

EU Cloud

API keys for the EU cloud can be obtained from your EU DocuSeal Console.

const docuseal = require("@docuseal/api");

docuseal.configure({
  key: "your_api_key_here",
  url: "https://api.docuseal.eu"
});

On-Premises

For on-premises installations, API keys can be retrieved from the API settings page of your deployed application, e.g., https://yourdocusealapp.com/settings/api.

const docuseal = require("@docuseal/api");

docuseal.configure({
  key: "your_api_key_here",
  url: "https://yourdocusealapp.com/api"
});

API Methods

listSubmissions(params)

Documentation

Provides the ability to retrieve a list of available submissions.

const { data, pagination } = await docuseal.listSubmissions({ limit: 10 });

getSubmission(id)

Documentation

Provides the functionality to retrieve information about a submission.

const submission = await docuseal.getSubmission(1001);

getSubmissionDocuments(id)

Documentation

This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned.

const submission = await docuseal.getSubmissionDocuments(1001);

createSubmission(data)

Documentation

This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).

Related Guides:
Send documents for signature via API Pre-fill PDF document form fields with API

const submission = await docuseal.createSubmission({
  template_id: 1000001,
  send_email: true,
  submitters: [
    {
      role: "First Party",
      email: "[email protected]"
    }
  ]
});

createSubmissionFromPdf(data)

Documentation

Provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using fields param.

Related Guides:
Use embedded text field tags to create a fillable form

const submission = await docuseal.createSubmissionFromPdf({
  name: "Test Submission Document",
  documents: [
    {
      name: "string",
      file: "base64",
      fields: [
        {
          name: "string",
          areas: [
            {
              x: 0,
              y: 0,
              w: 0,
              h: 0,
              page: 1
            }
          ]
        }
      ]
    }
  ],
  submitters: [
    {
      role: "First Party",
      email: "[email protected]"
    }
  ]
});

createSubmissionFromDocx(data)

Documentation

Provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and lists. You can also use the {{signature}} field syntax to define fillable fields, as in a PDF.

Related Guides:
Use dynamic content variables in DOCX to create personalized documents

const submission = await docuseal.createSubmissionFromDocx({
  name: "Test Submission Document",
  variables: {
    variable_name: "value"
  },
  documents: [
    {
      name: "string",
      file: "base64"
    }
  ],
  submitters: [
    {
      role: "First Party",
      email: "[email protected]"
    }
  ]
});

createSubmissionFromHtml(data)

Documentation

This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.

Related Guides:
Create PDF document fillable form with HTML

const submission = await docuseal.createSubmissionFromHtml({
  name: "Test Submission Document",
  documents: [
    {
      name: "Test Document",
      html: `<p>Lorem Ipsum is simply dummy text of the
<text-field
  name="Industry"
  role="First Party"
  required="false"
  style="width: 80px; height: 16px; display: inline-block; margin-bottom: -4px">
</text-field>
and typesetting industry</p>
`
    }
  ],
  submitters: [
    {
      role: "First Party",
      email: "[email protected]"
    }
  ]
});

updateSubmission(id, data)

Documentation

Allows you to update a submission: change its name, expiration date, and archive or unarchive it.

const submission = await docuseal.updateSubmission(1001, {
  name: "New Submission Name",
  expire_at: "2024-09-01 12:00:00 UTC",
  archived: true
});

archiveSubmission(id)

Documentation

Allows you to archive a submission.

await docuseal.archiveSubmission(1001);

listSubmitters(params)

Documentation

Provides the ability to retrieve a list of submitters.

const { data, pagination } = await docuseal.listSubmitters({ limit: 10 });

getSubmitter(id)

Documentation

Provides functionality to retrieve information about a submitter, along with the submitter documents and field values.

const submitter = await docuseal.getSubmitter(500001);

updateSubmitter(id, data)

Documentation

Allows you to update submitter details, pre-fill or update field values and re-send emails.

Related Guides:
Automatically sign documents via API

const submitter = await docuseal.updateSubmitter(500001, {
  email: "[email protected]",
  fields: [
    {
      name: "First Name",
      default_value: "Acme"
    }
  ]
});

listTemplates(params)

Documentation

Provides the ability to retrieve a list of available document templates.

const { data, pagination } = await docuseal.listTemplates({ limit: 10 });

getTemplate(id)

Documentation

Provides the functionality to retrieve information about a document template.

const template = await docuseal.getTemplate(1000001);

createTemplateFromPdf(data)

Documentation

Provides the functionality to create a fillable document template for a PDF file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using fields param.

Related Guides:
Use embedded text field tags to create a fillable form

const template = await docuseal.createTemplateFromPdf({
  name: "Test PDF",
  documents: [
    {
      name: "string",
      file: "base64",
      fields: [
        {
          name: "string",
          areas: [
            {
              x: 0,
              y: 0,
              w: 0,
              h: 0,
              page: 1
            }
          ]
        }
      ]
    }
  ]
});

createTemplateFromDocx(data)

Documentation

Provides the functionality to create a fillable document template for an existing Microsoft Word document. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.docx for more text tag formats. Or specify the exact pixel coordinates of the document fields using fields param.

Related Guides:
Use embedded text field tags to create a fillable form

const template = await docuseal.createTemplateFromDocx({
  name: "Test DOCX",
  documents: [
    {
      name: "string",
      file: "base64"
    }
  ]
});

createTemplateFromHtml(data)

Documentation

Provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.

Related Guides:
Create PDF document fillable form with HTML

const template = await docuseal.createTemplateFromHtml({
  html: `<p>Lorem Ipsum is simply dummy text of the
<text-field
  name="Industry"
  role="First Party"
  required="false"
  style="width: 80px; height: 16px; display: inline-block; margin-bottom: -4px">
</text-field>
and typesetting industry</p>
`,
  name: "Test Template"
});

cloneTemplate(id, data)

Documentation

Allows you to clone an existing template into a new template.

const template = await docuseal.cloneTemplate(1000001, {
  name: "Cloned Template"
});

mergeTemplates(data)

Documentation

Allows you to merge multiple templates with documents and fields into a new combined template.

const template = await docuseal.mergeTemplates({
  template_ids: [
    321,
    432
  ],
  name: "Merged Template"
});

updateTemplate(id, data)

Documentation

Provides the functionality to move a document template to a different folder and update the name of the template.

const template = await docuseal.updateTemplate(1000001, {
  name: "New Document Name",
  folder_name: "New Folder"
});

updateTemplateDocuments(id, data)

Documentation

Allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content.

const template = await docuseal.updateTemplateDocuments(1000001, {
  documents: [
    {
      file: "string"
    }
  ]
});

archiveTemplate(id)

Documentation

Allows you to archive a document template.

await docuseal.archiveTemplate(1000001);

Configuring Timeouts

Set timeouts to avoid hanging requests:

const { DocusealApi } = require('@docuseal/api')

const docuseal = new DocusealApi({
  key: 'your_api_key_here',
  openTimeout: 30000
});

Support

For feature requests or bug reports, visit our GitHub Issues page.

License

The library is available as open source under the terms of the MIT License.

版本与发布记录

@docuseal/api 共发布 24 个版本,首次发布于 2024/12/28;过去 12 个月发布了 5 个版本。

版本发布日期距今
1.0.25latest2026/08/242 个月前
1.0.242026/07/173 个月前
1.0.232026/05/136 个月前
1.0.222026/04/027 个月前
1.0.212025/12/0911 个月前
1.0.202025/09/151.2 年前

关于 @docuseal/api 的常见问题

@docuseal/api 是什么?

JavaScript / TypeScript library for the DocuSeal API

如何安装 @docuseal/api?

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

@docuseal/api 支持 TypeScript 吗?

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

@docuseal/api 支持 ESM 还是 CommonJS?

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

@docuseal/api 可以商用吗?

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

@docuseal/api 的下载量有多少?

根据 npm 官方下载统计,@docuseal/api 在 2026/10/13 – 2026/11/11 这 30 天内被下载 137,956 次,日均约 4,599 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@docuseal/api 还在维护吗?

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