Ir al contenido
Won.dev
DocumentaciónReferencia de la API

Tareas

Ejecuta en segundo plano hasta 100 búsquedas o 500 leads, con cobro por parte, y lee los resultados cuando terminen.

Una tarea hace por ti muchas llamadas a un mismo endpoint en segundo plano, para que un agente no tenga que enviarlas una por una ni mantener una conexión abierta mientras se ejecutan.

  • enrich.people.email.find, enrich.email.verify y signals.find reciben inputs: hasta 100 partes, cada una el cuerpo de una llamada. trade.leads.find recibe un solo input cuyo limit llega a 500, y la tarea recorre la lista por ti.
  • Cada parte se ejecuta y se cobra exactamente como una llamada propia, así que una tarea cuesta lo que cuestan sus llamadas. Crear, consultar, listar y cancelar una tarea es gratis. max_cost rechaza una tarea que podría costar más, y dry_run: true dice lo máximo que puede costar.
  • Crear una tarea responde 202 Accepted de inmediato, con la URL de la tarea en el encabezado Location: síguela ahí con GET /tasks/{id} hasta que status deje de ser running.
  • Una tarea que se queda sin saldo, o sin el presupuesto de su clave, se detiene como failed y conserva lo que hizo.
  • Cuando una tarea termina, task.completed llega a tus webhooks y a GET /events. Tu propia metadata, como el ID de un cliente, vuelve en la tarea y en ese evento.
  • Los resultados se guardan 7 días después del final, o 1 día cuando una fuente no permite guardarlos. La tarea en sí aparece en la lista durante 30 días.
  • Una clave de prueba ejecuta cada parte en el sandbox, nunca genera cargos y solo ve las tareas creadas con una clave de prueba.
  • Lo mismo está disponible en las herramientas task_create y task_get del servidor MCP.

Crear una tarea

Ejecuta en segundo plano muchas llamadas a un mismo endpoint: hasta 100 búsquedas de correo de trabajo (enrich.people.email.find), verificaciones de direcciones (enrich.email.verify) o revisiones de señales de empresas (signals.find), una por cada elemento de inputs, o hasta 500 leads (trade.leads.find) a partir de un solo input cuyo limit llega a 500. Cada parte funciona exactamente como una llamada propia: se cobra al precio del endpoint por lo que devuelve, y las repeticiones y los resultados pagados en los últimos 30 días son gratis. Crear la tarea es gratis. max_cost rechaza una tarea que podría costar más, y dry_run: true dice lo máximo que puede costar. Una tarea que se queda sin saldo o sin presupuesto de su clave termina como failed y conserva lo que hizo. Síguela con GET /tasks/{id} o espera el evento task.completed. Los resultados se guardan 7 días después del final. Con un encabezado Idempotency-Key, un reintento nunca crea una segunda tarea. Endpoints: trade.leads.find, enrich.people.email.find, enrich.email.verify, signals.find.

POST
/tasks

Autenticación

apiKey
headerAuthorizationBearer <clave de API>

Authorization: Bearer won_live_..., a key from the console.

Parámetros de encabezado

Idempotency-Key?string

Any unique string. A retry with the same key and the same body returns the first response and is not charged again.

Longitudlength <= 255

Cuerpo de la solicitud

application/json
  1. body
operation*string

What to run: trade.leads.find, enrich.people.email.find, enrich.email.verify, signals.find.

Valores"trade.leads.find""enrich.people.email.find""enrich.email.verify""signals.find"
inputs?array<>

For a batch: up to 100 parts, each the body of one call of the endpoint, such as {"email": "jane@example.com"}.

Elementos1 <= items <= 100
input?

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.

Rango0 < value
dry_run?boolean

Only say the most the task can cost. Nothing is created or charged.

Valor predeterminadofalse
metadata?

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.

Cuerpo de la respuesta

Nothing was started: the answer to dry_run: true.

application/json
  1. response
data*

The task, and the most it can cost.

notice*|

A plain sentence when there is something to know about this answer. Null otherwise.

usage*

Nothing is charged here. The balance, for reference.

