网淘吧来吧,欢迎您!

SignNow技能使用说明

2026-03-29 新闻来源:网淘吧 围观:9
电脑广告
手机广告

SignNow

通过托管的 OAuth 认证访问 SignNow API。上传文档、发送签名邀请、管理模板并自动化电子签名工作流。

快速开始

# Get current user info
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/signnow/user')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

基础 URL

https://gateway.maton.ai/signnow/{resource}

网关将请求代理至api.signnow.com并自动注入您的 OAuth 令牌。

认证

所有请求都要求在 Authorization 请求头中包含 Maton API 密钥:

Authorization: Bearer $MATON_API_KEY

环境变量:将您的 API 密钥设置为MATON_API_KEY

export MATON_API_KEY="YOUR_API_KEY"

获取您的 API 密钥

  1. 登录或在maton.ai
  2. 创建账户前往
  3. maton.ai/settings

复制您的 API 密钥

连接管理.

列出连接

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=signnow&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

创建连接

python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'signnow'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

获取连接

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

响应:

{
  "connection": {
    "connection_id": "5ff5474b-5f21-41ba-8bf3-afb33cce5a75",
    "status": "ACTIVE",
    "creation_time": "2026-02-08T20:47:23.019763Z",
    "last_updated_time": "2026-02-08T20:50:32.210896Z",
    "url": "https://connect.maton.ai/?session_token=...",
    "app": "signnow",
    "metadata": {}
  }
}

在浏览器中打开返回的网址以完成 OAuth 授权。

删除连接

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

指定连接

如果您有多个 SignNow 连接,请使用Maton-Connection请求头来指定使用哪一个:

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/signnow/user')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '5ff5474b-5f21-41ba-8bf3-afb33cce5a75')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

如果省略,网关将使用默认(最早创建的)活跃连接。

API 参考

用户操作

获取当前用户

GET /signnow/user

响应:

{
  "id": "59cce130e93a4e9488522ca67e3a6779f3e48a72",
  "first_name": "Chris",
  "last_name": "Kim",
  "active": "1",
  "verified": true,
  "emails": ["chris@example.com"],
  "primary_email": "chris@example.com",
  "document_count": 0,
  "subscriptions": [...],
  "teams": [...],
  "organization": {...}
}

获取用户文档

GET /signnow/user/documents

响应:

[
  {
    "id": "c63a7bc73f03449c987bf0feaa36e96212408352",
    "document_name": "Contract",
    "page_count": "3",
    "created": "1770598603",
    "updated": "1770598603",
    "original_filename": "contract.pdf",
    "owner": "chris@example.com",
    "template": false,
    "roles": [],
    "field_invites": [],
    "signatures": []
  }
]

文档操作

上传文档

文档必须作为包含 PDF 文件的多部分表单数据上传:

python <<'EOF'
import urllib.request, os, json

def encode_multipart_formdata(files):
    boundary = '----WebKitFormBoundary7MA4YWxkTrZu0gW'
    lines = []
    for (key, filename, content) in files:
        lines.append(f'--{boundary}'.encode())
        lines.append(f'Content-Disposition: form-data; name="{key}"; filename="{filename}"'.encode())
        lines.append(b'Content-Type: application/pdf')
        lines.append(b'')
        lines.append(content)
    lines.append(f'--{boundary}--'.encode())
    lines.append(b'')
    body = b'\r\n'.join(lines)
    content_type = f'multipart/form-data; boundary={boundary}'
    return content_type, body

with open('document.pdf', 'rb') as f:
    file_content = f.read()

