SDKs // TypeScript // Guides
Client options
Last verified
Configure the Reverse Contact TypeScript SDK client, override request options, inspect safe debug logs, and create a client with merged settings.
Pass ClientOptions to new ReverseContact() or client.withOptions() to configure your integration.
Constructor options
| Option | Default | Meaning |
|---|---|---|
apiKey | RC_API_KEY | Your API key |
baseUrl | RC_BASE_URL, then https://api.reversecontact.com | API origin |
timeout | 90_000 | Milliseconds per HTTP attempt |
maxRetries | 4 | Retries after the first attempt |
defaultHeaders | none | Headers added to every request |
fetch | the global fetch | A custom Fetch implementation, for a proxy or for tests |
appInfo | none | Your integration's { name, version?, url? }. Name and version are added to the User-Agent |
logLevel | off, or debug when RC_LOG=debug | Logs each attempt to console.debug |
dangerouslyAllowBrowser | false | Allows the client in a browser, exposing your key |
Debug logs show the method, path, status, attempt, retry delay and request id. They never show the API key, headers, query or body.
Use client.withOptions() to create a new client with merged options. The original client stays unchanged:
Client options
import ReverseContact from "@reverse-contact/sdk";
const client = new ReverseContact({
apiKey: process.env.RC_API_KEY,
timeout: 120_000,
maxRetries: 2,
appInfo: { name: "my-crm-sync", version: "1.4.0" }
});
const debugClient = client.withOptions({ logLevel: "debug" });
await debugClient.usage.retrieve();The package also exports API types: Person, Company, EnrichPersonParams, SearchPeopleParams, SearchOrganizationsParams, JobStatus and Quotas. Use Body<'operationId'> and Data<'operationId'> for any operation.
Per-request options
RequestOptions accepts timeout, maxRetries, headers and signal. IdempotentRequestOptions adds idempotencyKey for contact lookups, List creation and Bulk submission. Put request options last, after path ids and any body or query parameters. For methods with optional query parameters, pass {} before the options when no filter is needed.
timeout must be positive and finite. maxRetries must be a nonnegative integer. Invalid values raise ReverseContactError. See Timeouts and cancellation for wait options and Errors and retries for retry rules.
The baseUrl can include a gateway prefix. SDK routes already include /v2.
The SDK accepts appInfo.url, but adds only the name and version to the User-Agent. VERSION exports the package version. After merging client and request headers, the SDK removes the reserved X-Request-Origin header.
Return to the TypeScript SDK overview.
FAQ
How do I override SDK options for one request?
Pass RequestOptions as the last argument, after any ids and body or query parameters. The options include timeout, maxRetries, headers and signal.
Does client.withOptions change the original client?
client.withOptions() creates a new client with merged options and headers. The original client remains unchanged.
Does SDK debug logging include API keys or request bodies?
Debug logs contain method, path, status, attempt, retry delay and request id. Debug logs exclude API keys, headers, query parameters and request bodies.