响应 API
检索、筛选、删除和导出表单响应。
响应 API 允许您检索、筛选、删除和导出表单收集的提交数据。所有响应都归属于特定表单。
所有请求和响应体均使用 snake_case 字段命名。
列出响应
/api/v1/forms/:id/responses返回表单的响应分页列表,按提交日期排序(最新优先)。
路径参数
idstring必填表单 ID
查询参数
pageinteger页码(默认:1)
per_pageinteger每页结果数(默认:50)
sincestringISO 8601 日期。仅返回在此日期或之后提交的响应。
untilstringISO 8601 日期。仅返回在此日期或之前提交的响应。
completedboolean按完成状态筛选。true 仅返回已完成的响应,false 仅返回部分响应。
答案值类型
short_textstring示例:"Jane Smith"
long_textstring示例:"I really enjoyed the product..."
multiple_choicestring示例:"Option A"
multiple_choice (multi)array of strings示例:["Option A", "Option C"]
ratingnumber示例:4
opinion_scalenumber示例:8
numbernumber示例:42
emailstring示例:"jane@example.com"
datestring (ISO 8601)示例:"2026-03-15"
yes_noboolean示例:true
file_uploadobject示例:{ "url": "...", "name": "doc.pdf" }
dropdownstring示例:"United States"
响应
{
"responses": [
{
"id": "667a1b2c3d4e5f6a7b8c9d01",
"form_id": "665a1b2c3d4e5f6a7b8c9d0e",
"visitor_id": "v_8f2k3j4l5m6n",
"submitted_at": "2026-02-27T15:42:00.000Z",
"completed_at": "2026-02-27T15:45:30.000Z",
"metadata": {
"user_agent": "Mozilla/5.0",
"referrer": "https://example.com"
},
"answers": [
{
"question_id": "66a1b2c3d4e5f6a7b8c9d001",
"value": "Jane Smith"
},
{
"question_id": "66a1b2c3d4e5f6a7b8c9d002",
"value": "Social media"
},
{
"question_id": "66a1b2c3d4e5f6a7b8c9d003",
"value": 5
}
],
"quiz_results": null
}
],
"total": 142,
"page": 1,
"per_page": 50
}
代码示例
curl -X GET "https://api.nueform.io/api/v1/forms/665a1b2c3d4e5f6a7b8c9d0e/responses?page=1&per_page=25&completed=true" \
-H "Authorization: Bearer YOUR_API_KEY"
获取响应
/api/v1/forms/:id/responses/:responseId通过 ID 检索单个响应。
路径参数
idstring必填表单 ID
responseIdstring必填响应 ID
测验结果
对于使用测验模式(knowledge_quiz、lead_qualification、match_quiz)的表单,quiz_results 字段包含评分数据。
响应
{
"id": "667a1b2c3d4e5f6a7b8c9d01",
"form_id": "665a1b2c3d4e5f6a7b8c9d0e",
"visitor_id": "v_8f2k3j4l5m6n",
"submitted_at": "2026-02-27T15:42:00.000Z",
"completed_at": "2026-02-27T15:45:30.000Z",
"metadata": {
"user_agent": "Mozilla/5.0",
"referrer": "https://example.com"
},
"answers": [
{
"question_id": "66a1b2c3d4e5f6a7b8c9d001",
"value": "Jane Smith"
},
{
"question_id": "66a1b2c3d4e5f6a7b8c9d002",
"value": "Social media"
},
{
"question_id": "66a1b2c3d4e5f6a7b8c9d003",
"value": 5
}
],
"quiz_results": null
}
测验结果示例
{
"quiz_results": {
"score": 8,
"correct_answers": 4,
"total_scorable_questions": 5,
"max_score": 10,
"matched_ending_id": null,
"form_mode": "knowledge_quiz"
}
}
代码示例
curl -X GET "https://api.nueform.io/api/v1/forms/665a1b2c3d4e5f6a7b8c9d0e/responses/667a1b2c3d4e5f6a7b8c9d01" \
-H "Authorization: Bearer YOUR_API_KEY"
删除响应
/api/v1/forms/:id/responses/:responseId永久删除单个响应。
此操作不可撤销。删除后响应数据无法恢复。
路径参数
idstring必填表单 ID
responseIdstring必填响应 ID
响应
{
"success": true
}
代码示例
curl -X DELETE "https://api.nueform.io/api/v1/forms/665a1b2c3d4e5f6a7b8c9d0e/responses/667a1b2c3d4e5f6a7b8c9d01" \
-H "Authorization: Bearer YOUR_API_KEY"
批量删除响应
/api/v1/forms/:id/responses/bulk-delete在单个请求中删除多个响应。每次请求最多删除 100 个响应。所有指定的响应 ID 必须属于给定的表单。
路径参数
idstring必填表单 ID
请求体
response_idsarray of strings必填要删除的响应 ID(最多 100 个)
请求示例
{
"response_ids": [
"667a1b2c3d4e5f6a7b8c9d01",
"667a1b2c3d4e5f6a7b8c9d02",
"667a1b2c3d4e5f6a7b8c9d03"
]
}
响应
{
"deleted": 3
}
代码示例
curl -X POST "https://api.nueform.io/api/v1/forms/665a1b2c3d4e5f6a7b8c9d0e/responses/bulk-delete" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"response_ids": [
"667a1b2c3d4e5f6a7b8c9d01",
"667a1b2c3d4e5f6a7b8c9d02"
]
}'
导出响应 (CSV)
/api/v1/forms/:id/responses/export将表单的所有响应导出为 CSV 文件。CSV 包含 responseId、submittedAt、completedAt 列,以及每个问题一列(使用问题标题作为列标题)。
对于分组问题(question_group、multi_question_page、contact_info、address),每个子字段都有独立的列。
路径参数
idstring必填表单 ID
响应
返回 Content-Type: text/csv 的 CSV 文件。
responseId,submittedAt,completedAt,What is your name?,How did you hear about us?,How would you rate your overall experience?
667a1b2c3d4e5f6a7b8c9d01,2026-02-27T15:42:00.000Z,2026-02-27T15:45:30.000Z,Jane Smith,Social media,5
667a1b2c3d4e5f6a7b8c9d02,2026-02-26T10:15:00.000Z,2026-02-26T10:18:22.000Z,Bob Johnson,Search engine,4
667a1b2c3d4e5f6a7b8c9d03,2026-02-25T08:30:00.000Z,,Alex Chen,Friend or colleague,
代码示例
curl -X GET "https://api.nueform.io/api/v1/forms/665a1b2c3d4e5f6a7b8c9d0e/responses/export" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o responses.csv
错误响应
所有端点返回标准错误响应:
状态码
400Bad Request参数无效,批量删除超过 100 条
401Unauthorized缺少或无效的 API 密钥
403Forbidden团队权限不足
404Not Found表单或响应未找到
500Internal Server Error服务器内部错误
错误示例
{
"error": "Response not found"
}