Perl SDK
Tomba::Finder is the official Perl client for the Tomba API, published on CPAN in the Tomba-Finder distribution. One Tomba::Finder object exposes every method, and each method sends one request.
Requirements
- Perl 5.26.1 or later, as declared in
Makefile.PL. LWP::UserAgent,JSON, andURI, installed as dependencies. HTTPS requests also needLWP::Protocol::https.
Install
Code
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 Tomba::Finder->new($key, $secret), and the client sends them as the X-Tomba-Key and X-Tomba-Secret headers. The constructor dies if either value is shorter than 39 characters. Key expiry and rotation are covered in Authentication.
First request
Find the email address of a person at a company:
Code
Every method returns a hash reference with two keys: data, the decoded JSON body, and rate_limit. The API wraps its payload in its own data object (Response format), so the address is at $result->{data}{data}{email}.
Errors
Methods don't die on API errors. They return the decoded error body in data, so check $result->{data}{errors} after every call:
Code
errors.code is the HTTP status. Each errors.type is described in Errors. GET methods die when a response body isn't JSON, for example a gateway timeout page.
Rate limits and retries
The SDK doesn't retry. $result->{rate_limit} holds the response's rate limit headers that are present, keyed by header name: x-second-rate-limit, x-minute-rate-limit, x-daily-rate-limit, x-minute-request-left, x-daily-request-left, x-minute-reset-seconds, x-daily-reset-seconds, retry-after, ratelimit-policy, and ratelimit.
On a 429, $result->{rate_limit}{'retry-after'} holds the wait in seconds. Retry as described in Handle 429 responses.
Requests time out after 120 seconds; the timeout isn't configurable.
Method reference
Call every method on the Tomba::Finder object. Each method is also available on its own module, for example Tomba::Domain->new($key, $secret)->DomainSearch(...). $opts is an optional hash reference.
| Method | Endpoint |
|---|---|
Account() | GET /me |
Usage() | GET /usage |
Logs($params) | GET /logs |
DomainSearch($domain, $opts), with enrich_mobile and webhook_url in $opts | GET /domain-search |
EmailFinder($domain, $first_name, $last_name, $opts), with webhook_url in $opts | GET /email-finder |
AuthorFinder($url, $opts) | GET /author-finder |
LinkedinFinder($url, $opts) | GET /linkedin |
Enrichment($email, $opts) | GET /enrich |
EmailFormat($domain) | GET /email-format |
GetLocation($domain) | GET /location |
Count($domain) | GET /email-count |
EmailVerifier($email, $opts) | GET /email-verifier |
EmailSources($email) | GET /email-sources |
PersonFind($email) | GET /people/find |
CompanyFind($domain) | GET /companies/find |
CombinedFind($email) | GET /combined/find |
PhoneFinder($params) | GET /phone-finder |
PhoneValidator($phone, $country_code) | GET /phone-validator |
Status($domain) | GET /domain-status |
Autocomplete($search) | GET /domain-suggestions |
Similar($domain) | GET /similar |
Technology($domain) | GET /technology |
CompaniesSearch($body) | POST /reveal/search |
ListFlags($params) | GET /flag |
CreateFlag($body) | POST /flag |
ListKeys() | GET /keys |
GetKey($key_id) | GET /keys/{id} |
CreateKey() | POST /keys |
ResetKey($key_id) | PUT /keys/{id} |
DeleteKey($key_id) | DELETE /keys/{id} |
ListLeads($params) | GET /leads |
GetLead($lead_id) | GET /leads/{id} |
CreateLead($body) | POST /leads |
UpdateLead($lead_id, $body) | PUT /leads/{id} |
DeleteLead($lead_id) | DELETE /leads/{id} |
ListLeadsLists() | GET /leads_lists |
GetLeadsList($list_id) | GET /leads_lists/{id} |
CreateLeadsList($body) | POST /leads_lists |
UpdateLeadsList($list_id, $body) | PUT /leads_lists/{id} |
DeleteLeadsList($list_id) | DELETE /leads_lists/{id} |
ListAttributes() | GET /attributes |
GetAttribute($attribute_id) | GET /attributes/{id} |
CreateAttribute($body) | POST /attributes |
UpdateAttribute($attribute_id, $body) | PUT /attributes/{id} |
DeleteAttribute($attribute_id) | DELETE /attributes/{id} |
ListBulks($type, $params) | GET /bulk/{type} |
CreateBulk($type, $body) | POST /bulk/{type} |
GetBulk($type, $id) | GET /bulk/{type}/{id} |
LaunchBulk($type, $id) | PUT /bulk/{type}/{id} |
BulkProgress($type, $id) | GET /bulk/{type}/{id}/progress |
BulkDownload($type, $id) | GET /bulk/{type}/{id}/download |
RenameBulk($type, $id, $name) | PUT /bulk/{type}/{id}/rename |
ArchiveBulk($type, $id) | DELETE /bulk/{type}/{id}/archive |
DeleteBulk($type, $id) | DELETE /bulk/{type}/{id}/delete |
$type is the {type} segment listed in Bulk types; the order of calls is described in Lifecycle. CreateBulk sends a JSON body, so it can't create jobs that need a CSV upload, such as email finder jobs.
Source
github.com/tomba-io/perl (Apache-2.0). Release notes are in Changes.