Choose the right APIs for the job

Evaluate APIs on schema fit, coverage, freshness, cost, latency and failure modes, test them on real inputs, and score the options in a decision matrix.

  • 40 min
  • Expert

Every system in this certification is built from other people's APIs. The decisions that matter most are made before the first line of integration code: which API answers which question, and what you will do when it cannot. Get those wrong and no amount of retry logic or caching saves the design. You end up paying 20 credits for a field you could have had for 6, joining two answers that define the same word differently, or discovering in production that a third of your inputs come back with the one field you needed set to null.

This lesson is about choosing deliberately. You will start from the job rather than the catalog, check each candidate against five properties that decide fit, run a proof of concept on real inputs, and score the options in a matrix that someone else can read and challenge.

Start from the decision, not the catalog

An API is never the goal. It feeds a decision: accept this signup, route this lead to sales, flag this domain for review. Write that decision down first, in one sentence, and then list the facts it needs. For a B2B signup flow it might look like this:

Fact the decision needsWhyWhere it is used
The email can receive mailWe cannot onboard someone we cannot reachRequest path, blocks signup
The address is disposableThrowaway identities abuse free trialsRequest path, blocks signup
The email domain is a company domainCompany domains get routed to salesBackground, after signup
The domain is older than a few monthsNew domains correlate with abuseBackground, scoring

Two columns in that table do most of the work. Where it is used tells you the latency you can afford: a request-path check has to answer inside the user's patience, while a background check can take seconds and retry. Why tells you what happens when the fact is missing, which you will need when you design failure handling in the next lesson.

Only now open the catalog. For each fact, find every API that could supply it. You will usually find more than one, and the overlaps are where good architecture starts.

Five properties that decide fit

Schema fit: does a field answer your question exactly?

Map each fact to a concrete JSON path, then read the field's definition, not just its name. Similar names hide different definitions.

Disposable detection is available from two APIs. Email Validator (emailvalidator, 20 credits) returns isDisposable along with MX resolution, SPF and DMARC presence, role-account and free-provider flags, and a normalizedEmail. Disposable Email Checker (emaildisposablechecker, 6 credits) returns isDisposable, email and domain, and nothing else.

Try it liveEmail Validator20 credits
GEThttps://api.apiverve.com/v1/emailvalidator
curl "https://api.apiverve.com/v1/emailvalidator?email=support%40myspace.com" \
  -H "x-api-key: YOUR_API_KEY"
Sign in or create a free account to run this with your own key.

One call answers several facts from the table: canReceiveMail, isDisposable, isCompanyEmail, plus isRoleAccount for free.

If your decision only needs the disposable flag, the second API answers it for under a third of the price. If it needs deliverability too, calling both is the expensive mistake: you pay 26 credits for an answer one 20-credit call already contained. Overlap analysis runs in both directions.

Domain age is a subtler case. WHOIS Lookup (whoislookup, 8 credits) returns domainAgeDays and domainAgeYears derived from createdDate, plus registrar and status data. Domain Age (domainage, 10 credits) returns the same age figures and adds ageCategory and isNewlyRegistered. Both have a "new domain" flag, and they are not the same flag: isNewlyRegistered on Domain Age is true under 30 days, while isRecentlyRegistered on WHOIS Lookup means within the last 90 days, and it is a premium field. A rule written as "block new domains" means different things depending on which field you wired it to.

Try it liveDomain Age10 credits
GEThttps://api.apiverve.com/v1/domainage
curl "https://api.apiverve.com/v1/domainage?domain=myspace.com" \
  -H "x-api-key: YOUR_API_KEY"
Sign in or create a free account to run this with your own key.

Compare ageCategory and isNewlyRegistered with what WHOIS Lookup returns for the same domain. The age figures agree; the flags are defined differently.

Premium fields deserve their own row in your mapping. On plans without access they come back as null, present in the response but empty. A riskScore you planned around that is null on the plan you will actually run in production is a schema mismatch, even though the field exists.

Coverage and freshness: how often is the answer there, and how old is it?

Schema tells you what an API can return. Coverage tells you how often it does, for your inputs. A geolocation answer for a mobile carrier IP may carry a country and nothing finer. A carrier name exists only for number ranges the underlying dataset knows about. You do not learn this from documentation; you learn it from a sample of your own data, which is what the proof of concept below is for.

Freshness is the age of the answer. Some APIs tell you directly: Website Tech Stack Detector returns fingerprintsUpdatedAt, the date its fingerprint database was last refreshed, and VPN Proxy Detector returns checked_on. Others compute everything live at call time, as Email Validator does with its DNS checks. Note which kind each candidate is, because it decides how long you may cache the result and how often you must re-check it later.

Cost: credits per call times calls per decision

Credits differ per API, set in each definition and shown on its reference page. The number that matters is not the price of one call but the price of one decision: the sum of every call the decision makes, times how often it runs. A signup check that calls Email Validator (20) and WHOIS Lookup (8) costs 28 credits per signup. If a quarter of signups are free-mail addresses where WHOIS adds nothing, skipping it for them is a design decision worth roughly 2 credits per signup on average. Write the per-decision cost into your evaluation; it is what the finance conversation will be about.

Latency: measure, do not read

The catalog shows a typical latency for each API, and it is a reasonable first filter: an API listed in the seconds is not a request-path candidate for a form submission. But the listed figure is an estimate. Your latency depends on your region, your inputs and the time of day, and the tail matters more than the middle. Measure p50 and p95 against your own sample before you commit a step to a request path.

Failure modes: what does "no answer" look like?

Every API has a shape for "I could not answer", and they differ. Learn each candidate's shape before you write code against it:

  • Bad input is a 400 whose error may be a structure rather than a sentence. Sending notanemail to Email Validator returned "error": {"invalid": ["email: must be a valid email address"]}. Code that does err.error.toLowerCase() crashes on that.
  • Nothing exists can be a successful response. WHOIS Lookup for an unregistered domain returns 200 with status: null, empty nameServers, and no createdDate at all. Your code has to handle a field that is absent, not just one that is null.
  • Nothing found on some APIs is a 404, which is a valid answer for that input and not an outage.
  • Rate limit and exhausted credits both answer 429. You covered telling them apart in earlier courses; at architecture level the point is that a monthly cap is a shared failure across every API on the key.
Try it liveWHOIS Lookup8 credits
GEThttps://api.apiverve.com/v1/whoislookup
curl "https://api.apiverve.com/v1/whoislookup?domain=example-not-registered-zzqx.com" \
  -H "x-api-key: YOUR_API_KEY"
Sign in or create a free account to run this with your own key.

A 200 with almost nothing in it. createdDate and domainAgeDays are missing entirely, not null.

Terms and licensing

The data behind an API comes from somewhere: public registries, licensed databases, DNS, crowd-sourced lists. Before an API becomes part of your product, read the terms that cover what you plan to do with its output. The questions to answer are practical. May you store results, and for how long? May you show them to your own customers? May you resell or redistribute them inside your product? Does the underlying source restrict commercial use? If you cannot answer one of these from the provider's terms, ask the provider in writing before you build, not after a customer asks.

Check yourself

Your signup check needs only one fact: whether the address uses a disposable email domain. Which choice fits best?

Run every example on your own key. Free plan, no card.

Scaling up?

Volume pricing, custom SLAs, and dedicated support for high-traffic teams.

Contact sales