agentleFS
LeadMagicLeadMagic/leadmagic-skills/skills/bulk-jobs/SKILL.md

bulk-jobs

Skill0 starsChanged 4 months agoMITView on GitHub

LeadMagic bulk enrichment jobs, CSV uploaders, and synchronous mini-batches. Use when enriching any list of 50+ rows, submitting POST /bulk/submit, uploading a CSV, polling job status, pausing or resuming a job, pulling error rows, configuring callbacks, or budgeting per-row credits for any product.

  • Reads credentials
  • Sends data out

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep an immutable manifest: {job_id, product, rows} with rows in exact submission order.

    line 32
  2. Very specific:

    Verify every lm_input identity against manifest.rows[result.row_index] before applying output.

    line 34
  3. Distinctive:

    Stop the merge on any mismatch, missing identity, invalid index, or ambiguous duplicate.

    line 35
  4. Distinctive:

    Always preview cost and state projected spend before submitting.

    line 77

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

LeadMagic — Bulk jobs & uploaders

Async enrichment for lists. Bills per successful row at the same rate as the matching single-request product; failed rows are free. Any list ≥ 50 rows belongs here — never a loop of single calls.

Workflow

  1. Preflight: GET /v1/credits + POST /v1/batch/preview-cost (both free).
  2. Validate mapping (free): POST /bulk/validate.
  3. Save the exact ordered submitted rows and their original record IDs, then submit: POST /bulk/submit. Bind the saved manifest to the returned job ID.
  4. Poll GET /bulk/jobs/{jobId} ≥45s apart, or set a callback webhook, or stream GET /bulk/jobs/{jobId}/stream.
  5. Fetch: GET /bulk/jobs/{jobId}/download (file) or /results / /rows (paged). Failed rows: /errors (free) — fix and resubmit only the misses.
  6. Validate identity for the entire merge before writing. Follow the join contract below.

Result identity and safe joins

  • For ordinary one-input/one-result enrichment, row_index is zero-based within that job's submitted data. CSV headers and blank records are excluded. It is not the original spreadsheet row number or a result's position on a page.
  • Keep an immutable manifest: {job_id, product, rows} with rows in exact submission order. Keep original record IDs alongside it, especially after filtering, sorting, batching, or retries. Each new job starts its own indices.
  • Fetch all required pages from the manifest's job ID. /results returns {rows, limit, offset}. Status filters leave gaps in source indices. Never zip the returned array onto a CSV or use offset + array_position as the source index.
  • Verify every lm_input identity against manifest.rows[result.row_index] before applying output. For profiles, also compare the returned profile identity when present. A changed profile URL may be an alias; quarantine it for review rather than silently treating it as the same person.
  • Stop the merge on any mismatch, missing identity, invalid index, or ambiguous duplicate. Report counts and job ID; preserve the input file. Never guess an offset or overwrite another person's fields.
  • A single source row can appear more than once in multi-product jobs. Local Leads is a fan-out product with display indices. Neither supports the simple one-result-per-source join below.

For a single-product profile_search job, the bundled checker validates all supplied pages before creating a new JSON file. It rejects duplicate indices, wrong-job manifests, and mismatched profile identities. It does not modify the input or contact the API:

python3 scripts/check-profile-results.py --manifest manifest.json \
  --job-id "$JOB_ID_USED_TO_FETCH" --results page-0.json page-1.json \
  --output checked-results.json

Run from this skill's directory (or use its absolute script path). --job-id must be captured from the actual fetch URL, not copied from an unrelated manifest. Each page is the unchanged /results JSON response. The output contains {source, result} pairs, with the source taken from the saved submission, and reports whether all input rows are present. A partial result set must not be represented as a complete job. Use the retained original record IDs to merge into a master file only after validation.

Submit shapes

VariantBodyWhen
POST /bulk/submitrows | csv | fileUrlAuto-detect (recommended)
POST /bulk/jsonrowsJSON array
POST /bulk/csvcsvInline CSV string
POST /bulk/urlfileUrlRemote CSV/JSON/JSONL
POST /bulk/filemultipartAfter POST /bulk/upload-session
curl -sS -X POST "https://api.leadmagic.io/bulk/submit" \
  -H "X-API-Key: $LEADMAGIC_API_KEY" -H "Content-Type: application/json" \
  -d '{"product":"email_finder","rows":[{"first_name":"Jane","last_name":"Doe","domain":"acme.com"}]}'

Product keys

email_finder · email_validation · personal_email_finder · mobile_finder · b2b_profile_to_email · email_to_b2b_profile · profile_search · role_finder · company_finder · company_funding · job_change_detector — same per-row cost and input columns as the single-request product (column aliases normalize the same way).

Lifecycle & ops

  • GET /bulk/jobs?status=&product=&limit=&offset= — list jobs.
  • POST /bulk/jobs/{jobId}/pause · /resume · /cancel · /restart.
  • Diagnostics: GET /bulk/jobs/{jobId}/events, /logs, /metrics.
  • Out of credits mid-job: the job pauses rather than failing — top up, then /resume. Report rows done vs remaining.

Rules

  • Always preview cost and state projected spend before submitting; get user confirmation for large jobs.
  • Poll ≥45s; prefer callback for jobs over a few thousand rows.
  • Match rate matters: since misses are free, a conservative budget = rows × cost × expected match rate; a hard ceiling = rows × cost.
  • Synchronous mini-batch for small arrays (no job overhead): POST /v1/{product}/batch or POST /v1/batch (mixed products). Suppression lists: /v1/batch/suppression-lists.
  • MCP: submit_detected_bulk_job, process_attached_csv (chat CSV uploads), get_bulk_job_status, get_bulk_job_rows, get_bulk_job_errors, list_bulk_jobs.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.