# Lead searches and credits

> A lead search is planned before it runs, and the credits are shown before anything is spent.

Web page: https://www.signalvan.com/developers/searches-and-credits

## Plan

[Plan a lead search](https://www.signalvan.com/developers/reference/plan-search) works it out exactly as the SignalVan app does and keeps it for 15 minutes behind a `plan_id`. The plan is tied to the key and the website that made it. It says what will run (`summary`, `intent_signals`, `settings`), any settings still `missing`, and the `credits`: suggested, minimum, the split per intent signal and your balance. `ready` is true when it can start. Planning spends no credits.

## Start

[Start a lead search](https://www.signalvan.com/developers/reference/start-search) takes the `plan_id` and `confirm: true`, which means the person saw the credits and agreed. It answers `202` with the lead search. A plan starts at most one lead search: starting it again answers the same lead search. When the same lead search ran in the last 7 days, its leads are reused (`200`, `reused: true`); send `refresh: true` to run it again.

## Follow

A lead search is `queued`, `running`, `done` or `error`, with its `progress`. [Wait for a lead search](https://www.signalvan.com/developers/reference/wait-for-search) holds for up to 50 seconds and answers as soon as it finishes; call it again until `finished` is true. Then read its [leads](https://www.signalvan.com/developers/reference/list-leads) and [companies](https://www.signalvan.com/developers/reference/list-companies). Every lead search has an `app_url` to open it in SignalVan.

## Credits

Lead searches use the same credits as the app, from the same balance, and show in Credit history. Spending answers carry your balance; `credits.low` is true under 100 credits. A lead search uses at most its `max_credits`. Not enough credits answers `402 not_entitled` with a hint and a link to top up.

## Two lead searches at a time

Each website runs at most two lead searches at once. A third answers `409 busy`: wait for one to finish, then start it.

> Outreach and billing continue in the SignalVan app; every answer links there with `app_url`.
