docuseal-code
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHow References Are Organised
参考文档的组织结构
Reference files live in two subdirectories under :
references/- — Embed UI components (signing forms, template builder). Each file is self-contained — load only the ones matching the user's stack.
references/embed/ - — REST API endpoints and webhooks. One file per endpoint/webhook with parameters, schemas, code examples, and response samples.
references/api/
参考文件存放在下的两个子目录中:
references/- — 嵌入UI组件(签署表单、模板构建器)。每个文件都是独立的,只需加载与用户技术栈匹配的文件即可。
references/embed/ - — REST API端点和Webhooks。每个端点/Webhooks对应一个文件,包含参数、schema、代码示例和响应样本。
references/api/
Embed UI Components
嵌入UI组件
| Component | Tag | Purpose | JWT |
|---|---|---|---|
| Signing Form | | Embed document signing UI into a page | optional |
| Form Builder | | Embed a full template/document builder | required |
Each component ships in four frontend implementations: JavaScript / React / Vue / Angular.
| 组件 | 标签 | 用途 | JWT |
|---|---|---|---|
| 签署表单 | | 将文档签署UI嵌入到页面中 | 可选 |
| 表单构建器 | | 嵌入完整的模板/文档构建器 | 必填 |
每个组件提供四种前端实现:JavaScript / React / Vue / Angular。
Signing Form (<docuseal-form>
)
<docuseal-form>签署表单 (<docuseal-form>
)
<docuseal-form>- JavaScript / HTML → references/embed/signing-form-js.md
- React → references/embed/signing-form-react.md
- Vue → references/embed/signing-form-vue.md
- Angular → references/embed/signing-form-angular.md
- Mobile (Android/iOS/React Native/Flutter via WebView) → references/embed/signing-form-mobile-integration.md
- JavaScript / HTML → references/embed/signing-form-js.md
- React → references/embed/signing-form-react.md
- Vue → references/embed/signing-form-vue.md
- Angular → references/embed/signing-form-angular.md
- 移动端(Android/iOS/React Native/Flutter 通过 WebView)→ references/embed/signing-form-mobile-integration.md
Form Builder (<docuseal-builder>
)
<docuseal-builder>表单构建器 (<docuseal-builder>
)
<docuseal-builder>- JavaScript / HTML → references/embed/form-builder-js.md
- React → references/embed/form-builder-react.md
- Vue → references/embed/form-builder-vue.md
- Angular → references/embed/form-builder-angular.md
After loading the main component reference, follow a link from its section for step-by-step walkthroughs.
## Guides- JavaScript / HTML → references/embed/form-builder-js.md
- React → references/embed/form-builder-react.md
- Vue → references/embed/form-builder-vue.md
- Angular → references/embed/form-builder-angular.md
加载主组件参考文档后,请查看其部分的链接,获取分步教程。
## 指南Cross-cutting
通用配置
- JWT token generation — Form Builder (Node/TypeScript/Ruby/Python/PHP/Java/C#/Go) → references/embed/form-builder-jwt-token.md
- JWT token generation — Signing Form completed/preview mode → references/embed/signing-form-completed-preview-jwt-token.md
- EU Cloud / self-hosted configuration — Signing Form → references/embed/signing-form-hosts.md
host - EU Cloud / self-hosted configuration — Form Builder → references/embed/form-builder-hosts.md
host - Custom CSS theming — Signing Form (dark theme reference) → references/embed/signing-form-custom-css.md
- Custom CSS theming — Form Builder (dark theme reference) → references/embed/form-builder-custom-css.md
- JWT令牌生成 — 表单构建器(Node/TypeScript/Ruby/Python/PHP/Java/C#/Go)→ references/embed/form-builder-jwt-token.md
- JWT令牌生成 — 签署表单(已完成/预览模式)→ references/embed/signing-form-completed-preview-jwt-token.md
- 欧盟云/自托管环境的配置 — 签署表单 → references/embed/signing-form-hosts.md
host - 欧盟云/自托管环境的配置 — 表单构建器 → references/embed/form-builder-hosts.md
host - 自定义CSS主题 — 签署表单(深色主题参考)→ references/embed/signing-form-custom-css.md
- 自定义CSS主题 — 表单构建器(深色主题参考)→ references/embed/form-builder-custom-css.md
Packages
包资源
| Framework | Package | CDN |
|---|---|---|
| JavaScript | — | |
| React | | — |
| Vue | | — |
| Angular | | — |
| React Native | uses | — |
| Flutter | uses | — |
| 框架 | 包 | CDN |
|---|---|---|
| JavaScript | — | |
| React | | — |
| Vue | | — |
| Angular | | — |
| React Native | 使用 | — |
| Flutter | 使用 | — |
Common Embed Mistakes
常见嵌入错误
| # | Mistake | Fix |
|---|---|---|
| 1 | Generating JWT in the browser | JWT must be signed on the backend — the API key must never ship to the client. See form-builder-jwt-token.md / signing-form-completed-preview-jwt-token.md. |
| 2 | Passing the API key as | |
| 3 | Missing | Set |
| 4 | Confusing | |
| 5 | Multi-party template via | Templates with multiple signing parties must be initiated via the |
| 6 | camelCase props in HTML | The web component uses |
| 7 | Expecting a native mobile SDK | None exists. Embed via WebView — see signing-form-mobile-integration.md. |
| 8 | Passing | |
| # | 错误 | 修复方案 |
|---|---|---|
| 1 | 在浏览器中生成JWT | JWT必须在后端签署 — API密钥绝对不能发送到客户端。请查看form-builder-jwt-token.md / signing-form-completed-preview-jwt-token.md。 |
| 2 | 将API密钥作为 | |
| 3 | 欧盟或自托管环境中缺少 | 欧盟云环境设置 |
| 4 | 混淆 | |
| 5 | 通过 | 包含多个签署方的模板必须通过 |
| 6 | 在HTML中使用驼峰式属性 | Web组件使用 |
| 7 | 期望有原生移动SDK | 不存在原生SDK。请通过WebView嵌入 — 查看signing-form-mobile-integration.md。 |
| 8 | 将 | |
REST API
REST API
Authentication
身份验证
All requests require an API key passed in the header:
X-Auth-TokenX-Auth-Token: YOUR_API_KEYGet your API key: https://console.docuseal.com/api
所有请求都需要在请求头中传递API密钥:
X-Auth-TokenX-Auth-Token: YOUR_API_KEY获取API密钥:https://console.docuseal.com/api
Base URLs
基础URL
| Environment | Base URL |
|---|---|
| Global Cloud | |
| EU Cloud | |
| Self-hosted | |
| 环境 | 基础URL |
|---|---|
| 全球云 | |
| 欧盟云 | |
| 自托管 | |
API Client SDKs
API客户端SDK
Official SDK libraries wrap the REST API and handle authentication, request building, and response parsing. Prefer SDKs over raw HTTP when the user's language has one.
| Language | Package | Install |
|---|---|---|
| JavaScript / TypeScript | | |
| Python | | |
| Ruby | | |
| PHP | | |
SDK usage examples are included in each endpoint reference file below (marked with "SDK" in the heading).
官方SDK库封装了REST API,处理身份验证、请求构建和响应解析。如果用户使用的语言有对应的SDK,优先使用SDK而非原生HTTP请求。
| 语言 | 包 | 安装命令 |
|---|---|---|
| JavaScript / TypeScript | | |
| Python | | |
| Ruby | | |
| PHP | | |
SDK使用示例包含在以下每个端点参考文件中(标题中标注“SDK”)。
Endpoints
端点
Templates
- — List all templates
GET /templates - — Get a template
GET /templates/{id} - — Archive a template
DELETE /templates/{id} - — Update a template
PUT /templates/{id} - — Update template documents
PUT /templates/{id}/documents - — Clone a template
POST /templates/{id}/clone - — Create a template from HTML
POST /templates/html - — Create a template from Word DOCX
POST /templates/docx - — Create a template from PDF
POST /templates/pdf - — Merge templates
POST /templates/merge
Submissions
- — List all submissions
GET /submissions - — Get a submission
GET /submissions/{id} - — Get submission documents
GET /submissions/{id}/documents - — Archive a submission
DELETE /submissions/{id} - — Create submissions from emails
POST /submissions/emails - — Create a submission from PDF
POST /submissions/pdf - — Create a submission from DOCX
POST /submissions/docx - — Create a submission from HTML
POST /submissions/html - — Create a submission
POST /submissions
Submitters
- — Get a submitter
GET /submitters/{id} - — Update a submitter
PUT /submitters/{id} - — List all submitters
GET /submitters
模板
- — 列出所有模板
GET /templates - — 获取单个模板
GET /templates/{id} - — 归档模板
DELETE /templates/{id} - — 更新模板
PUT /templates/{id} - — 更新模板文档
PUT /templates/{id}/documents - — 克隆模板
POST /templates/{id}/clone - — 从HTML创建模板
POST /templates/html - — 从Word DOCX创建模板
POST /templates/docx - — 从PDF创建模板
POST /templates/pdf - — 合并模板
POST /templates/merge
提交记录
- — 列出所有提交记录
GET /submissions - — 获取单个提交记录
GET /submissions/{id} - — 获取提交记录文档
GET /submissions/{id}/documents - — 归档提交记录
DELETE /submissions/{id} - — 从邮件创建提交记录
POST /submissions/emails - — 从PDF创建提交记录
POST /submissions/pdf - — 从DOCX创建提交记录
POST /submissions/docx - — 从HTML创建提交记录
POST /submissions/html - — 创建提交记录
POST /submissions
提交者
- — 获取单个提交者
GET /submitters/{id} - — 更新提交者信息
PUT /submitters/{id} - — 列出所有提交者
GET /submitters
Webhooks
Webhooks
- Form Webhook
- Submission Webhook
- Template Webhook
Configure webhook URL: https://console.docuseal.com/webhooks
- 表单Webhook
- 提交记录Webhook
- 模板Webhook
配置Webhook URL:https://console.docuseal.com/webhooks
Common API Patterns
常见API使用模式
- Send a document for signing: create a template (or use existing) → with submitter emails → submitters receive signing links
POST /submissions - Embed signing in your app: create submission with → use returned
send_email: falsewithslug(see Embed UI Components above)<docuseal-form> - Pre-fill and auto-sign: with
POST /submissionsandfields[].default_valuecompleted: true - Track completion: poll or configure webhooks for
GET /submissions/{id}form.completed - Download signed documents: returns PDF URLs
GET /submissions/{id}/documents
- 发送文档进行签署:创建模板(或使用现有模板)→ 通过接口传入提交者邮箱 → 提交者收到签署链接
POST /submissions - 在应用中嵌入签署功能:创建提交记录时设置→ 使用返回的
send_email: false配合slug组件(见上方嵌入UI组件部分)<docuseal-form> - 预填充并自动签署:调用时传入
POST /submissions和fields[].default_value参数completed: true - 跟踪完成状态:轮询接口,或配置
GET /submissions/{id}事件的Webhookform.completed - 下载已签署文档:调用接口获取PDF文件URL
GET /submissions/{id}/documents
Quick Decision Flow
快速决策流程
- Embedding a component? → Signing Form or Form Builder → load from .
references/embed/ - Making API calls? → Check if the user's language has an SDK (JS/TS, Python, Ruby, PHP) and prefer it over raw HTTP. Load the matching endpoint from .
references/api/ - How-to question about embed? Follow links from the component reference's section.
## Guides - Mobile? Load references/embed/signing-form-mobile-integration.md.
- JWT needed? Always for Form Builder — load references/embed/form-builder-jwt-token.md. For Signing Form only when using (preview/completed mode) — load references/embed/signing-form-completed-preview-jwt-token.md.
data-token - Not on ? Load references/embed/signing-form-hosts.md or references/embed/form-builder-hosts.md depending on the component.
docuseal.com - Custom theme? Load references/embed/signing-form-custom-css.md or references/embed/form-builder-custom-css.md depending on the component.
- CLI commands? Load the sibling skill from this same repo.
docuseal-cli
- 需要嵌入组件? → 选择签署表单或表单构建器 → 从目录加载对应文档。
references/embed/ - 需要调用API? → 检查用户使用的语言是否有SDK(JS/TS、Python、Ruby、PHP),优先使用SDK而非原生HTTP请求。从目录加载对应端点文档。
references/api/ - 有嵌入相关的操作问题? 查看组件参考文档中部分的链接。
## 指南 - 移动端集成? 加载references/embed/signing-form-mobile-integration.md文档。
- 需要JWT? 表单构建器始终需要JWT → 加载references/embed/form-builder-jwt-token.md文档。签署表单仅在使用(预览/已完成模式)时需要 → 加载references/embed/signing-form-completed-preview-jwt-token.md文档。
data-token - 不在环境? 根据使用的组件,加载references/embed/signing-form-hosts.md或references/embed/form-builder-hosts.md文档。
docuseal.com - 需要自定义主题? 根据使用的组件,加载references/embed/signing-form-custom-css.md或references/embed/form-builder-custom-css.md文档。
- 需要CLI命令? 加载同一仓库中的技能文档。
docuseal-cli