Zapier API参考
QR Code Maker Zapier集成的完整API文档,包括OAuth 2.0认证、所有端点、请求和响应格式以及Webhook。
用于将QR Code Maker与Zapier集成的完整API参考。本文档涵盖认证、所有可用端点、请求和响应格式以及Webhook事件。
基础网址
https://qr-code-maker.app
认证
API使用OAuth 2.0授权码流程。
OAuth 2.0流程
- 授权请求 - 将用户重定向以进行授权
- 授权码 - 用户批准后收到授权码
- 令牌交换 - 用授权码换取访问令牌
- API请求 - 所有请求都使用Bearer令牌
- 令牌刷新 - 访问令牌过期时进行刷新
授权端点
GET /oauth/authorize
查询参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
client_id | string | 是 | 您的OAuth客户端ID |
redirect_uri | string | 是 | 授权后重定向到的网址 |
response_type | string | 是 | 必须为 code |
state | string | 是 | 用于CSRF防护的随机字符串 |
scope | string | 否 | 以空格分隔的权限范围(默认:客户端注册的权限范围) |
可用权限范围:
| 权限范围 | 说明 |
|---|---|
qr_codes:read | 读取和搜索二维码,以及列出文件夹 |
qr_codes:write | 创建、更新和删除二维码。仅当已连接的用户是组织的所有者、管理员或编辑者时有效 |
analytics:read | 访问扫描统计 |
webhooks:manage | 管理Webhook订阅。订阅和取消订阅端点也接受具有 qr_codes:read 的令牌 |
请求示例:
GET /oauth/authorize?client_id=your_client_id&redirect_uri=https://zapier.com/callback&response_type=code&state=abc123&scope=qr_codes:read%20qr_codes:write%20analytics:read
令牌交换
POST /api/oauth/token
用授权码换取访问令牌和刷新令牌。
请求标头:
Content-Type: application/x-www-form-urlencoded
请求正文:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
grant_type | string | 是 | 必须为 authorization_code |
code | string | 是 | 重定向中获得的授权码 |
redirect_uri | string | 是 | 必须与原始redirect_uri一致 |
client_id | string | 是 | 您的OAuth客户端ID |
client_secret | string | 是 | 您的OAuth客户端密钥 |
请求示例:
curl -X POST https://qr-code-maker.app/api/oauth/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=authorization_code" \
-d "code=AUTH_CODE_HERE" \
-d "redirect_uri=https://zapier.com/callback" \
-d "client_id=your_client_id" \
-d "client_secret=your_client_secret"
成功响应(200):
{
"access_token": "qrc_at_xxxxxxxxxxxxxxxx",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "qrc_rt_xxxxxxxxxxxxxxxx",
"scope": "qr_codes:read qr_codes:write analytics:read"
}
令牌有效期:
| 令牌 | 有效期 |
|---|---|
| 授权码 | 10分钟 |
| 访问令牌 | 1小时 |
| 刷新令牌 | 30天 |
令牌刷新
POST /api/oauth/refresh
刷新已过期的访问令牌。
请求正文:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
grant_type | string | 是 | 必须为 refresh_token |
refresh_token | string | 是 | 您的刷新令牌 |
client_id | string | 是 | 您的OAuth客户端ID |
client_secret | string | 是 | 您的OAuth客户端密钥 |
请求示例:
curl -X POST https://qr-code-maker.app/api/oauth/refresh \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token" \
-d "refresh_token=qrc_rt_xxxxxxxx" \
-d "client_id=your_client_id" \
-d "client_secret=your_client_secret"
成功响应(200):
{
"access_token": "qrc_at_yyyyyyyyyyyyyyyy",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "qrc_rt_yyyyyyyyyyyyyyyy",
"scope": "qr_codes:read qr_codes:write analytics:read"
}
注意: 刷新令牌每次使用时都会轮换。旧的刷新令牌将随之失效。
API端点
所有API请求都需要在Authorization标头中提供Bearer令牌:
Authorization: Bearer qrc_at_xxxxxxxx
测试连接
GET /api/zapier/me
验证API连接并获取账户信息。
请求示例:
curl https://qr-code-maker.app/api/zapier/me \
-H "Authorization: Bearer qrc_at_xxxxxxxx"
成功响应(200):
{
"user_id": "user_uuid",
"email": "user@example.com",
"organization_id": "org_uuid",
"organization_name": "My Company",
"plan": "free"
}
plan 是您的限额所依据的套餐,与您的仪表板显示的一致:如果账户有手动分配的套餐,则为该套餐;否则在免费试用期间为 pro;再否则为组织订阅的套餐,没有订阅时为 free。如果当时无法读取订阅,则为 null。
列出二维码
GET /api/zapier/qr
获取分页的二维码列表。默认只列出活跃的二维码,最新的排在最前。
查询参数:
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
limit | integer | 25 | 每页条目数,1到100 |
offset | integer | 0 | 要跳过的条目数 |
folder_id | string | - | 按文件夹筛选 |
status | string | active | 按状态筛选:active、paused 或 all |
type_id | string | - | 按类型筛选:website、vcard、wifi 等 |
sort | string | created_desc | 排序方式:created_desc、created_asc、edited_desc(最近创建或编辑的在前)、name_asc 或 scan_count_desc |
排序值相同的二维码按 id 排序,因此每个二维码在各页之间位置固定。offset 超过最后一个二维码时返回空的 items 列表,而 total 仍计入所有匹配的二维码。
请求示例(每页25条的第2页):
curl "https://qr-code-maker.app/api/zapier/qr?limit=25&offset=25" \
-H "Authorization: Bearer qrc_at_xxxxxxxx"
成功响应(200):
{
"items": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Summer Campaign",
"short_code": "Ab3Xy",
"type_id": "website",
"category": "dynamic",
"status": "active",
"content": {
"url": "https://example.com/summer"
},
"scan_count": 1250,
"last_scanned_at": "2026-01-18T14:30:00Z",
"created_at": "2026-01-01T10:00:00Z",
"updated_at": "2026-01-15T09:00:00Z",
"folder_id": "folder_uuid",
"qr_image_url": "https://qr-code-maker.app/api/qr/550e8400-e29b-41d4-a716-446655440000/image",
"tracking_url": "https://qr-code-maker.app/r/Ab3Xy",
"dashboard_url": "https://qr-code-maker.app/dashboard/qr/550e8400-e29b-41d4-a716-446655440000"
}
],
"total": 156,
"has_more": true
}
创建二维码
POST /api/zapier/qr
创建新的二维码。
请求标头:
Content-Type: application/json
Authorization: Bearer qrc_at_xxxxxxxx
请求正文:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 是 | 二维码的显示名称 |
type_id | string | 是 | 二维码类型(见下方类型) |
content | object | 是 | 特定于类型的内容 |
folder_id | string | 否 | 放置二维码的文件夹 |
支持的二维码类型:
| 类型ID | 类别 | 内容字段 |
|---|---|---|
website | dynamic | { "url": "https://..." } |
vcard | dynamic | { "firstName": "", "lastName": "", "phone": "", "email": "", ... } |
wifi | static | { "ssid": "", "password": "", "encryption": "WPA" } |
email | static | { "email": "", "subject": "", "body": "" } |
sms | static | { "phone": "", "message": "" } |
phone | static | { "phone": "" } |
text | static | { "text": "" } |
event | static | { "title": "", "startDate": "", "endDate": "", "location": "" } |
WiFi的 encryption 字段可取 WPA、WEP 或 nopass。
注意: 在所有返回二维码的响应中,静态码的 tracking_url 均为 null。静态码直接编码其内容,因此只有动态(可追踪)码才有追踪链接。category 字段可告诉您二维码属于哪一种。
内容未通过其类型的校验时,返回400,代码为 INVALID_CONTENT。当某类二维码达到您套餐的限额后,再创建会返回403,代码为 LIMIT_REACHED(参见错误处理)。如果当时无法检查您的套餐,将返回429,代码为 PLAN_UNAVAILABLE,且不会创建任何内容,请在 Retry-After 标头指定的秒数之后重试。
请求示例:
curl -X POST https://qr-code-maker.app/api/zapier/qr \
-H "Authorization: Bearer qrc_at_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Product Launch",
"type_id": "website",
"content": {
"url": "https://example.com/launch"
},
"folder_id": "folder_uuid"
}'
成功响应(201):
{
"id": "new_qr_uuid",
"name": "Product Launch",
"short_code": "Hk7Pm",
"type_id": "website",
"category": "dynamic",
"status": "active",
"content": {
"url": "https://example.com/launch"
},
"scan_count": 0,
"last_scanned_at": null,
"created_at": "2026-01-18T15:00:00Z",
"updated_at": "2026-01-18T15:00:00Z",
"folder_id": "folder_uuid",
"qr_image_url": "https://qr-code-maker.app/api/qr/new_qr_uuid/image",
"tracking_url": "https://qr-code-maker.app/r/Hk7Pm",
"dashboard_url": "https://qr-code-maker.app/dashboard/qr/new_qr_uuid"
}
获取二维码
GET /api/zapier/qr/{id}
按ID获取特定的二维码。
路径参数:
| 参数 | 类型 | 说明 |
|---|---|---|
id | string | 二维码UUID |
请求示例:
curl https://qr-code-maker.app/api/zapier/qr/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer qrc_at_xxxxxxxx"
成功响应(200):
返回完整的二维码对象(格式与列表条目相同)。
更新二维码
PATCH /api/zapier/qr/{id}
更新现有的二维码。
请求正文:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 否 | 新的显示名称 |
content | object | 否 | 新内容,按二维码现有的类型校验 |
status | string | 否 | active 或 paused |
folder_id | string | 否 | 要移入的文件夹,须属于您的组织。null 会将其移出所在文件夹 |
将已暂停的动态码设为 active 会计入您套餐的动态二维码限额,与在仪表板中重新激活相同。如果您的活跃动态码已占满套餐限额,更新会返回403,代码为 LIMIT_REACHED,且不做任何更改。如果当时无法检查您的套餐,将返回429,代码为 PLAN_UNAVAILABLE,且不做任何更改,请在 Retry-After 标头指定的秒数之后重试。已经处于活跃状态的二维码或静态码不会被检查。
请求示例:
curl -X PATCH https://qr-code-maker.app/api/zapier/qr/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer qrc_at_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Summer Campaign 2026",
"content": {
"url": "https://example.com/summer2026"
}
}'
成功响应(200):
返回更新后的二维码对象。
删除二维码
DELETE /api/zapier/qr/{id}
永久删除二维码。
请求示例:
curl -X DELETE https://qr-code-maker.app/api/zapier/qr/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer qrc_at_xxxxxxxx"
成功响应(204):
不返回任何内容。
搜索二维码
GET /api/zapier/qr/search
按名称搜索您的二维码:除非 status 要求其他状态,否则只搜索活跃的二维码。结果按最新在前排列。
查询参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
query | string | 否 | 要在名称中查找的文本(不区分大小写)。不提供时,返回该状态下最新的二维码 |
type_id | string | 否 | 按类型筛选 |
status | string | 否 | 按状态筛选:active(默认)、paused 或 all |
limit | integer | 否 | 最大结果数,1到50(默认10) |
请求示例:
curl "https://qr-code-maker.app/api/zapier/qr/search?query=campaign" \
-H "Authorization: Bearer qrc_at_xxxxxxxx"
成功响应(200):
{
"items": [
{ ... QR code object ... }
],
"total": 5,
"has_more": false
}
获取二维码分析数据
GET /api/zapier/qr/{id}/analytics
获取二维码的扫描统计。
查询参数:
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
period | string | 30d | 时间段:7d、30d、90d、all |
请求示例:
curl "https://qr-code-maker.app/api/zapier/qr/550e8400-e29b-41d4-a716-446655440000/analytics?period=30d" \
-H "Authorization: Bearer qrc_at_xxxxxxxx"
成功响应(200):
{
"qr_id": "550e8400-e29b-41d4-a716-446655440000",
"period": "30d",
"scan_count": 640,
"unique_visitors": 455,
"last_scanned_at": "2026-01-18T14:30:00Z",
"top_location": {
"country": "US",
"city": "New York"
},
"device_breakdown": {
"mobile": 78,
"desktop": 18,
"tablet": 4
},
"daily_scans": [
{ "date": "2026-01-18", "count": 45 },
{ "date": "2026-01-17", "count": 52 }
]
}
scan_count统计该时间段内的扫描次数,unique_visitors统计其中的不同访客数,按哈希处理后的IP地址计算。device_breakdown以整数百分比给出这些扫描的占比,总和为100;该时间段内没有扫描时全部为0。无法识别设备类型的扫描计为桌面设备。top_location是该时间段内扫描次数最多的地点,按城市和国家统计,与仪表板显示的热门地点相同。未记录的字段为null;该时间段内没有任何扫描记录了地点时,top_location为null。daily_scans列出最多30个有扫描的日期,按UTC日期从新到旧排列。last_scanned_at取自二维码本身,与时间段无关。
列出文件夹
GET /api/zapier/folders
获取用于整理二维码的所有文件夹,按名称排序。
请求示例:
curl https://qr-code-maker.app/api/zapier/folders \
-H "Authorization: Bearer qrc_at_xxxxxxxx"
成功响应(200):
{
"items": [
{
"id": "folder_uuid",
"name": "Marketing Campaigns",
"qr_count": 24
}
]
}
Webhook(REST Hooks)
订阅后,事件发生时即可收到实时通知。
订阅Webhook
POST /api/zapier/webhooks/subscribe
创建新的Webhook订阅。
订阅属于创建它的连接所对应的用户。只要该用户是组织成员,无论其角色如何,订阅都会推送事件;该用户被移出组织后,订阅即停止推送。
请求正文:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
event_type | string | 是 | 要订阅的事件类型 |
webhook_url | string | 是 | 接收Webhook负载的HTTPS网址 |
qr_id | string | 否 | 只发送此二维码的事件 |
可用事件:
| 事件 | 说明 |
|---|---|
qr.scanned | 动态二维码被扫描 |
qr.created | 通过此API创建了二维码 |
qr.milestone.1 | 二维码扫描次数达到1次 |
qr.milestone.10 | 二维码扫描次数达到10次 |
qr.milestone.50 | 二维码扫描次数达到50次 |
qr.milestone.100 | 二维码扫描次数达到100次 |
qr.milestone.500 | 二维码扫描次数达到500次 |
qr.milestone.1000 | 二维码扫描次数达到1,000次 |
qr.milestone.5000 | 二维码扫描次数达到5,000次 |
qr.milestone.10000 | 二维码扫描次数达到10,000次 |
请求示例:
curl -X POST https://qr-code-maker.app/api/zapier/webhooks/subscribe \
-H "Authorization: Bearer qrc_at_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"event_type": "qr.scanned",
"webhook_url": "https://hooks.zapier.com/hooks/catch/123/abc"
}'
成功响应(201):
{
"id": "webhook_subscription_uuid",
"event_type": "qr.scanned",
"webhook_url": "https://hooks.zapier.com/hooks/catch/123/abc",
"qr_id": null,
"created_at": "2026-01-18T15:00:00Z"
}
取消订阅Webhook
DELETE /api/zapier/webhooks/{id}
删除Webhook订阅。
请求示例:
curl -X DELETE https://qr-code-maker.app/api/zapier/webhooks/webhook_subscription_uuid \
-H "Authorization: Bearer qrc_at_xxxxxxxx"
成功响应(204):
不返回任何内容。
Webhook负载格式
Webhook以POST请求的形式发送到您的Webhook网址。请求正文就是事件本身的对象,外面没有封装层;X-QRC-Event 标头标明事件名称。
当您的端点返回2xx以外的任何状态时,该次推送即视为失败。系统不会跟随重定向,因此3xx响应同样视为失败。如果网址的主机是私有、环回或链路本地地址,或解析到此类地址,系统不会向其发送任何内容。
如果您的端点返回 410 Gone,该订阅将被关闭,不再收到后续事件;如需恢复,请重新订阅。其他任何失败都不会关闭订阅,下一个事件照常发送。
请求标头:
Content-Type: application/json
X-QRC-Event: qr.scanned
X-QRC-Signature: sha256=xxxxxxxxxxxxxxxxxxxxxxxxxx
签名:
X-QRC-Signature 标头包含请求正文的HMAC-SHA256签名,密钥是为每个订阅单独生成的。API不会返回该密钥,因此您无法在自己一端验证签名。
负载示例(qr.scanned):
{
"qr_id": "550e8400-e29b-41d4-a716-446655440000",
"qr_name": "Summer Campaign",
"short_code": "Ab3Xy",
"type_id": "website",
"scanned_at": "2026-01-18T15:30:00.000Z",
"location": {
"country": "US",
"region": "NY",
"city": "New York"
},
"device": {
"type": "mobile",
"os": "iOS",
"browser": null
},
"total_scans": 1251,
"qr_image_url": "https://qr-code-maker.app/api/qr/550e8400-e29b-41d4-a716-446655440000/image",
"tracking_url": "https://qr-code-maker.app/r/Ab3Xy"
}
total_scans 包含本次扫描。device.browser 始终为 null。
负载示例(qr.milestone.1000):
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Summer Campaign",
"short_code": "Ab3Xy",
"type_id": "website",
"scan_count": 1000,
"milestone": "1000",
"milestone_reached_at": "2026-01-18T15:30:00.000Z",
"top_location": {
"country": "US",
"city": "New York"
},
"qr_image_url": "https://qr-code-maker.app/api/qr/550e8400-e29b-41d4-a716-446655440000/image",
"tracking_url": "https://qr-code-maker.app/r/Ab3Xy",
"dashboard_url": "https://qr-code-maker.app/dashboard/qr/550e8400-e29b-41d4-a716-446655440000"
}
milestone 是达到的阈值,以字符串表示。scan_count 包含达到该阈值的那次扫描。top_location 是该二维码已记录扫描中次数最多的地点,按城市和国家统计,与分析响应中相同;如果没有任何扫描记录了地点,则为 null。
负载(qr.created): 创建的二维码对象,格式与列表条目相同。
错误处理
API使用标准HTTP状态码,并以JSON格式返回错误。
错误响应格式
大多数错误采用以下扁平结构:
{
"error": "not_found",
"code": "NOT_FOUND",
"message": "QR code not found"
}
部分错误包含其他字段:
- 未通过校验的请求正文会返回
details而非message(代码INVALID_REQUEST)。未通过其类型校验的内容会返回以字段为键的fieldErrors(代码INVALID_CONTENT)。 - 达到套餐限额时还会返回
upgrade_url、limit和current(代码LIMIT_REACHED)。 - 认证错误以及OAuth端点的所有错误都使用OAuth 2.0结构
{ "error": "invalid_token", "error_description": "..." },不含code。 - 如果用户的角色无法更改二维码,以该用户身份创建、更新或删除二维码会返回OAuth 2.0结构的403,其中
error为insufficient_role,另有code为QR_WRITE_ROLE_REQUIRED,并在message中给出与error_description相同的文本。 - 来自
GET /api/zapier/me的错误包含error和message,不含code。
HTTP状态码
| 状态 | 说明 |
|---|---|
200 | 成功 |
201 | 已创建 |
204 | 无内容(删除成功) |
400 | 错误请求 - 参数或内容无效 |
401 | 未授权 - 令牌无效或缺失 |
403 | 禁止访问 - 缺少权限范围、角色无法更改二维码,或已达到套餐限额 |
404 | 未找到 - 资源不存在 |
429 | 请求过多 - 并非速率限制:创建二维码或将已暂停的二维码设为 active 时,当时无法检查您的套餐,因此没有创建或更改任何内容。请在 Retry-After 标头指定的秒数之后重试;Zapier会自动重试 |
500 | 服务器内部错误 |
错误代码
error | code | 状态 | 说明 |
|---|---|---|---|
unauthorized | - | 401 | 缺少 Authorization 标头,或其中不是Bearer令牌 |
invalid_token | - | 401 | 访问令牌无效、已过期或已被撤销 |
insufficient_scope | - | 403 | 令牌缺少所需的权限范围 |
insufficient_role | QR_WRITE_ROLE_REQUIRED | 403 | 用户是组织中的查看者时,以其身份创建、更新或删除二维码。只有所有者、管理员和编辑者可以这样做 |
validation_error | INVALID_REQUEST | 400 | 请求正文未通过校验(例如缺少必填字段),或不是JSON |
validation_error | INVALID_TYPE | 400 | 未知的 type_id |
content_validation_failed | INVALID_CONTENT | 400 | content 未通过其类型的校验 |
validation_error | INVALID_FOLDER | 400 | 创建或更新时,folder_id 指向的文件夹不在您的组织中,例如设置Zap之后已删除的文件夹 |
validation_error | INVALID_STATUS | 400 | 列出或搜索二维码时,status 不是 active、paused 或 all |
validation_error | INVALID_EVENT_TYPE | 400 | 未知的Webhook事件类型 |
validation_error | INSECURE_URL | 400 | Webhook网址不是HTTPS |
validation_error | UNSAFE_URL | 400 | Webhook网址的主机是内部主机:localhost 或其下的名称、云元数据主机名,或者私有、环回、链路本地或其他非公开IP地址。仅解析到此类地址的主机名会被接受,但不会向其推送任何内容 |
validation_error | URL_HAS_CREDENTIALS | 400 | Webhook网址包含用户名或密码 |
limit_reached | LIMIT_REACHED | 403 | 该类别二维码已达到您套餐的限额;或在更新时,您的活跃动态码已无余量,无法将已暂停的二维码设为 active |
server_error | PLAN_UNAVAILABLE | 429 | 创建二维码,或通过更新将已暂停的二维码设为 active 时:当时无法检查您的套餐,没有创建或更改任何内容。请在 Retry-After 标头指定的秒数之后重试 |
not_found | NOT_FOUND | 404 | 您的组织中不存在该二维码 |
user_not_found | - | 404 | 来自 /api/zapier/me:无法查找令牌对应的用户。请重试;已删除的账户会改为返回 invalid_token |
organization_not_found | - | 404 | 来自 /api/zapier/me:无法查找令牌对应的组织。请重试;已删除的组织会改为返回 invalid_token |
server_error | 视情况而定,/api/zapier/me 则无 | 500 | 意外的服务器错误 |
快速开始
- 访问我们的Zapier集成以连接您的账户
- 出现提示时授权QR Code Maker
- 使用我们的触发器和操作创建您的第一个Zap
如需在不编写代码的情况下一次创建大量二维码,请试试我们的批量二维码生成器,只需上传CSV文件即可。
支持
对API有疑问?请联系support@qr-code-maker.app。