Searches
Turn the results of Piloterr searches into rows, searched again before every run, then fetch each result's details.
A search input runs a Piloterr search endpoint (Allegro, Amazon, Fnac…) for each of its searches and turns each result into a row: run a product endpoint over every product the searches find, for instance listing_url mapped to Allegro Product. The searches run again before every run, so a scheduled project follows new results. queries is required.
{
"input": {
"type": "search",
"endpoint_id": "ALLEGRO_SEARCH_ENDPOINT_ID",
"queries": ["iphone 15", "https://allegro.pl/listing?string=galaxy%20s25"],
"pages": 5
}
}endpoint_idis a search endpoint fromGET /v1/endpoints: its path ends in/searchand it takes aquery(orkeyword).queriesholds 1 to 100 searches, each run on its own, one after the other: keywords, or search URLs when the endpoint takes them in itsquery(most do, such ashttps://allegro.pl/listing?string=…). Each is trimmed and up to 2,000 characters; an empty one is refused (422 validation_failed), repeats are dropped. Each row'ssearch_querycolumn (its first column) says which search found it.paramsholds up to 10 other parameters of the search, the same at every run, such as Amazon's{"domain": "de"}. Notquery(orkeyword) norpage. A required parameter must be set.pages, 1 to 50 (default 5), is how many pages of results a run reads for each search when the endpoint has apageparameter, with at most 1,000 calls per run (searches × pages). A search stops at its last page: when the answer'spaginationsays there is no next one (has_next_page,total_pages,next…), or when a page comes back empty or the same as the one before. Without pages, one call per search, whateverpagessays.- The results are taken from
results, else from the answer's largest list of objects, or from the answer itself when it is a list. Every field becomes a column, read like a JSON file: nested values as JSON text. - Each page is one call of the search endpoint, billed like any call, with the project's API key (the managed Dataflow key unless you chose one). A page that hits a rate limit, a server error or a timeout is tried once more. Up to 100,000 rows in all.
- The search calls are made when the run starts, before its rows are called. They are in the run's
search_credits, and count in itscreditsand itsmax_cost_per_run. The balance check that follows counts what is left after them, against the rows the run may call. When your workspace runs out of credits during the searches, the run is not created: see When a search fails.
Test a search before you create the project: POST /v1/inputs/search/preview runs the first page of the first search, with the managed Dataflow key, and returns the same summary as an upload: an empty id (nothing is stored), the first search as filename (iphone 15 (+1) when there are more), the first 10 results as sample. It is billed as one call of the search endpoint. Creating or updating the project runs that first page again, with the project's key, to check the mapping. Both answer 402 insufficient_credits, with error.details.stage: "search", when your workspace is out of credits for that call, and 422 api_key_invalid when the key cannot be used (the managed key inactive, or the project's own key gone, inactive or expired).
curl https://dataflow.piloterr.com/v1/inputs/search/preview \
-H "x-api-key: YOUR_API_KEY" -H "content-type: application/json" \
-d '{"endpoint_id": "ALLEGRO_SEARCH_ENDPOINT_ID", "queries": ["iphone 15", "galaxy s25"]}'From a search to each product
A search only lists results. To get each product's details, the project's endpoint is the site's detail endpoint, called once per result, with its required parameter mapped to a column of the results. Its description in GET /v1/endpoints says what it takes:
| Search | Then, for each result | Mapping |
|---|---|---|
| Amazon Search | Amazon Product, Amazon Product Offer | query ← asin, domain ← the search's domain |
| Allegro Search | Allegro Product | query ← listing_url |
| Fnac Search | Fnac Product | query ← url |
| Decathlon Search | Decathlon Product | query ← url, region ← the search's region |
Map a page URL column, never image_url or a seller's link. Give a parameter both endpoints take (Amazon's domain, Decathlon's region) the search's value, so both read the same marketplace. search_query can feed a parameter too, or be kept to group the results by search.
A project that reads the details of every PlayStation 5 and Nintendo Switch 2 on amazon.de, 3 pages of each search, every day:
curl https://dataflow.piloterr.com/v1/projects \
-H "x-api-key: YOUR_API_KEY" -H "content-type: application/json" \
-d '{
"name": "Consoles on amazon.de",
"endpoint_id": "AMAZON_PRODUCT_ENDPOINT_ID",
"input": {
"type": "search",
"endpoint_id": "AMAZON_SEARCH_ENDPOINT_ID",
"queries": ["playstation 5", "nintendo switch 2"],
"params": { "domain": "de" },
"pages": 3
},
"mapping": {
"query": { "column": "asin" },
"domain": { "value": "de" }
},
"schedule": { "interval": "daily", "timezone": "Europe/Berlin" }
}'A run costs the search calls (2 searches × up to 3 pages, each billed as one call of Amazon Search, in the run's search_credits) plus one call of Amazon Product per result. In the dashboard, the Search tab says which endpoints can follow the search, and the next step offers them with the mapping already made.
When a search fails
An endpoint that is not a search, a parameter it does not take, a required parameter left out, no search at all, or more than 1,000 calls (searches × pages) is refused with 422 search_invalid, when you preview the search or save the project.
At a run:
- When one of the searches fails, the run fails with reason
source_unreachable, as a URL does. With several searches, the event'serrornames the one that failed (“iphone 15”: The search failed: …). The results of the searches that read fine are not kept. - When the workspace runs out of credits during the searches, no run is created:
POST /v1/projects/{id}/runsanswers402 insufficient_creditswitherror.details.stage: "search", and a scheduled run is skipped (schedule.skippedandcredits.insufficient), without counting as a failure. The search calls already made are billed. - When the searches together find nothing, or more than 100,000 results, the run fails the same way. One search finding nothing while the others find results is fine.
- When the results lost a column the mapping uses, the run fails with
mapping_invalid. - When the project's own API key is deleted, inactive or expired, the run fails with
api_key_invalidand the project is disabled until you choose another key. It never falls back to the managed key. When the managed Dataflow key is inactive, the run fails the same way, but the project is not disabled.