任务
在后台批量执行最多 100 次查找或获取 500 条线索,按子调用计费,完成后读取结果。
任务会在后台替你批量调用同一个接口,agent 无需逐个发请求,也不用在运行期间一直保持连接。
enrich.people.email.find、enrich.email.verify和signals.find使用inputs:最多 100 个子调用,每项是一次调用的请求体。trade.leads.find使用单个input,其limit最大为 500,任务会自动替你逐页获取。- 每个子调用的执行和计费都与单独调用完全相同,所以任务的花费就是这些调用花费之和。创建、查看、列出和取消任务都免费。
max_cost会拒绝可能超出该金额的任务,dry_run: true只返回最高花费。 - 余额或 key 的预算用完时,任务以
failed结束,已完成的部分全部保留。 - 任务结束时,
task.completed事件会推送到你的 webhook,也会出现在GET /events中。你自定义的metadata(比如客户 ID)会随任务和该事件一并返回。 - 结果在任务结束后保留 7 天;如果数据来源不允许长期保存,则只保留 1 天。任务本身在列表中保留 30 天。
- 使用测试 key 时,每个子调用都在沙箱中运行,不扣费,并且只能看到测试 key 创建的任务。
- MCP 服务 通过
task_create和task_get工具提供相同的功能。
创建任务
POST https://api.won.dev/v1/tasks
在后台对同一个接口批量发起调用:最多 100 次工作邮箱查找(enrich.people.email.find)、邮箱验证(enrich.email.verify)或公司信号检查(signals.find),inputs 中每一项对应一次调用;或者用一个 input 获取最多 500 条线索(trade.leads.find),其 limit 最大为 500。每个子调用都与单独调用完全一致:按接口价格对返回的结果计费,重复调用和 30 天内已付费的结果免费。创建任务本身免费。max_cost 会拒绝可能超出该金额的任务,dry_run: true 只返回最高花费。余额或 key 的预算用完时,任务以 failed 结束,已完成的部分全部保留。可以用 GET /tasks/{id} 查看进度,或者等待 task.completed 事件。结果在任务结束后保留 7 天。带上 Idempotency-Key 请求头,重试时不会重复创建任务。支持的接口:trade.leads.find、enrich.people.email.find、enrich.email.verify、signals.find。
参数
参数放在JSON 请求体里。
| 参数 | 类型 | 必填 | 说明(API 原文) |
|---|---|---|---|
operation | trade.leads.find | enrich.people.email.find | enrich.email.verify | signals.find | 是 | What to run: trade.leads.find, enrich.people.email.find, enrich.email.verify, signals.find. |
inputs | object[] | 否 | For a batch: up to 100 parts, each the body of one call of the endpoint, such as {"email": "jane@example.com"}. |
input | object | 否 | For trade.leads.find: the body of one call, with limit up to 500 (default 100). The task goes down the ranked list until it has limit leads or the list ends. |
max_cost | number | 否 | The most the whole task may cost, in US dollars. A task that could cost more is refused before anything runs. |
dry_run | boolean | 否 | Only say the most the task can cost. Nothing is created or charged. Default: false. |
metadata | object | 否 | Your own keys and values, such as {"customer_id": "c_812"}: up to 20 keys of at most 40 characters, each value a string of at most 500. Returned as given, and in the events about it. |
响应
| 字段 | 类型 | 说明(API 原文) |
|---|---|---|
data | object | The task, and the most it can cost. |
data.dry_run | boolean | True when nothing was created: the answer to dry_run: true. |
data.max_cost | number | The most the task can cost, in US dollars. |
data.task | object | null | The task. Null on a dry run. |
data.task.id | string | Task ID, such as task_7p1q8w3e5r4k2m9x. |
data.task.operation | string | The endpoint it runs, such as enrich.email.verify. |
data.task.status | running | completed | failed | canceled | running, then completed, failed (it stopped early, and error says why) or canceled. |
data.task.progress | object | How far it got. |
data.task.progress.done | integer | Parts answered, or for leads the leads found. |
data.task.progress.total | integer | Parts of the batch, or the leads asked for. |
data.task.progress.failed | integer | Parts answered with an error. They cost nothing. |
data.task.cost | number | What it cost so far, in US dollars. |
data.task.max_cost | number | The most it can cost, in US dollars. |
data.task.error | object | null | Why it stopped early: the error of the call that stopped it, such as insufficient_balance. Null otherwise. |
data.task.error.code | string | |
data.task.error.message | string | |
data.task.metadata | object | Your own keys and values, as you gave them. Empty when none were. |
data.task.created_at | string | When it was created, ISO 8601. |
data.task.completed_at | string | null | When it ended. Null while it runs. |
data.task.results_expire_at | string | null | When the results are deleted: 7 days after the end, 1 day when a source does not allow keeping them. Null while it runs. |
notice | string | null | A plain sentence when there is something to know about this answer. Null otherwise. |
usage | object | Nothing is charged here. The balance, for reference. |
usage.cost | number | What this call cost, in US dollars. |
usage.balance | number | The balance left after this call, in US dollars. |
usage.replayed | boolean | True when this is a repeat of a request from the last 24 hours. Repeats are free. |
示例
curl https://api.won.dev/v1/tasks \
-H "Authorization: Bearer $WON_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"operation": "enrich.people.email.find",
"inputs": [
{
"first_name": "Dana",
"last_name": "Reyes",
"domain": "harbor-chairs.com"
},
{
"linkedin_url": "https://www.linkedin.com/in/lee-okafor"
}
],
"max_cost": 3,
"metadata": {
"customer_id": "c_812"
}
}'{
"data": {
"dry_run": false,
"max_cost": 0.06,
"task": {
"id": "task_7p1q8w3e5r4k2m9x",
"operation": "enrich.people.email.find",
"status": "running",
"progress": {
"done": 0,
"total": 2,
"failed": 0
},
"cost": 0,
"max_cost": 0.06,
"error": null,
"metadata": {
"customer_id": "c_812"
},
"created_at": "2026-11-20T13:40:00.000Z",
"completed_at": null,
"results_expire_at": null
}
},
"notice": null,
"usage": {
"cost": 0,
"balance": 48.14,
"replayed": false
}
}查看任务
GET https://api.won.dev/v1/tasks/{id}
查看任务的进度、花费,以及按顺序排列的结果:每条结果都与单独调用该接口时的响应相同,并附带 HTTP 状态码。结果可以用 cursor 翻页。status 仍为 running 时,可以过一分钟再查,或者等待 task.completed 事件。结果在任务结束 7 天后删除(results_expire_at)。免费。
参数
id 放在路径中,其余参数放在查询字符串里。
| 参数 | 类型 | 必填 | 说明(API 原文) |
|---|---|---|---|
id | string | 是 | Task ID, such as task_7p1q8w3e5r4k2m9x. |
limit | integer | 否 | How many to return, 1 to 100. Default: 20. |
cursor | string | 否 | To get the next page, pass next_cursor of the previous response back unchanged, with the same parameters. |
响应
| 字段 | 类型 | 说明(API 原文) |
|---|---|---|
data | object | The task, and a page of its results. |
data.task | object | |
data.task.id | string | Task ID, such as task_7p1q8w3e5r4k2m9x. |
data.task.operation | string | The endpoint it runs, such as enrich.email.verify. |
data.task.status | running | completed | failed | canceled | running, then completed, failed (it stopped early, and error says why) or canceled. |
data.task.progress | object | How far it got. |
data.task.progress.done | integer | Parts answered, or for leads the leads found. |
data.task.progress.total | integer | Parts of the batch, or the leads asked for. |
data.task.progress.failed | integer | Parts answered with an error. They cost nothing. |
data.task.cost | number | What it cost so far, in US dollars. |
data.task.max_cost | number | The most it can cost, in US dollars. |
data.task.error | object | null | Why it stopped early: the error of the call that stopped it, such as insufficient_balance. Null otherwise. |
data.task.error.code | string | |
data.task.error.message | string | |
data.task.metadata | object | Your own keys and values, as you gave them. Empty when none were. |
data.task.created_at | string | When it was created, ISO 8601. |
data.task.completed_at | string | null | When it ended. Null while it runs. |
data.task.results_expire_at | string | null | When the results are deleted: 7 days after the end, 1 day when a source does not allow keeping them. Null while it runs. |
data.results | object[] | The results of this page, in order. |
data.results[].index | integer | The part of inputs it answers, or the page of leads, from 0. |
data.results[].status | integer | The HTTP status of the call: 200, or the status of its error. |
data.results[].body | object | The answer, exactly as a call of the endpoint returns it: its body or its error. |
has_more | boolean | Whether more results follow this page. |
next_cursor | string | null | Pass it as cursor to get the next page of results. Null on the last page. |
notice | string | null | A plain sentence when there is something to know about this answer. Null otherwise. |
usage | object | Nothing is charged here. The balance, for reference. |
usage.cost | number | What this call cost, in US dollars. |
usage.balance | number | The balance left after this call, in US dollars. |
usage.replayed | boolean | True when this is a repeat of a request from the last 24 hours. Repeats are free. |
示例
curl "https://api.won.dev/v1/tasks/task_7p1q8w3e5r4k2m9x?limit=1" \
-H "Authorization: Bearer $WON_API_KEY"{
"data": {
"task": {
"id": "task_7p1q8w3e5r4k2m9x",
"operation": "enrich.people.email.find",
"status": "completed",
"progress": {
"done": 100,
"total": 100,
"failed": 2
},
"cost": 1.86,
"max_cost": 3,
"error": null,
"metadata": {
"customer_id": "c_812"
},
"created_at": "2026-11-20T13:40:00.000Z",
"completed_at": "2026-11-20T13:46:12.000Z",
"results_expire_at": "2026-11-27T13:46:12.000Z"
},
"results": [
{
"index": 0,
"status": 200,
"body": {
"data": {
"email": {
"address": "dana.reyes@harbor-chairs.com",
"status": "verified"
},
"person": null
},
"query": {
"first_name": "Dana",
"last_name": "Reyes",
"domain": "harbor-chairs.com"
},
"notice": null,
"usage": {
"unit": "person_email",
"records": 1,
"already_paid": 0,
"cost": 0.03,
"balance": 49.97,
"replayed": false
}
}
}
]
},
"has_more": true,
"next_cursor": "cur_Zx81kQp4b2JtMW0uMXJ6ZzQ",
"notice": null,
"usage": {
"cost": 0,
"balance": 48.14,
"replayed": false
}
}列出任务
GET https://api.won.dev/v1/tasks
列出你的任务,按时间倒序,包含状态、进度和花费。具体结果用 GET /tasks/{id} 查看。免费。
参数
参数放在查询字符串里。
| 参数 | 类型 | 必填 | 说明(API 原文) |
|---|---|---|---|
limit | integer | 否 | How many to return, 1 to 100. Default: 25. |
cursor | string | 否 | To get the next page, pass next_cursor of the previous response back unchanged, with the same parameters. |
响应
| 字段 | 类型 | 说明(API 原文) |
|---|---|---|
data | object[] | The tasks, newest first. |
data[].id | string | Task ID, such as task_7p1q8w3e5r4k2m9x. |
data[].operation | string | The endpoint it runs, such as enrich.email.verify. |
data[].status | running | completed | failed | canceled | running, then completed, failed (it stopped early, and error says why) or canceled. |
data[].progress | object | How far it got. |
data[].progress.done | integer | Parts answered, or for leads the leads found. |
data[].progress.total | integer | Parts of the batch, or the leads asked for. |
data[].progress.failed | integer | Parts answered with an error. They cost nothing. |
data[].cost | number | What it cost so far, in US dollars. |
data[].max_cost | number | The most it can cost, in US dollars. |
data[].error | object | null | Why it stopped early: the error of the call that stopped it, such as insufficient_balance. Null otherwise. |
data[].error.code | string | |
data[].error.message | string | |
data[].metadata | object | Your own keys and values, as you gave them. Empty when none were. |
data[].created_at | string | When it was created, ISO 8601. |
data[].completed_at | string | null | When it ended. Null while it runs. |
data[].results_expire_at | string | null | When the results are deleted: 7 days after the end, 1 day when a source does not allow keeping them. Null while it runs. |
has_more | boolean | Whether more follow this page. |
next_cursor | string | null | Pass it as cursor to get the next page. Null on the last page. |
notice | string | null | A plain sentence when there is something to know about this answer. Null otherwise. |
usage | object | Nothing is charged here. The balance, for reference. |
usage.cost | number | What this call cost, in US dollars. |
usage.balance | number | The balance left after this call, in US dollars. |
usage.replayed | boolean | True when this is a repeat of a request from the last 24 hours. Repeats are free. |
示例
curl "https://api.won.dev/v1/tasks?limit=1" \
-H "Authorization: Bearer $WON_API_KEY"{
"data": [
{
"id": "task_7p1q8w3e5r4k2m9x",
"operation": "enrich.people.email.find",
"status": "completed",
"progress": {
"done": 100,
"total": 100,
"failed": 2
},
"cost": 1.86,
"max_cost": 3,
"error": null,
"metadata": {
"customer_id": "c_812"
},
"created_at": "2026-11-20T13:40:00.000Z",
"completed_at": "2026-11-20T13:46:12.000Z",
"results_expire_at": "2026-11-27T13:46:12.000Z"
}
],
"has_more": false,
"next_cursor": null,
"notice": null,
"usage": {
"cost": 0,
"balance": 48.14,
"replayed": false
}
}取消任务
POST https://api.won.dev/v1/tasks/{id}/cancel
停止一个正在运行的任务,不再启动新的子调用。已经开始的子调用会照常完成并计费,任务已产生的结果全部保留。取消后会发出 status: canceled 的 task.completed 事件。免费。
参数
id 放在路径中。
| 参数 | 类型 | 必填 | 说明(API 原文) |
|---|---|---|---|
id | string | 是 | Task ID, such as task_7p1q8w3e5r4k2m9x. |
响应
| 字段 | 类型 | 说明(API 原文) |
|---|---|---|
data | object | The task, canceled. |
data.id | string | Task ID, such as task_7p1q8w3e5r4k2m9x. |
data.operation | string | The endpoint it runs, such as enrich.email.verify. |
data.status | running | completed | failed | canceled | running, then completed, failed (it stopped early, and error says why) or canceled. |
data.progress | object | How far it got. |
data.progress.done | integer | Parts answered, or for leads the leads found. |
data.progress.total | integer | Parts of the batch, or the leads asked for. |
data.progress.failed | integer | Parts answered with an error. They cost nothing. |
data.cost | number | What it cost so far, in US dollars. |
data.max_cost | number | The most it can cost, in US dollars. |
data.error | object | null | Why it stopped early: the error of the call that stopped it, such as insufficient_balance. Null otherwise. |
data.error.code | string | |
data.error.message | string | |
data.metadata | object | Your own keys and values, as you gave them. Empty when none were. |
data.created_at | string | When it was created, ISO 8601. |
data.completed_at | string | null | When it ended. Null while it runs. |
data.results_expire_at | string | null | When the results are deleted: 7 days after the end, 1 day when a source does not allow keeping them. Null while it runs. |
notice | string | null | A plain sentence when there is something to know about this answer. Null otherwise. |
usage | object | Nothing is charged here. The balance, for reference. |
usage.cost | number | What this call cost, in US dollars. |
usage.balance | number | The balance left after this call, in US dollars. |
usage.replayed | boolean | True when this is a repeat of a request from the last 24 hours. Repeats are free. |
示例
curl https://api.won.dev/v1/tasks/task_7p1q8w3e5r4k2m9x/cancel \
-H "Authorization: Bearer $WON_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'{
"data": {
"id": "task_7p1q8w3e5r4k2m9x",
"operation": "enrich.people.email.find",
"status": "canceled",
"progress": {
"done": 35,
"total": 100,
"failed": 0
},
"cost": 0.84,
"max_cost": 3,
"error": null,
"metadata": {
"customer_id": "c_812"
},
"created_at": "2026-11-20T13:40:00.000Z",
"completed_at": "2026-11-20T13:46:12.000Z",
"results_expire_at": "2026-11-27T13:46:12.000Z"
},
"notice": null,
"usage": {
"cost": 0,
"balance": 48.14,
"replayed": false
}
}