Skip to content

B2B Leads API Testing: Mocks, Fixtures and Safe Live Checks

Test a B2B leads integration with synthetic fixtures and failure simulations, then validate a tightly capped live request against the documented Dievio API.

Dievio Team · Growth Systems · August 12, 2026 · 4 min read

Separate blue fixture and orange live-check benches pass a single contact card through a narrow bridge under Test Locally Then Check Live.

Key points

  • Use synthetic fixtures for repeatable tests without provider charges.
  • The documented Dievio endpoint is POST /api/public/search.
  • Returned live records consume separate API credits; a mock is not a free production endpoint.

Test a B2B leads API integration in two layers: repeatable tests against your own synthetic fixtures, then a small live check against the provider’s documented endpoint. The first layer exercises mapping, pagination and failures without real contact data or provider charges. The second confirms authentication and the real response contract.

For Dievio, the documented lead-search endpoint is POST https://dievio.com/api/public/search. It uses a bearer API key and a separate API credit balance. This guide does not rely on a dedicated Dievio sandbox host or free sandbox keys. A live request that returns leads consumes API credits, even when you intend it as a test.

Make the provider client replaceable

Keep your CRM mapping and business rules behind a small client interface. In local tests, return a fixture from that interface. In production, call the actual API. This gives you control over responses and prevents test cases from accidentally sending large paid searches.

Use invented names and reserved example domains in fixtures. Include complete records, missing emails, missing phone numbers, duplicate profile URLs, non-ASCII names and companies with similar names. None of those fixtures should be presented as real provider data or an exact current response schema.

// Illustrative local fixture: adapt fields to a saved real response.
const fixture = {
  success: true,
  preview_data: [
    { full_name: 'Example Person', work_email: null,
      job_title: 'Operations Director', company: 'Example Company' }
  ],
  page: 1,
  has_more: false,
  next_page: null
};

Store a redacted, approved real response separately when you need a contract fixture. Remove personal details and credentials before sharing it. Record the observation date and the specific fields your integration depends on.

Four teal and orange cards show local fixtures, failure cases, pagination and a capped live API check beneath Test Before Live Calls.
Use synthetic fixtures first; a small live check confirms the actual API contract and consumes credits for returned leads. Open the full-size infographic.

Test failures before a successful import

CaseTest inputExpected integration behavior
Missing authenticationMock 401Stop and request key correction; do not loop.
Insufficient balanceMock 402Pause the job and preserve progress for an operator.
Upstream failureMock 502 or timeoutApply a bounded retry policy and record an uncertain outcome.
No matchesEmpty record arrayComplete cleanly without creating an empty CRM contact.
Missing fieldNull email or companyApply the written acceptance rule; do not fabricate values.
Duplicate recordSame stable identifier twiceReuse or update the intended destination record.
Final pagehas_more falseStop without requesting another page.

These are integration test cases, not a claim that every provider returns identical errors. Dievio’s public search route documents missing-key and balance failures through its implementation; inspect the actual response body during a live check. If an intermediary returns 429, respect its retry guidance and keep retries bounded rather than inventing a universal rate limit.

Verify pagination and the credit boundary

Dievio search accepts _page, _per_page and max_results, and returns pagination fields including has_more and next_page. Test multiple pages in fixtures. Assert that your client stops at the total limit and does not restart from page one after a downstream CRM error.

A search that succeeded upstream can still fail before your system records its response. Treat that timeout as an uncertain outcome. Replaying the search may return records and spend credits again. Save completed responses before delivery, checkpoint each stage and retry destination writes from stored results where possible. Deduplicating CRM writes does not make repeated provider calls free.

Dievio

Your workflow. Powered by Dievio.

Bring B2B contact search and LinkedIn enrichment into the tools you already use.

Explore Dievio API

Search contacts · Enrich profiles · Export results

Dievio APIExample
POST /api/public/search{ "job_titles": ["Founder"], "max_results": 10 }
Contacts ready for your workflow

Run a tightly capped live smoke test

Create or select an API key in your account and keep it on your server. Confirm your separate API balance. Use a small audience and explicit limits, then inspect the full response before building a larger job. Never put a real key in article code, browser-side JavaScript or a shared screenshot.

curl -X POST https://dievio.com/api/public/search \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "job_titles": ["Founder"],
    "person_location_country": ["United States"],
    "max_results": 5,
    "_per_page": 5,
    "_page": 1
  }'

The example may return up to five records and consume up to five API credits. It is a real search shape, not a mock or free sandbox call. Check the current public API page and dashboard documentation before running it, because request contracts and commercial terms can change.

Validate the destination separately

Import the test response into your own staging CRM or test database. Confirm field mapping, encoding, record ownership, duplicate policy and suppression behavior. Use the contact field mapping guide to document required versus optional values.

If your workflow delivers webhooks, test your own receiver with synthetic payloads. Confirm signature handling where implemented, request retries, duplicate events and a dead-letter path. Do not describe that receiver as native Dievio webhook delivery unless your provider documentation explicitly supplies that feature.

Promote a tested workflow, then observe it

Before expanding the result cap, record the endpoint, field mapping, stop conditions, balance check, retry ceiling and owner of failed jobs. Compare the first live response with your fixture and update the contract test when a legitimate schema change occurs.

Monitor returned records, accepted records, credit use, failure reasons and duplicate destination writes. Keep technical logs free of API keys and unnecessary personal data. The batch processing guide covers a larger delivery workflow, while API debugging helps isolate a failing stage before you scale it.

Keep reading

Build your first list.

100 free credits. No credit card required.

Start free