C# SDK
The Tomba NuGet package is the official .NET client for the Tomba API. Each API area is a service class, and each method sends one request and returns the raw HttpResponseMessage.
Requirements
- .NET 10. Version 1.0.1 of the package targets
net10.0only. Newtonsoft.Json, installed as a dependency.
Install
Code
The classes are in the Tomba namespace.
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. Call each setter once per client: a second call throws ArgumentException. Key expiry and rotation are covered in Authentication.
First request
Verify an email address.
Code
The example is a dotnet new console program with top-level statements. Methods return the HttpResponseMessage unparsed, so read and parse the JSON body yourself. The API wraps its payload in a data object (Response format); the verification status is at data.email.status.
Errors
The SDK throws TombaException when the API responds with status 400 or higher and when the request fails. For API errors, the exception is wrapped: the outer TombaException has the API's errors.message as Message, and its InnerException is a TombaException whose Code is the HTTP status and whose Response is the raw response body.
Code
inner is null when the request failed before a response arrived. The raw Response is the JSON error body; each errors.type in it is described in Errors.
Rate limits and retries
The SDK doesn't retry. Client.ParseRateLimit(response) reads the rate limit headers of a successful response into a RateLimit with the int? properties SecondRateLimit, MinuteRateLimit, DailyRateLimit, MinuteRequestLeft, DailyRequestLeft, MinuteResetSeconds, DailyResetSeconds, and RetryAfter, and the string properties RateLimitPolicy and RateLimitValue.
A 429 throws TombaException without the response headers. Wait before retrying as described in Handle 429 responses.
Requests time out after 120 seconds.
Method reference
Create each service with the client, for example new Verifier(client). Every method returns Task<HttpResponseMessage>.
| Method | Endpoint |
|---|---|
Account.GetAccount() | GET /me |
Usage.GetUsage() | GET /usage |
Logs.GetLogs(int? page = null, int? limit = null) | GET /logs |
Format.EmailFormatAsync(string domain) | GET /email-format |
Count.EmailCount(string domain) | GET /email-count |
Verifier.EmailVerifier(string email, string webhookUrl = null) | GET /email-verifier |
Sources.EmailSources(string email) | GET /email-sources |
Phone.FinderAsync(Dictionary<string, object> parameters, string webhookUrl = null) | GET /phone-finder |
Phone.ValidatorAsync(string phone, string countryCode = null) | GET /phone-validator |
Status.DomainStatus(string domain) | GET /domain-status |
Status.AutoComplete(string query) | GET /domain-suggestions |
Keys.GetKeys() | GET /keys |
Keys.GetKey(string id) | GET /keys/{id} |
Keys.CreateKey() | POST /keys |
Keys.ResetKey(string id) | PUT /keys/{id} |
Keys.DeleteKey(string id) | DELETE /keys/{id} |
Leads.ListLeadsAsync(int? page = 1, int? limit = 10, string domain = null) | GET /leads |
Leads.GetLeadAsync(string id) | GET /leads/{id} |
Leads.CreateLeadAsync(Dictionary<string, object> data) | POST /leads |
Leads.UpdateLeadAsync(string id, Dictionary<string, object> data) | PUT /leads/{id} |
Leads.DeleteLeadAsync(string id) | DELETE /leads/{id} |
LeadsLists.GetLists() | GET /leads_lists |
LeadsLists.DeleteListId(string id) | DELETE /leads_lists/{id} |
Bulk.ListAsync(string type, Dictionary<string, object> parameters = null) | GET /bulk/{type} |
Bulk.CreateAsync(string type, Dictionary<string, object> data) | POST /bulk/{type} |
Bulk.GetAsync(string type, string id) | GET /bulk/{type}/{id} |
Bulk.ProgressAsync(string type, string id) | GET /bulk/{type}/{id}/progress |
Bulk.DownloadAsync(string type, string id) | GET /bulk/{type}/{id}/download |
Bulk.RenameAsync(string type, string id, string name) | PUT /bulk/{type}/{id}/rename |
type is the {type} segment listed in Bulk types. CreateAsync 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/csharp (Apache-2.0). Release notes are in CHANGELOG.md.