Endpoints
Get leads for a chatbot
Read an agent's newest Collect leads submissions
This endpoint returns the newest submissions to an agent's Collect leads forms, up to 10, newest first, in the same shape QwryAI sends to Zapier. It has no date filter or paging. To receive every lead as it comes in, connect Zapier or a webhook instead.
GET
https://api.qwryai.com/api/v1/zapier/agents/{agentId}/form-submissionsAuthentication
Send your API key as Authorization: Bearer YOUR_API_KEY. The key needs Change actions and procedures. This endpoint takes API keys only, not OAuth tokens. See Authentication.
Body parameters
There's no body. The endpoint takes these in the path and query string:
| Name | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | Path. The agent's id, from list_agents. |
limit | integer | No | Query. How many submissions to return, from 1 to 10. Defaults to 3. |
Request example
curl 'https://api.qwryai.com/api/v1/zapier/agents/YOUR_AGENT_ID/form-submissions?limit=10' \
-H 'Authorization: Bearer YOUR_API_KEY'const response = await fetch(
"https://api.qwryai.com/api/v1/zapier/agents/YOUR_AGENT_ID/form-submissions?limit=10",
{ headers: { Authorization: "Bearer YOUR_API_KEY" } },
);
const leads = await response.json();import requests
response = requests.get(
"https://api.qwryai.com/api/v1/zapier/agents/YOUR_AGENT_ID/form-submissions",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"limit": 10},
)
leads = response.json()Response
The response is a JSON array, not wrapped in data:
[
{
"id": "<submissionId>",
"conversationId": "fd5ae9e1-9b30-4503-b346-ccd4d7ef16a3",
"customerEmail": "sam.tester@example.com",
"customerName": "Sam Tester",
"customerPhone": "+14155550123",
"customFields": { "company": "Northwind Outfitters" }
}
]| Field | Type | Description |
|---|---|---|
id | string | The submission's id. |
conversationId | string | The conversation the form was submitted in. |
customerEmail, customerName, customerPhone | string | The contact fields the visitor filled in; empty when the form doesn't ask for one. |
customFields | object | Any other fields the form collects, by field name. Only on forms shown inside the conversation. |
An agent with no Collect leads form returns []. See Collect leads to add one.
Errors
| HTTP status | code | When |
|---|---|---|
| 401 | API_KEY_REQUIRED | No API key was sent, or an OAuth token was sent instead of a key. |
| 401 | INVALID_API_KEY | The key is malformed, unknown or deleted. |
| 403 | INSUFFICIENT_PERMISSION | The key doesn't hold Change actions and procedures. |
| 404 | AGENT_NOT_FOUND | No agent with that id in your workspace. |
| 429 | INTEGRATION_RATE_LIMIT_EXCEEDED | More than 2,000 requests in 15 minutes for this key. |
See Error Handling for the error envelope.