Enrich
enrichAdds AI-researched columns to dataset rows or inline input, filling pending, stale, or failed cells with researched values.
Instructions
enrich
Add AI-researched columns to rows. Rows come from exactly one of dataset_id (ds_..., preferred) or input (inline, columnar: { "Header": ["row1", "row2"] }, all arrays equal length; a one-off, nothing kept).
Preferred: put the rows in a dataset first (build_dataset with rows + attributes or enrichment_id, free; it keeps the rows and filled cells), then enrich with its dataset_id: fills its cells with its enrichment; no column config needed. Default scope: every pending, stale, or failed cell; columns, rows, positions narrow it; force: true re-runs filled cells. prompt + attributes fills the named columns, adding the missing ones first; output is refused (update_dataset sets a column's prompt / schema / tool). help with datasets.
With input, column config is exactly one of, most consistent first:
enrichment_id— a saved enrichment (enr_...,list_enrichments): fixed, tested config; up to 10,000 rows; input headers must match its input columns (get_enrichment).prompt+attributes— the task and up to 20 column names; no setup; up to 1,000 rows.output— per columnprompt, optionaloutput_schema, optional pinnedtool; up to 1,000 rows.helpwithcolumn_configorexamplesfirst.
Returns a run. Poll get_run_result with wait: 50 (or pass webhook_url); a dataset fill's result is { "rows": [...] }, only the rows it ran. estimate_cost: true prices it without running. A legacy key in the response means the call took a legacy mode (a legacy enrichment's id, legacy-pipeline column fields); follow legacy.successor.
Example — Run a saved enrichment: { "enrichment_id": "enr_018f5b60-1234-7abc-89ab-0123456789ab", "input": { "Company Name": [ "Acme Corp", "Tech Solutions Inc" ] } }
Example — Prompt + attributes (a task and column names): { "prompt": "Research each company", "attributes": [ "CEO", "Employee Count", "Industry" ], "input": { "Company": [ "Apple", "Google" ] }, "webhook_url": "https://your-server.com/webhook" }
Example — A spec per output column: { "output": { "Employee Count": { "prompt": "Find the number of employees at this company", "output_schema": { "type": "integer" } } }, "input": { "Company": [ "Apple", "Google" ] } }
Example — Fill a dataset's pending, stale, and failed cells: { "dataset_id": "ds_018f6a70-1234-7abc-89ab-0123456789ab" }
Example — Re-run one column on rows 10–12, even if filled: { "dataset_id": "ds_018f6a70-1234-7abc-89ab-0123456789ab", "columns": [ "CEO" ], "positions": [ 10, 11, 12 ], "force": true }
Workflow: Starts an async run. Call get_run_result with the returned run id and wait: 50 until status is 'success'; its output is the result.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | No | With dataset_id: only these rows (row_... ids). May be combined with positions. Default: every row. | |
| force | No | With dataset_id: re-run every cell in scope, whatever its state (the same as states naming every state). | |
| input | No | Row source: inline columnar data | |
| output | No | Config source: a spec per output column (prompt, output_schema, tool) | |
| prompt | No | Config source: the task the agent follows for every row (requires attributes) | |
| states | No | With dataset_id: the cell states to run, e.g. ["not_found"] to research the not-found cells again. Default: pending, stale, failed. Not combined with force. | |
| columns | No | With dataset_id: only these output columns (by name). Default: every output column. | |
| run_key | No | Optional idempotency key, unique per account. Becomes the run id ("run_<run_key>"), so it is limited to letters, digits, and . _ ~ - characters. A duplicate returns 409. | |
| targets | No | With dataset_id: several boxes of columns × rows in one run, e.g. CEO on rows 3-4 and HQ on rows 20-22. The scope is their union. Not combined with the flat columns / rows / positions. | |
| positions | No | With dataset_id: only the rows at these positions (from 1, as list_dataset_rows reports them). May be combined with rows. | |
| attributes | No | Config source: the output column names, typed from their names (requires prompt). Max 20. | |
| dataset_id | No | Row source: a ds_... id. Fills the dataset's cells with its bound enrichment; no column config with it. | |
| max_credits | No | Credit ceiling. Refused with 422 credit_cap_exceeded (nothing charged) when the estimate's maximum exceeds it. | |
| webhook_url | No | URL to POST the results to when the run completes | |
| enrichment_id | No | Config source: id of a saved enrichment (enr_...) | |
| estimate_cost | No | Validate and price the request without running or charging anything; the 200 response is the credit estimate (EstimateCostResult). | |
| allow_duplicate_input | No | With enrichment_id — allow re-running rows already present in the enrichment |