Skip to content

Test mode

Test keys run the real validation and rate limits but return simulated, deterministic results and never debit credits. What they return, and CI use.

Last updated 2026-11-23View as Markdown

Every account has test keys next to its live keys. A test key starts with sk_test_ and calls the same base URL, https://api.qelka.com/v1.

What Test key Live key
Request validation Same Same
Rate limits Same Same
Results Simulated and deterministic Real checks
Credits Never debited: credits_used is 0, even at a zero balance Debited per call
Result cache Not used: cached is always false Used
Bulk jobs Not available Available

Because validation and limits are the same, a test key catches the mistakes that matter in development: a malformed body returns 400, a private IP address returns 422, a burst of requests returns 429. Because results are deterministic, the same input always gives the same answer, so your tests do not flake.

Email addresses

The part of the address before the @ chooses the outcome. Letter case and a +tag are ignored, so Undeliverable+42@example.com behaves like undeliverable@example.com.

Address status reason
undeliverable@example.com undeliverable mailbox_not_found
disabled@example.com undeliverable mailbox_disabled
nomx@example.com undeliverable domain_no_mx
risky@example.com risky mailbox_full
catchall@example.com risky catch_all
disposable@example.com risky disposable
unknown@example.com unknown smtp_timeout
greylisted@example.com unknown greylisted
Any other well-formed address deliverable accepted_email
  • The domain can be anything well formed: no DNS lookup and no mailbox check happen. Every simulated domain has mail servers and publishes SPF and DMARC records.
  • In fast mode, the result is unknown with smtp_not_checked, except for nomx@ and disposable@, which are decided before the mailbox check, as in live mode.
  • Role names such as info, sales or support set checks.role to true. Well-known free email domains, such as gmail.com, set checks.free_provider.
  • An address that is not well formed fails the syntax check and returns invalid_syntax, as in live mode.
  • The score is computed from the simulated checks with the same rules as live results.

Phone numbers

Phone numbers are parsed for real, with the same numbering plan rules as live keys: valid, status, e164, national, country and line_type are what a live call would return. That makes test keys a free way to build and test number formatting.

The simulated parts:

Field Basic level Live level
region null null
timezones [] []
carrier { "name": null, "mcc": null, "mnc": null, "source": "numbering_plan" } { "name": "Test Carrier", "mcc": "001", "mnc": "01", "source": "live" }
ported null false

IP addresses

The documentation ranges of RFC 5737 and RFC 3849, which no real network uses, map to fixed profiles, so you can test every branch of your code:

Address range Location Network Flags set risk
192.0.2.0/24 San Francisco, California, US AS64496 Example Broadband, isp none 0, low
198.51.100.0/25 Amsterdam, North Holland, NL AS64497 Example VPN, hosting vpn, datacenter 85, high
198.51.100.128/25 Frankfurt am Main, Hesse, DE AS64498 Example Relays, hosting tor, datacenter 100, high
203.0.113.0/24 Toronto, Ontario, CA AS64500 Example Hosting, hosting datacenter 35, medium
2001:db8::/32 London, England, GB AS64501 Example Mobile, mobile none 0, low
Any other public address Same as 192.0.2.0/24 Same as 192.0.2.0/24 none 0, low

Private, loopback, link-local and other special-purpose addresses still return 422 unprocessable_input, and so does a value that is not an IP address. With a live key, the documentation ranges above return 422 too: they exist for tests and examples only.

Bulk jobs

Bulk jobs need a live key. POST /bulk with a test key returns 403 forbidden. To test your bulk code path without spending much, run a live job on a small file: a file of ten rows costs ten checks.

Use test keys in CI

Store the test key as a secret of your CI system and run your integration tests against the API itself:

import { test } from 'node:test'
import assert from 'node:assert/strict'
import { Client } from '@qelka/sdk'

const client = new Client({ apiKey: process.env.API_TEST_KEY })

test('rejects addresses that cannot receive mail', async () => {
  const result = await client.email.verify({ email: 'undeliverable@example.com' })
  assert.equal(result.status, 'undeliverable')
})

test('flags disposable addresses', async () => {
  const result = await client.email.verify({ email: 'disposable@example.com', mode: 'fast' })
  assert.equal(result.checks.disposable, true)
})

test('stores numbers in E.164', async () => {
  const result = await client.phone.validate({ phone: '(415) 555-0123', country: 'US' })
  assert.equal(result.e164, '+14155550123')
})

test('sends Tor traffic to review', async () => {
  const result = await client.ip.lookup({ ip: '198.51.100.200' })
  assert.equal(result.flags.tor, true)
  assert.equal(result.risk.level, 'high')
})

Test keys are rate limited like live keys, so keep CI runs small and avoid firing hundreds of requests at once.

Going live

Swap the sk_test_ key for an sk_live_ key. Nothing else changes: same base URL, same request bodies, same response shapes. A quick startup check against GET /account tells you which mode a deployed service runs in: key.mode is test or live.