JavaScript / Node.js SDK
Use the official venym-search client with native fetch, TypeScript types, Search, Scrape, and health methods.
Install
The package is
venym-search. The client defaults to https://search.venym.io and sends the API key as a Bearer credential.Native fetch
Works in Node and compatible edge runtimes.
Typed contract
Request and response fields match the v2 API.
Safe errors
Auth and rate-limit errors have dedicated classes.
Installation
npmcURL
npm install venym-searchSearch
VenymSearch.search()TypeScript
import { VenymSearch } from 'venym-search';
const client = new VenymSearch({
apiKey: process.env.VENYM_SEARCH_API_KEY,
});
const result = await client.search({
query: 'latest AI developments',
max_results: 5,
});
console.log(result.search_results);
console.log(result.remaining_credits);Scrape
VenymSearch.scrape()TypeScript
const page = await client.scrape({
url: 'https://example.com',
extract_options: ['title', 'text', 'links', 'metadata'],
});
console.log(page.primary_content.title);
console.log(page.primary_content.text);Scrape accepts one URL per request. Coordinate multiple calls in your own bounded worker; there is no batch method in v2.
Health
VenymSearch.health()TypeScript
const health = await client.health();
console.log(health.status);Error Handling
Typed error handlingTypeScript
import {
AuthenticationError,
RateLimitError,
VenymSearchError,
} from 'venym-search';
try {
await client.search({ query: 'test' });
} catch (error) {
if (error instanceof AuthenticationError) {
console.error('Check VENYM_SEARCH_API_KEY');
} else if (error instanceof RateLimitError) {
console.error('Retry after', error.retryAfter, 'seconds');
} else if (error instanceof VenymSearchError) {
console.error(error.status, error.body);
}
}Keep VENYM_SEARCH_API_KEY server-side. For the raw HTTP contract, see the REST reference.