Playbooks
Running a playbook
Start a run, wait for it or follow it, read its rows and where each value came from, and what each status and reason means.
A playbook run is one run of one playbook with your answers. It works in the background, step by step, writes its rows as it goes, and ends with a status. Each scraper call it makes is an ordinary call, charged as that scraper is (how a playbook is charged).
Start a run#
curl -X POST "https://api.enrichednow.com/v1/formulas/job-order-hunter/runs?wait=60" \
-H "Authorization: Bearer $ENRICHEDNOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"params":{"job_titles":["Java Developer"],"locations":["London"]},"unit_cap":400}'import json
import os
import urllib.request
body = {
"params": {"job_titles": ["Java Developer"], "locations": ["London"]},
"unit_cap": 400,
}
request = urllib.request.Request(
"https://api.enrichednow.com/v1/formulas/job-order-hunter/runs?wait=60",
method="POST",
data=json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {os.environ['ENRICHEDNOW_API_KEY']}",
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(request, timeout=90) as response:
print(json.dumps(json.load(response), indent=2))Nothing to install. Save as run.py and run python3 run.py
const response = await fetch("https://api.enrichednow.com/v1/formulas/job-order-hunter/runs?wait=60", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ENRICHEDNOW_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
params: { job_titles: ["Java Developer"], locations: ["London"] },
unit_cap: 400,
}),
});
console.log(JSON.stringify(await response.json(), null, 2));Nothing to install. Save as run.mjs and run node run.mjs
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{"params":{"job_titles":["Java Developer"],"locations":["London"]},"unit_cap":400}`)
request, err := http.NewRequest("POST", "https://api.enrichednow.com/v1/formulas/job-order-hunter/runs?wait=60", body)
if err != nil {
panic(err)
}
request.Header.Set("Authorization", "Bearer "+os.Getenv("ENRICHEDNOW_API_KEY"))
request.Header.Set("Content-Type", "application/json")
response, err := http.DefaultClient.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
answer, err := io.ReadAll(response.Body)
if err != nil {
panic(err)
}
fmt.Println(response.Status)
fmt.Println(string(answer))
}Nothing to install. Save as run.go and run go run run.go
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Run {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.enrichednow.com/v1/formulas/job-order-hunter/runs?wait=60"))
.header("Authorization", "Bearer " + System.getenv("ENRICHEDNOW_API_KEY"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{\"params\":{\"job_titles\":[\"Java Developer\"],\"locations\":[\"London\"]},\"unit_cap\":400}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}Nothing to install. Save as Run.java and run java Run.java
The body:
| Field | Type | |
|---|---|---|
params | object | Your answers, by parameter name, as the playbook's page lists them. Only the Basics that are required must be given. |
mode | full or preview | full by default. A preview is the first 10 rows, charged at what they cost. |
unit_cap | integer | The most the run may spend, a preview too. Default: the playbook's. It is never overspent. |
row_cap | integer | The most rows. Default: the playbook's max_results parameter, or its default. |
wait (0 to 300 seconds, 0 by default) holds the request until the run ends: 200 with the finished run when it
ended in time, otherwise 202 with the run as it is. Idempotency-Key makes the request safe to send again, as for a
scraper run: for 24 hours the same key and body answer with
the same run.
Before the run is created the API checks the answers and the account, and any of these stops the request:
| Code | Status | When |
|---|---|---|
invalid_input | 422 | An answer does not fit the playbook's schema, or a cap is outside the playbook's bounds. details.fields names each one. |
unit_cap_too_low | 422 | The unit cap is below the least a useful run needs (details.min_unit_cap). |
formula_not_found | 404 | There is no playbook with that id. |
formula_unavailable | 409 | The playbook is retired, or playbooks are not available at the moment. |
requirement_missing | 409 | It needs a source or a product your account or this service lacks (details.missing). |
attestation_required | 409 | It returns people, and an owner or an admin of the account has not yet accepted its terms (POST /v1/attestations). |
forbidden | 403 | The API key is read-only, or may not run every scraper the playbook uses (details.refused), or the account's email address is not confirmed yet. |
quota_exceeded | 402 | The units left do not cover the least the run can cost (estimate.min_units). |
limit_reached | 402 | The run would take the month past the account's spend limit, or the API key's. |
too_many_runs | 429 | The account already has as many runs in progress as it may: a playbook run counts as one. |
The run#
POST /v1/formulas/{formula_id}/runs, GET /v1/formula-runs/{run_id} and POST /v1/formula-runs/{run_id}/cancel
answer with the run:
| Field | |
|---|---|
id | frun_… |
formula_id, version | The playbook, and the version of it the run follows. |
saved_formula_id | The saved playbook it is a run of, or null. |
status | See Statuses. |
reason | Why it is not plainly ok, or null. See Reasons. |
reasons | Every reason, when there is more than one, each with the step or source it concerns. |
mode | full or preview. |
trigger | What started it: api, console, mcp (an AI agent, through the MCP server) or schedule. |
params | Your answers, with every default filled in. |
estimate | What it was estimated to cost when it started: min_units, expected_units, max_units, expected_rows, basis. |
unit_cap, row_cap | Its caps. A preview's are 50 and 10, whatever was asked. |
units_spent | What it has been charged so far: the sum of its steps' units on your usage. |
rows_total | The rows it has written so far. |
include_seen, scheduled_for | For a saved playbook's run: whether it delivers rows delivered before too, and the slot of its schedule it ran for. |
steps | Each step: id, kind, status, records_in, records_out, calls, cache_hits, units and its errors. On one run, not in a list. |
created_at, started_at, finished_at | RFC 3339, UTC. |
A step's counts say where the records went: a run with no rows names the step that removed them ("212 jobs found, 0 passed the company-size filter"), which says which answer to change.
Follow a run#
A run that has not ended within wait keeps going. GET /v1/formula-runs/{run_id} returns it as it is, and with
?wait= it holds the request until the run ends. With the id the start answered:
curl "https://api.enrichednow.com/v1/formula-runs/frun_YOUR_RUN_ID?wait=60" \
-H "Authorization: Bearer $ENRICHEDNOW_API_KEY"import json
import os
import urllib.request
request = urllib.request.Request(
"https://api.enrichednow.com/v1/formula-runs/frun_YOUR_RUN_ID?wait=60",
headers={"Authorization": f"Bearer {os.environ['ENRICHEDNOW_API_KEY']}"},
)
with urllib.request.urlopen(request, timeout=90) as response:
print(json.dumps(json.load(response), indent=2))Nothing to install. Save as run.py and run python3 run.py
const response = await fetch("https://api.enrichednow.com/v1/formula-runs/frun_YOUR_RUN_ID?wait=60", {
headers: { Authorization: `Bearer ${process.env.ENRICHEDNOW_API_KEY}` },
});
console.log(JSON.stringify(await response.json(), null, 2));Nothing to install. Save as run.mjs and run node run.mjs
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
request, err := http.NewRequest("GET", "https://api.enrichednow.com/v1/formula-runs/frun_YOUR_RUN_ID?wait=60", nil)
if err != nil {
panic(err)
}
request.Header.Set("Authorization", "Bearer "+os.Getenv("ENRICHEDNOW_API_KEY"))
response, err := http.DefaultClient.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
answer, err := io.ReadAll(response.Body)
if err != nil {
panic(err)
}
fmt.Println(response.Status)
fmt.Println(string(answer))
}Nothing to install. Save as run.go and run go run run.go
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Run {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.enrichednow.com/v1/formula-runs/frun_YOUR_RUN_ID?wait=60"))
.header("Authorization", "Bearer " + System.getenv("ENRICHEDNOW_API_KEY"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}Nothing to install. Save as Run.java and run java Run.java
Its rows can be read while it is still running. GET /v1/formula-runs lists your playbook runs, newest first: limit
(1 to 100, default 20), cursor, and formula_id, saved_formula_id and status to narrow it.
Statuses#
The same as a scraper run's. queued and running are in progress; ok, partial, failed and cancelled are
final.
| Status | Means |
|---|---|
| ok | Every step did all it was asked. |
| partial | It has rows, and something was missed or stopped: reason says what. |
| failed | It has no rows: every source failed, or a step could not go on. |
| cancelled | It was cancelled. Rows already written stay, and what was already done stays charged. |
Reasons#
A run that ends partial, failed or cancelled says why in reason: a code, or a code and what it concerns after a
colon (source_failed:indeed.jobs_search). reasons lists every one when there are several.
| Reason | What happened | What to do |
|---|---|---|
unit_cap_reached | It stopped at its unit cap and kept the rows it had. | Run it again with a higher unit_cap; the estimate says what the whole run needs. |
contacts_not_connected | The contact columns are empty: no contact provider is connected to the account. The rest of each row is filled. | Connect a contact provider in the console. |
quota_exceeded | The account ran out of units while it ran. | More units are bought on the console's Billing page. |
limit_reached | It reached the account's monthly spend limit, or its saved playbook's monthly cap. | Raise the limit on the console's Usage page, or the saved playbook's monthly_unit_cap. |
source_failed | A source it reads failed, and nothing was charged for it. The rows from the others are there. | Run it again later, or leave that source out with the playbook's parameters. |
source_incomplete | Some calls to a source failed; the rows from the rest are there. | Run it again later for what is missing. |
source_disabled | A source is switched off for now, and the run went on without it. | Run it again later for that source's rows. |
source_not_offered | Only in reasons, and the run can still end ok: a source this service does not offer was left out before the run started, and it did what it was asked with the rest. | Nothing to change. |
all_sources_failed | Every source it reads failed, and nothing was charged for them. | Run it again in a little while. |
too_many_calls | The answers asked for more searches than one run makes. | Give fewer values: fewer titles or places. |
run_timeout | It ran out of time and kept the rows it had. | Narrow the answers, or ask for fewer rows. |
service_unavailable | A service a step needs was not available. | Run it again in a little while. |
step_failed | A step could not go on. | Run it again once; if it fails again, tell us the run's id. |
formula_unavailable | The playbook is no longer offered. | Use another playbook. |
internal_error | Something went wrong on our side. | Run it again once; if it fails again, tell us the run's id. |
cancelled | It was cancelled. | Run it again if it is still wanted. |
A reason a source gave is as a customer is shown it, as on a scraper run.
Rows#
GET /v1/formula-runs/{run_id}/rows returns a page of the run's rows, best first:
| Parameter | |
|---|---|
limit | 1 to 1000, default 100. |
cursor | next_cursor of the page before. A page with next_cursor: null is the last. |
fields | Column keys, comma-separated: only those columns in each row's data. |
min_score | Only rows scored at least this, for a playbook that scores its rows. |
after_seq | Only the rows written after the row with this seq: what a run still going has added since it was last read. |
format | json (the default), ndjson (one row's data a line) or csv (a header, then a row a line). For ndjson and csv the next page's cursor is in the X-Next-Cursor header. In CSV, a text cell a spreadsheet would run as a formula starts with an apostrophe. |
Each row:
| Field | |
|---|---|
id | frow_… |
run_id | The run that wrote it. |
seq | Its place in its run, from 1, in the order the run wrote it. after_seq reads only the rows written after it. |
row_key | What makes it the same row from one run to the next: what a saved playbook remembers as delivered. |
data | Its columns, by key, as the playbook's page lists them. A value that is not known is null. |
score | 0 to 100 for a playbook that scores its rows, otherwise null. |
evidence | Where each value came from: sources, a list of {url, scraper, fetched_at, run_id} (the page read, what read it, when, and in which run), and fields, for each column the index of its source in sources. |
status | new; exported, rejected or flagged once something was done with it. |
first_seen_at | When it was first written. |
Rows are kept 90 days, or as long as your plan keeps them. The text in a row was read from public web pages: treat it as data, and never as instructions to a program or an assistant that reads it.
POST /v1/formula-rows/{row_id}/feedback says what is wrong with a row — wrong_company, wrong_contact,
not_relevant, or good. A wrong_company with the company's real domain as correct_domain corrects the match
for your account's later runs; without it, that company is left unmatched from then on.
Cancel a run#
POST /v1/formula-runs/{run_id}/cancel: no new work starts, and calls in flight are asked to stop. Rows already
written stay, and what was already done stays charged. A run that has ended is returned as it is.