content_type, body = encode_multipart_formdata([('file', 'document.pdf', file_content)])
req = urllib.request.Request('https://gateway.maton.ai/signnow/document', data=body, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', content_type)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

获取文档

{
  "id": "c63a7bc73f03449c987bf0feaa36e96212408352"
}

响应:

GET /signnow/document/{document_id}

更新文档

{
  "id": "c63a7bc73f03449c987bf0feaa36e96212408352",
  "document_name": "Contract",
  "page_count": "3",
  "created": "1770598603",
  "updated": "1770598603",
  "original_filename": "contract.pdf",
  "owner": "chris@example.com",
  "template": false,
  "roles": [],
  "viewer_roles": [],
  "attachments": [],
  "fields": [],
  "signatures": [],
  "texts": [],
  "checks": []
}

响应:

PUT /signnow/document/{document_id}
Content-Type: application/json

{
  "document_name": "Updated Contract Name"
}

下载文档

{
  "id": "c63a7bc73f03449c987bf0feaa36e96212408352",
  "signatures": [],
  "texts": [],
  "checks": []
}

以二进制数据形式返回PDF文件。

GET /signnow/document/{document_id}/download?type=collapsed

查询参数:

类型

  • - 下载类型:折叠式(扁平化PDF),压缩包(所有页面作为图像)获取文档历史记录

响应:

GET /signnow/document/{document_id}/historyfull

将文档移至文件夹

[
  {
    "unique_id": "c4eb89d84b2b407ba8ec1cf4d25b8b435bcef69d",
    "user_id": "59cce130e93a4e9488522ca67e3a6779f3e48a72",
    "document_id": "c63a7bc73f03449c987bf0feaa36e96212408352",
    "email": "chris@example.com",
    "created": 1770598603,
    "event": "created_document"
  }
]

响应:

POST /signnow/document/{document_id}/move
Content-Type: application/json

{
  "folder_id": "5e2798bdd3d642c3aefebe333bb5b723d6db01a4"
}

合并文档

{
  "result": "success"
}

将多个文档合并为单个PDF:

以二进制数据形式返回合并后的PDF。

POST /signnow/document/merge
Content-Type: application/json

{
  "name": "Merged Document",
  "document_ids": ["doc_id_1", "doc_id_2"]
}

删除文档

响应:

DELETE /signnow/document/{document_id}

模板操作

{
  "status": "success"
}

Template Operations

从文档创建模板

POST /signnow/template
Content-Type: application/json

{
  "document_id": "c63a7bc73f03449c987bf0feaa36e96212408352",
  "document_name": "Contract Template"
}

响应:

{
  "id": "47941baee4f74784bc1d37c25e88836fc38ed501"
}

从模板创建文档

POST /signnow/template/{template_id}/copy
Content-Type: application/json

{
  "document_name": "New Contract from Template"
}

响应:

{
  "id": "08f5f4a2cc1a4d6c8a986adbf90be2308807d4ae",
  "name": "New Contract from Template"
}

签名邀请操作

发送自由格式邀请

发送文档以获取签名:

POST /signnow/document/{document_id}/invite
Content-Type: application/json

{
  "to": "signer@example.com",
  "from": "sender@example.com"
}

响应:

{
  "result": "success",
  "id": "c38a57f08f2e48d98b5de52f75f7b1dd0a074c00",
  "callback_url": "none"
}

注意:自定义主题和消息需要付费订阅计划。

创建签名链接

创建可嵌入的签名链接(需要文档字段):

POST /signnow/link
Content-Type: application/json

{
  "document_id": "c63a7bc73f03449c987bf0feaa36e96212408352"
}

注意:在创建签名链接之前,文档必须已添加签名字段。

文件夹操作

获取所有文件夹

GET /signnow/folder

响应:

{
  "id": "2ea71a3a9d06470d8e5ec0df6122971f47db7706",
  "name": "Root",
  "system_folder": true,
  "folders": [
    {
      "id": "5e2798bdd3d642c3aefebe333bb5b723d6db01a4",
      "name": "Documents",
      "document_count": "5",
      "template_count": "2"
    },
    {
      "id": "fafdef6de6d947fc84627e4ddeed6987bfeee02d",
      "name": "Templates",
      "document_count": "0",
      "template_count": "3"
    },
    {
      "id": "6063688b1e724a25aa98befcc3f2cb7795be7da1",
      "name": "Trash Bin",
      "document_count": "0"
    }
  ],
  "total_documents": 0,
  "documents": []
}

按ID获取文件夹

GET /signnow/folder/{folder_id}

响应:

{
  "id": "5e2798bdd3d642c3aefebe333bb5b723d6db01a4",
  "name": "Documents",
  "user_id": "59cce130e93a4e9488522ca67e3a6779f3e48a72",
  "parent_id": "2ea71a3a9d06470d8e5ec0df6122971f47db7706",
  "system_folder": true,
  "folders": [],
  "total_documents": 5,
  "documents": [...]
}

Webhook(事件订阅)操作

列出事件订阅

GET /signnow/event_subscription

响应:

{
  "subscriptions": [
    {
      "id": "b1d6700dfb0444ed9196e913b2515ae8d5f731a7",
      "event": "document.complete",
      "created": "1770598678",
      "callback_url": "https://example.com/webhook"
    }
  ]
}

创建事件订阅

POST /signnow/event_subscription
Content-Type: application/json

{
  "event": "document.complete",
  "callback_url": "https://example.com/webhook"
}

响应:

{
  "id": "b1d6700dfb0444ed9196e913b2515ae8d5f731a7",
  "created": 1770598678
}

可用事件:

  • document.create- 文档已创建
  • document.update- 文档已更新
  • document.delete- 文档已删除
  • document.complete- 文档已由所有参与方签署
  • invite.create- 邀请已发送
  • invite.update- 邀请已更新

删除事件订阅

DELETE /signnow/event_subscription/{subscription_id}

响应:

{
  "id": "b1d6700dfb0444ed9196e913b2515ae8d5f731a7",
  "status": "deleted"
}

代码示例

JavaScript

const response = await fetch(
  'https://gateway.maton.ai/signnow/user',
  {
    headers: {
      'Authorization': `Bearer ${process.env.MATON_API_KEY}`
    }
  }
);
const data = await response.json();

Python

import os
import requests

response = requests.get(
    'https://gateway.maton.ai/signnow/user',
    headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
data = response.json()

Python(上传文档)

import os
import requests

with open('document.pdf', 'rb') as f:
    response = requests.post(
        'https://gateway.maton.ai/signnow/document',
        headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
        files={'file': ('document.pdf', f, 'application/pdf')}
    )
doc = response.json()
print(f"Uploaded document: {doc['id']}")

Python(发送邀请)

import os
import requests

doc_id = "c63a7bc73f03449c987bf0feaa36e96212408352"
response = requests.post(
    f'https://gateway.maton.ai/signnow/document/{doc_id}/invite',
    headers={
        'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}',
        'Content-Type': 'application/json'
    },
    json={
        'to': 'signer@example.com',
        'from': 'sender@example.com'
    }
)
result = response.json()
print(f"Invite sent: {result['id']}")

说明

  • 上传文档必须是PDF格式
  • 支持的文件类型:PDF、DOC、DOCX、ODT、RTF、PNG、JPG
  • 系统文件夹(文档、模板、归档、回收站)无法重命名或删除
  • 创建签名链接要求文档必须包含签名域
  • 自定义邀请主题/消息需要付费订阅
  • 开发模式下的速率限制:每个应用每小时500次请求
  • 重要提示:当通过管道将curl输出传递给jq或其他命令时,某些Shell环境中$MATON_API_KEY等环境变量可能无法正确展开

错误处理

状态码含义
400缺少SignNow连接或请求格式错误
401Maton API密钥无效或缺失
403权限不足或需要订阅
404未找到资源
405方法不被允许
429请求频率受限
4xx/5xx来自SignNow API的透传错误

SignNow错误包含详细信息:

{
  "errors": [
    {
      "code": 65578,
      "message": "Invalid file type."
    }
  ]
}

故障排除:API密钥问题

  1. 检查MATON_API_KEY环境变量是否已设置:
echo $MATON_API_KEY
  1. 通过列出连接来验证API密钥是否有效:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

故障排除:无效的应用名称

  1. 确保您的URL路径以signnow开头。例如:
  • 正确:https://gateway.maton.ai/signnow/user
  • 错误:https://gateway.maton.ai/user

资源

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏
文章底部电脑广告
手机广告位-内容正文底部

相关文章

您是本站第326276名访客 今日有221篇新文章/评论