@greyhq/sdk
v0.1.1
Published
TypeScript SDK for the Grey company intelligence API
Maintainers
Readme
Grey TypeScript SDK
The official TypeScript SDK for Grey's company intelligence API. It provides resource methods, typed parameters and results, and a Fetch client with no runtime package dependencies.
Install
npm install @greyhq/sdkUse
import { Grey } from "@greyhq/sdk";
const grey = new Grey({
baseUrl: "https://grey.app", // https://grey.test locally
auth: apiKey, // supplied by server-side code, without the Bearer prefix
});
const companies = await grey.companies.search({
query: "Example",
limit: 10,
});
const company = await grey.companies.get({
companyId: "NO:974760673",
});
const contact = await grey.people.revealContact({
personId: "person-1",
includeEmail: true,
});
const matches = await grey.screen({
query: "Companies in Oslo",
limit: 10,
});The other company reads use names such as listFinancials, getDescription, listPeople, and listTechnologies. Health is available through grey.health.check(). Public operation types have matching names such as CompaniesSearchResponse, PeopleRevealContactResponse, and ScreenResponse.
Each instance owns its client and credentials. Base URLs are origins without /api/v1; generated operation paths already contain that prefix. API keys belong in server-side code.
Calls return response data directly and throw on failure by default. API failures preserve Grey's error body, including its request ID. Network and cancellation failures throw the underlying transport error. Callers own retries and error handling. JSON date strings remain strings; the SDK does not perform runtime response validation.
Pass request options separately from API parameters:
await grey.companies.search(
{ query: "Example" },
{ signal: controller.signal },
);The fetch constructor option supports custom transports and testing. Low-level Fetch utilities remain available through @greyhq/sdk/client.
See the TypeScript SDK guide and API reference for the complete client API.
