Skip to main content
The stophy package gives you typed calls to Stophy from Node.js, Bun, Deno and the browser.

Make a call

No account, no key.
Every response has success, data, creditsUsed and requestId. A list is in data.results. Methods follow the endpoint id. google.search is stophy.google.search(...), and reddit.search is stophy.reddit.search(...). The inputs and results are typed, so a missing required field is a compile error. The API reference lists every endpoint.

Use a key

Without a key you can call the endpoints marked keyless: true in the catalog, and you get the first page only. Every other call throws a StophyError with code unauthorized. Set STOPHY_API_KEY and new Stophy() picks it up. Or pass it in:
new Stophy("your key") works too.

Find endpoints

Page through results

A list call returns one page. When there is more, data.cursor is set. Pass it back to get the next page. This needs a key.
Some endpoints take a page number instead, like google.search. See Page through results.

Handle errors

The SDK retries network errors and the statuses 429, 500, 502, 503 and 504 for you, and waits as long as the API asks. If the API asks for more than 60 seconds, it throws at once with retryAfterSeconds set. A failed call costs nothing. See Errors for every code.

Options

Check your usage

These need a key.
balanceMicros is your balance in millionths of a dollar. One credit is 1,500, so divide by 1,500 to get credits. See Usage and Logs.