Dart SDK
The tomba package is the official Dart client for the Tomba API. Each API area is a service class, and each method returns a Future for one request. This page describes version 1.0.3, the current release on pub.dev.
Requirements
- Dart 3, as declared in
pubspec.yaml(sdk: '>=3.0.0 <4.0.0'). - The
httppackage, installed as a dependency.
Install
Code
In a Flutter app, run flutter pub add tomba. Everything is exported from package:tomba/tomba.dart.
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. Don't ship your secret in a mobile or web app; call Tomba from your server. 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 Response with two fields: data, the decoded JSON body, and rateLimit. The API wraps its payload in its own data object (Response format), so the address is at result.data['data']['email'].
Errors
The SDK throws TombaException when the API responds with status 400 or higher and when the request fails.
| Field | Value |
|---|---|
code | The HTTP status. null when the error body isn't JSON or no response was received. |
message | The API's errors.message, or the underlying error. |
response | The decoded error body, {'errors': {'type': …, 'message': …, 'code': …}}, or null. |
Code
Each errors.type is described in Errors.
Rate limits and retries
The SDK doesn't retry. result.rateLimit holds the response's rate limit headers as String? fields: xSecondRateLimit, xMinuteRateLimit, xDailyRateLimit, xMinuteRequestLeft, xDailyRequestLeft, xMinuteResetSeconds, xDailyResetSeconds, retryAfter, rateLimitPolicy, and rateLimit.
A 429 throws TombaException with code 429, 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 Finder(client). All arguments are named.
| Method | Endpoint |
|---|---|
Account.getAccount() | GET /me |
Usage.getUsage() | GET /usage |
Logs.getLogs({int? page, int? limit}) | GET /logs |
Domain.domainSearch({required String domain, int? page, int? limit, String? department, bool? enrichMobile, String? webhookUrl}) | GET /domain-search |
Finder.emailFinder({required String domain, required String firstName, required String lastName, String? webhookUrl}) | GET /email-finder |
Finder.authorFinder({required String url, String? webhookUrl}) | GET /author-finder |
Finder.linkedinFinder({required String url, String? webhookUrl}) | GET /linkedin |
Count.emailCount({required String domain}) | GET /email-count |
Verifier.emailVerifier({required String email, String? webhookUrl}) | GET /email-verifier |
Sources.emailSources({required String email}) | GET /email-sources |
Finder.phoneFinder({required String email, String? webhookUrl}) | GET /phone-finder |
PhoneFinder.finder({required String email, String? webhookUrl}) | GET /phone-finder |
PhoneFinder.validator({required String phone}) | GET /phone-validator |
Status.domainStatus({required String domain}) | GET /domain-status |
Status.autoComplete({required String query}) | GET /domain-suggestions |
Similar.websites({required String domain}) | GET /similar |
Technology.list({required String domain}) | GET /technology |
Keys.getKeys() | GET /keys |
Keys.createKey() | POST /keys |
Keys.resetKey({required String id}) | PUT /keys/{id} |
Keys.deleteKey({required String id}) | DELETE /keys/{id} |
Leads.listLeads({int? page, int? limit, String? listId, String? domain}) | GET /leads |
Leads.getLead({required String id}) | GET /leads/{id} |
Leads.createLead({required Map<String, dynamic> data}) | POST /leads |
Leads.updateLead({required String id, required Map<String, dynamic> data}) | PUT /leads/{id} |
Leads.deleteLead({required String id}) | DELETE /leads/{id} |
LeadsLists.getLists() | GET /leads_lists |
LeadsLists.createList({required String name}) | POST /leads_lists |
LeadsLists.updateListId({required String id, required String name}) | PUT /leads_lists/{id} |
LeadsLists.deleteListId({required String id}) | DELETE /leads_lists/{id} |
Source
github.com/tomba-io/dart (Apache-2.0). Release notes are in CHANGELOG.md.