Research

Run Research

Research the lead and its company now; store the result and add a `research_completed` event to the timeline. Without an `icp` in the body, fit is scored against the workspace ICP from `/workspaces/current/profile` (generic B2B fit if that is empty too). 404 for a missing lead, 422 when no source could be gathered, 502 when the model call fails. With `RESEARCH_ASYNC=true` (off by default) the lead is checked (404), the research is queued as a background job and the response is 202 with the job; poll `GET /leads/{id}/research/jobs/{job_id}` and read the result with `/research/latest`. A repeated request while that job is queued or running returns it.

API key access

Needs the leads:write scope with an API key (ro_pat_...). A signed-in session uses the caller's role.
POST/api/v1/leads/{lead_id}/research
AuthorizationBearer <token>

Access token from /api/v1/auth/login, or an API key (ro_pat_..., RO-176) from /api/v1/workspaces/current/api-keys: the key implies its workspace and needs the route's scope. MCP connectors (/api/v1/mcp only) may use an OAuth access token (ro_oat_..., RO-284).

In: header

Path Parameters

lead_idLead Id
Formatuuid

Header Parameters

Idempotency-Key?Idempotency-Key

With RESEARCH_ASYNC: a replay with the same key returns the first job.

X-Workspace-Id?X-Workspace-Id

Id of the workspace to act on (must be a member).

Response Body

curl -X POST "http://localhost:8000/api/v1/leads/497f6eca-6276-4993-bfeb-53cbbbba6f08/research" \  -H "Idempotency-Key: string" \  -H "X-Workspace-Id: string" \  -H "Content-Type: application/json" \  -d '{}'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9",
  "lead_id": "9bddab70-98e6-43a9-8f32-c9788b9de0c0",
  "company_id": "b2e6a1c3-1a5e-44ae-a8fd-81f76fd715cf",
  "requested_by_id": "e5a2565f-0ccc-4e3e-ace9-5e0c44253010",
  "summary": "string",
  "hooks": [
    {
      "text": "string",
      "source_url": "string"
    }
  ],
  "fit_score": 0,
  "fit_reasons": [
    "string"
  ],
  "risks": [
    "string"
  ],
  "sources": [
    {
      "url": "string",
      "title": "string",
      "kind": "website",
      "published_at": "string"
    }
  ],
  "errors": [
    "string"
  ],
  "dropped_hooks": 0,
  "prompt_id": "string",
  "model": "string",
  "created_at": "2019-08-24T14:15:22Z"
}
{
  "job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f",
  "lead_id": "9bddab70-98e6-43a9-8f32-c9788b9de0c0",
  "status": "string",
  "deduplicated": true
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}