Making requests
/v1/search takes the same query you would type into the search
box, plus a few parameters. It answers to GET and to
POST; the parameters are the same either way.
Parameters
| Name | Default | Meaning |
|---|---|---|
query | required | The search string. Same syntax as the website - see query syntax. Several phrases must all match; for either one, use (a | b). |
page | 1 | 1-based. |
per_page | 100 | Up to your plan's row limit, and so is page × per_page: a plan covers the first N rows of a query, paging does not go past them (400 page_too_deep); /v1/account reports it as max_per_page. With snippets=1 both are capped by the plan's rows with snippets, max_per_page_snippets. |
snippets | off | 1 to include the matching text. Spends snippet quota. |
format | json | One of six - see response formats. |
columns | depends on format | Comma-separated subset of domain, url, rank, ranked, title, snippets. |
delimiter | ; / tab | For csv and tsv. |
header | off | 1 to put a header line on csv and tsv. |
A parameter not in this table is not an error: it is ignored, and query_note names it.
GET
curl -H "Authorization: Bearer $PUBLICWWW_KEY" \
"https://api.publicwww.com/v1/search?query=%22angular.min.js%22&page=2&per_page=50"
Remember to url-encode the query. Quotes, slashes and + all matter.
POST
The same parameters as a JSON body. Use it when the query is long or has several phrases: a multi-line query in a url runs into length limits in proxies and clients long before the server minds.
curl https://api.publicwww.com/v1/search \
-H "Authorization: Bearer $PUBLICWWW_KEY" \
-H "Content-Type: application/json" \
-d '{"query": ["\"angular.min.js\"", "\"bootstrap.min.css\""],
"per_page": 50,
"snippets": true}'
An array of phrases means all of them, exactly as separating them with
newlines in the query string would. In the example above 70,907 sites
carry the first phrase and 35,536 carry both. For either one of them, write
("angular.min.js" | "bootstrap.min.css").
The array takes operators and exclusions as its items too. Sites in the .au zone with reCAPTCHA v3, without the explicit render:
curl https://api.publicwww.com/v1/search \
-H "Authorization: Bearer $PUBLICWWW_KEY" \
-H "Content-Type: application/json" \
-d '{"query": ["site:au", "\"recaptcha api js render\"", "-\"render explicit\""],
"per_page": 50}'
total counts the websites where every item matched. Put a phrase in
quotes: without them its words are matched one by one, anywhere in the page.
JSON types are understood: true works where the query string
needs 1. When a parameter is given in both the url and the body,
the body wins.
The response
Results come most popular first. To find websites about a topic rather than by
their code, search for like:"online course" site:de and read the first
rows: like: orders results by similarity instead and removes none, so
total stays large. In "static.hotjar.com" like:"online course"
the phrase selects the websites and like: orders them.
| Field | Meaning |
|---|---|
query | The query that was run. It differs from the one sent when operators of other search engines were rewritten (OR, AND, body= and the like - see Basics), a domain in another alphabet after site: became punycode, words in other alphabets moved into like:"..." (see Languages), or a second site: was removed. |
original_query | Only in those cases: the query as sent. |
total | How many sites match, in the whole index; with depth:, how many pages. A real count - up to 1,000,000, the most a search counts - unless total_exact is false. |
total_capped | Present and true when total is that ceiling: the search found more than a million. |
total_exact | Present and false when the search reached its time limit: total counts only what was found in time, and there are more. The rows are the most popular of the matches; later pages may run short. A narrower query - a longer phrase or site: - finishes in time. |
total_estimate | With total_exact, when it can be estimated: about how many there are in all. |
total_pages | total divided by per_page, rounded up. It can be more than your plan can reach: paging stops at the plan's row limit. |
returned | How many rows this page actually carries. |
truncated | Whether your plan's disclosed-position limit removed any of them. false is about this page only and does not mean these are all the results: see total and total_pages. |
index_complete | false when part of the index did not answer at all: the rows and total may be short. Repeat the request a little later if you need them whole. A search that reached its time limit answers, and says so with total_exact. |
took_ms | How long the search took, in milliseconds. |
query_note | Appears when the query uses like: (total then counts everything the other conditions let through), was rewritten, has operators of other search engines that are searched as typed, carries a parameter not listed above (it is ignored), or could not be run as written: it only excludes, could not be read, or like: has nothing to compare with. Characters that only separate words get no note: Blumengeschäft is searched as blumengesch ft - see Languages. |
results | The rows. |
A row
| Field | Meaning |
|---|---|
domain | The site. |
url | The page the match was found on, which for depth: searches is not the home page. |
rank | Place by popularity, 1 is the most popular: an estimate put together from several sources, with no exact formula and no guarantees. null when the site has no rank. With like: the order is not by rank. |
ranked | false exactly when rank is null. |
title | Only with snippets=1. The page's <title>, up to 200 characters on one line; an empty string when the page has none. |
snippets | Only with snippets=1. Up to five {"text", "match"} pairs, where match is what matched and text is it with surrounding context. A query with no phrase, such as like: alone, has nothing to match: the fragment is then the page's <title>. |
Paging and bulk
Page through with page, or take everything in one answer with a
large per_page, up to max_per_page. There is no separate
export endpoint; the answer is streamed as it is built, not held in memory.