Deno SDK
@tomba/sdk is the official Deno client for the Tomba API, published on JSR. Each API area is a service class, and each method returns a promise for one request. This page describes version 1.0.4, the current release on JSR.
Requirements
Deno 2. deno.json declares no minimum version; the SDK is linted and tested on Deno 2.x. Run your program with --allow-net, and with --allow-env if it reads your keys from the environment.
Install
Code
This adds @tomba/sdk to the imports in your deno.json.
Authenticate
Create an API key and copy your secret on the API keys page, then export both:
Code
The SDK doesn't read environment variables. Pass the values to setKey() and setSecret(), and the client sends them as the X-Tomba-Key and X-Tomba-Secret headers. Key expiry and rotation are covered in Authentication.
First request
Find the email address of a person at a company:
Code
Every method resolves to { data, rateLimit }, where data is the decoded JSON body, typed unknown. The API wraps its payload in its own data object (Response format), so the address is at data.data.email.
Errors
The SDK throws TombaException when the API responds with status 400 or higher, when the request fails, and before sending a request when a required argument is missing. TombaException doesn't extend Error, and for API errors its message is undefined and its code is 0: read the details from response, the decoded error body.
Code
errors.code is the HTTP status. Each errors.type is described in Errors. For a failed request or a missing argument, response is empty and message holds the cause.
Rate limits and retries
The SDK doesn't retry. result.rateLimit holds the response's rate limit headers as string | null fields: xSecondRateLimit, xMinuteRateLimit, xDailyRateLimit, xMinuteRequestLeft, xDailyRequestLeft, xMinuteResetSeconds, xDailyResetSeconds, retryAfter, rateLimitPolicy, and rateLimit.
A 429 throws TombaException without the response headers. Wait before retrying as described in Handle 429 responses.
Requests time out after 120 seconds; the timeout isn't configurable.
Method reference
Create each service with the client, for example new Finder(client).
| Method | Endpoint |
|---|---|
Account.getAccount() | GET /me |
Usage.getUsage() | GET /usage |
Logs.getLogs(page?, limit?) | GET /logs |
Domain.domainSearch(domain, page?, limit?, department?, enrichMobile?, webhookUrl?) | GET /domain-search |
Finder.emailFinder(domain, firstName, lastName, webhookUrl?) | GET /email-finder |
Finder.authorFinder(url, webhookUrl?) | GET /author-finder |
Finder.linkedinFinder(url, webhookUrl?) | GET /linkedin |
Count.emailCount(domain) | GET /email-count |
Verifier.emailVerifier(email, webhookUrl?) | GET /email-verifier |
Sources.emailSources(email) | GET /email-sources |
Finder.phoneFinder(email, webhookUrl?) | GET /phone-finder |
PhoneFinder.finder(email, webhookUrl?) | GET /phone-finder |
PhoneFinder.validator(phone) | GET /phone-validator |
Status.domainStatus(domain) | GET /domain-status |
Status.autoComplete(query) | GET /domain-suggestions |
Similar.websites(domain) | GET /similar |
Technology.list(domain) | GET /technology |
Keys.getKeys() | GET /keys |
Keys.createKey() | POST /keys |
Keys.resetKey(id) | PUT /keys/{id} |
Keys.deleteKey(id) | DELETE /keys/{id} |
Leads.listLeads(page?, limit?, listId?, domain?) | GET /leads |
Leads.getLead(id) | GET /leads/{id} |
Leads.createLead(data) | POST /leads |
Leads.updateLead(id, data) | PUT /leads/{id} |
Leads.deleteLead(id) | DELETE /leads/{id} |
LeadsLists.getLists() | GET /leads_lists |
LeadsLists.createList(name) | POST /leads_lists |
LeadsLists.updateListId(id, name) | PUT /leads_lists/{id} |
LeadsLists.deleteListId(id) | DELETE /leads_lists/{id} |
Source
github.com/tomba-io/deno (Apache-2.0), published as @tomba/sdk on JSR. Release notes are in CHANGELOG.md.