Solicitud de ejemplo
curl -X POST 'https://api.won.dev/v1/tasks' \  -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"  }}'
Respuesta de ejemplo
{  "data": {    "dry_run": true,    "max_cost": 0,    "task": {      "id": "string",      "operation": "string",      "status": "running",      "progress": {        "done": 0,        "total": 0,        "failed": 0      },      "cost": 0,      "max_cost": 0,      "error": {        "code": "string",        "message": "string"      },      "metadata": {        "property1": "string",        "property2": "string"      },      "created_at": "string",      "completed_at": "string",      "results_expire_at": "string"    }  },  "notice": "string",  "usage": {    "cost": 0,    "balance": 0,    "replayed": true  }}

Consultar una tarea

Una tarea, cuánto avanzó y cuánto costó, con sus resultados en orden: cada uno es la respuesta que da una llamada al endpoint, con su estado HTTP. Recorre los resultados con cursor. Mientras status sea running, vuelve a consultar en un minuto o espera el evento task.completed. Los resultados se eliminan 7 días después del final (results_expire_at). Gratis.

GET
/tasks/{id}

Autenticación

apiKey
headerAuthorizationBearer <clave de API>

Authorization: Bearer won_live_..., a key from the console.

Parámetros de ruta

id*string

Task ID, such as task_7p1q8w3e5r4k2m9x.

Longitudlength <= 40

Parámetros de consulta

limit?integer

How many to return, 1 to 100.

Rango1 <= value <= 100
Valor predeterminado20
cursor?string

To get the next page, pass next_cursor of the previous response back unchanged, with the same parameters.

Longitudlength <= 200

Cuerpo de la respuesta

The result.

application/json
  1. response
data*

The task, and a page of its results.

has_more*boolean

Whether more results follow this page.

next_cursor*|

Pass it as cursor to get the next page of results. Null on the last page.

notice*|

A plain sentence when there is something to know about this answer. Null otherwise.

usage*

Nothing is charged here. The balance, for reference.

Solicitud de ejemplo
curl -X GET 'https://api.won.dev/v1/tasks/task_7p1q8w3e5r4k2m9x?limit=1'
Respuesta de ejemplo
{  "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  }}

Listar tareas

Tus tareas, de la más reciente a la más antigua, con su estado, su avance y su costo. Sus resultados se obtienen con GET /tasks/{id}. Gratis.

GET
/tasks

Autenticación

apiKey
headerAuthorizationBearer <clave de API>

Authorization: Bearer won_live_..., a key from the console.

Parámetros de consulta

limit?integer

How many to return, 1 to 100.

Rango1 <= value <= 100
Valor predeterminado25
cursor?string

To get the next page, pass next_cursor of the previous response back unchanged, with the same parameters.

Longitudlength <= 200

Cuerpo de la respuesta

The result.

application/json
  1. response
data*array<>

The tasks, newest first.

has_more*boolean

Whether more follow this page.

next_cursor*|

Pass it as cursor to get the next page. Null on the last page.

notice*|

A plain sentence when there is something to know about this answer. Null otherwise.

usage*

Nothing is charged here. The balance, for reference.

Solicitud de ejemplo
curl -X GET 'https://api.won.dev/v1/tasks?limit=1'
Respuesta de ejemplo
{  "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  }}

Cancelar una tarea

Detiene una tarea en curso: no empieza ninguna parte más. Las partes que ya estaban en curso terminan y se cobran como siempre, y todo lo que hizo se conserva. Envía task.completed con status: canceled. Gratis.

POST
/tasks/{id}/cancel

Autenticación

apiKey
headerAuthorizationBearer <clave de API>

Authorization: Bearer won_live_..., a key from the console.

Parámetros de ruta

id*string

Task ID, such as task_7p1q8w3e5r4k2m9x.

Longitudlength <= 40

Parámetros de encabezado

Idempotency-Key?string

Any unique string. A retry with the same key and the same body returns the first response and is not charged again.

Longitudlength <= 255

Cuerpo de la respuesta

The result.

application/json
  1. response
data*

The task, canceled.

notice*|

A plain sentence when there is something to know about this answer. Null otherwise.

usage*

Nothing is charged here. The balance, for reference.

Solicitud de ejemplo
curl -X POST 'https://api.won.dev/v1/tasks/task_7p1q8w3e5r4k2m9x/cancel'
Respuesta de ejemplo
{  "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  }}

Última actualización: