# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ## [5.1.1] - 2026-12-03 ### Security - Development dependencies updated so `npm audit` reports nothing (the publish workflow fails on any advisory): `jest`, `babel-jest` and `jest-environment-jsdom` 30.5.2, `cross-spawn` 7.1.2, `terser` 5.51.4, `ws` 8.23.1, and a `glob` override to `^14.0.7`. The `test-exclude` override that pinned `minimatch` to 3.x is gone: `test-exclude` 7 imports `minimatch` by name, so every copy is now 11.x. None of these ship in the package; the SDK has no runtime dependencies. ## [5.1.0] - 2026-12-03 (tagged, never published to npm; shipped in 5.1.1) ### Added - `validateEmail` accepts `awaitDomainInfo` (sent as `await=true|false`, only when set, on GET and POST; never on `validateBatch`). It only takes effect with `domainInfo` and can add up to about 30 seconds. - The validate result declares `domain_detected_services` (`DomainDetectedServices` with `integrations` and `services`, each a list of `DetectedService` with `name`, `key` and `category`); its types are checked like every other field. ### Fixed - The documented values were wrong in released docs: `domain_website_exists` is `"true"`, `"false"` or `"unchecked"`; `domain_registrant_company_name` is a company name, `"not_found"` or `"unchecked"`. ## [5.0.2] - 2026-11-18 ### Changed - Documentation only, no code changes: the README and `documentation.md` link the README and LICENSE by full GitHub URL, so the links work on npmjs.com and on the zerobounce.net documentation page that renders `documentation.md`. ## [5.0.1] - 2026-11-18 ### Fixed - `validateEmail` returned a message-only body (`{"message": "bad"}`, one beside a `success` that is no flag, or one beside `address` and `status` both null) as a result; it now rejects with `ZBApiError`, status 200, carrying the message, as the other calls do. The only message-only answer still returned is the greylist one, a body whose only key is `Message`. ## [5.0.0] - 2026-11-17 ### Breaking Compared with 4.0.0, the version on npm (4.0.1 was tagged but never published there, see below). Callers should expect a rejection, or a refused `init`, where 4.0.0 resolved or accepted: - `init` refuses more API keys: a key with a Unicode space (U+00A0 included), a control character, a C1 control character (U+0080 to U+009F), a lone surrogate, an invisible or default-ignorable character (U+200B, U+202E, U+180B, U+2800 and others), or made only of combining marks. An ordinary space in the middle of the key is still allowed. - `init` refuses more base URLs (`apiBaseURL`, `listEvaluatorBaseURL`, `inboxPlacementBaseURL`, `emailFinderBaseURL`, `domainSearchBaseURL`, and `ZeroBounceWarmup`'s): one that carries a username, a password, a query or a fragment; one with a control, whitespace, invisible, bidirectional or backslash character, a lone surrogate, or a non-ASCII or `%` host; and one that is not `https://` followed by a host, apart from `http://` for `127.0.0.1`, `localhost` and `[::1]`, which is new (4.0.0 refused every `http://` URL); and one whose path has a dot segment (`.` or `..`) or an encoded slash (`%2f`, `%5c`). The error does not include the URL. - A `success` flag decides failure on every JSON call: a body whose `success` is `false`, `"false"` or `0` in any of its duplicate top-level keys rejects with status 200. A `success` that is not a flag (`null`, `2`, `"yes"`, `0.4`, an object) no longer hides a message-only or error body; it is read as if absent. - A 2xx body that is a message only, `{}`, or a message beside documented fields that are all null rejects on every typed call except validate's greylist answer, the filter calls, Inbox Placement and the list-evaluator result; `getCredits` is no longer an exception (`{"message":"x"}` rejects with the text `x`). The email finder and domain search calls reject a message-only body whatever its values. - A field of a typed result with another JSON type than `zeroBounceSDK.d.ts` declares, a body that is not the declared shape (a number, string, array, `null` where an object is declared), a body nested deeper than 512 levels, a body that starts with a byte order mark or is not strict JSON, a `score` that is not a safe integer, and a list of `message` values holding anything but strings all reject with a `ZBApiError` with status 200 (a list of strings is joined with `"\n"` into one string). - `getFileStatus` and `getScoringFileStatus` reject a body with no non-null known field, including `{"foo":1}` and `{"message":"m","file_id":null}` (4.0.0 returned them); `{"file_status":"Processing"}` and `{"success":true}` stay results. - `ZeroBounceWarmup` rejects a 2xx answer served as `text/html` (a proxy or challenge page) with a `ZBApiError`, even when its body parses as JSON; 4.0.0 returned such a body as the result. - `getCredits` returns `Credits` as a string: `{"Credits":2375323}` resolves to `{ Credits: "2375323" }`; `{"Credits":null}` and `{}` reject. - The four bulk downloads and `ZeroBounceWarmup.downloadSeeds` and `downloadStatistics` reject any JSON body or JSON media type and an HTML page (also one that starts with spaces, tabs, a byte order mark or U+00A0) with a `ZBApiError` carrying the HTTP status. - A connection failure rejects with `ZBApiError` and `statusCode` 0 (Warmup included). - `ZeroBounceWarmup.addSendingAccount` rejects a non-boolean `weekdays_only` and a `timezone_offset` of `NaN`; `validateBatch` rejects a non-boolean `activityData` or `verifyPlus` (the 4.0.1 change, for 4.0.0 callers). - The API key is no longer a property of the client (`_api_key`); code that read it that way gets `undefined`. - **Behaviour change:** `sendFile`, `sendScoringFile`, `sendListEvaluatorFile`, `sendEmailFinderFile`, `sendDomainSearchFile` and every `…FileStream` sender accept only a `Blob`/`File`, or a `Buffer`/`Uint8Array` (wrapped into a Blob under the given file name, `file.csv` when none is given). A file path string, a stream or any other object is refused with `ZBApiError` before anything is sent; before, a `Buffer` or `Uint8Array` passed to a `send…File` method was sent as a text field holding its content, another object as a text field ("[object Object]"), and a `Buffer` passed to a `…FileStream` sender threw a `TypeError` from `FormData.append`. - **Behaviour change:** a form value (`return_url`, column fields, ...) or a file name containing CR, LF or NUL is refused with `ZBApiError` ("the form field "return_url" must not contain a line break or a NUL character.") before the request is sent. - **Behaviour change:** a 3xx answer is reported with its own status ("ZeroBounce returned a redirect, which this client does not follow."); requests use `redirect: "manual"` and still never follow it. Before, requests used `redirect: "error"` and a redirect rejected with a plain `Error` ("TypeError: fetch failed") that had no `statusCode`. - **Warmup transport and redirects:** `ZeroBounceWarmup` sends `redirect: "manual"`, so a 3xx rejects with its status and a browser's opaque redirect with status 0 and "ZeroBounce returned a redirect, which this client does not follow." (4.0.0 sent `redirect: "error"`, so the redirect surfaced as a "fetch failed"). A response with status 0 now rejects as a transport failure; 4.0.0 resolved `null`. A connection failure (also while the body is read) rejects with `ZBApiError` and `statusCode` 0 and keeps its cause text (the code and message, redacted); in 4.0.0 `src/warmup.js` threw a plain `Error` with no `statusCode`. - **Downloads that start with `<`:** a file download (`getFile`, `getScoringFile`, the finder and domain-search files, Warmup `downloadSeeds`) whose content starts with `<` after its padding is an HTML page and rejects, whatever its tags (`Access denied` served as `text/csv` used to resolve as CSV). The text is "ZeroBounce returned an HTML page instead of a file."; it names `(text/html)` only when the content type is `text/html`. A download served as `text/html` whose body is an HTML page shows the page's title, and one whose body is a JSON object or (on an error status) a plain-text message shows that message with the status; any other body under `text/html` (for example CSV rows on a 200) gets "ZeroBounce returned an HTML page (text/html) instead of a file." instead of its rows or its text. A CSV whose header row starts with `<` is refused too. - **Stricter `timeout` types:** `validateEmail` and `validateBatch` check `timeout` by type as well as range: only a whole number (or a string of digits only) inside the range (3-60 for `validateEmail`, 10-120 for `validateBatch`) is sent. 4.0.0 only compared the value with the range, and already refused `true` (both methods), and `[5]` and `4.5` for `validateBatch`; what now rejects with a `ZBApiError` before anything is sent is "x", "5abc", `{}` and "11.5" (both methods), and `[5]` and `4.5` for `validateEmail`, which 4.0.0 sent to the API. ### Security - A base URL with a username, a password, a query or a fragment is refused before any request. The error does not include the URL: `ZeroBounce: apiBaseURL must not contain a username or password.` or `ZeroBounce: apiBaseURL must not contain a query string or a fragment ("?" or "#").` - An API key with a Unicode space, a control character, an invisible character (including U+00A0, U+202E, U+200B and U+180B) or made only of combining marks is refused. An ordinary space in the middle of the key is still allowed. - Redaction also decodes `\u{27}`, `\047`, `\x27`, `\U{27}`, `\'`, `'` and `'`, and folds case with Unicode full case folding after canonical decomposition. `%u0027` is not decoded. When a decoded view still contains a secret, the message is `ZeroBounce: the response text was omitted because it contained a credential.` - Redaction is closed under encoding. After the known spellings of every secret (the API key, the Warmup key, the SMTP username and password) are replaced with `***`, the rest of the message is decoded up to four layers deep in any order (the SDK's own request encoding plus three echo layers: URL `%XX` in upper or lower case, form `+` and `%XX`, JSON escapes including `\/` and `\uXXXX`, and the spellings listed in the previous item); a `%XX` run that is not valid UTF-8 as a whole (a stray `%FF` in front of a percent-encoded secret) is decoded one UTF-8 sequence at a time, so a non-ASCII secret such as an SMTP password is still recognised in it; if any decoded view still contains a secret, the whole message is replaced with "ZeroBounce: the response text was omitted because it contained a credential." 4.0.0 and earlier matched a fixed list of spellings (raw, URL-encoded, `escape()`), so a body echoing the key URL-encoded twice passed it to the caller. - `init` is all or nothing: the key and every base URL are checked before any of them is stored, so an `init` that throws leaves the client exactly as it was. In 4.0.0 and earlier, `init` stored the new key and main base URL before checking the optional base URLs: after `init("key-B", ApiURL.EU_API_URL, { domainSearchBaseURL: "http://..." })` threw, a caller that caught the error sent its next requests to the EU host with `key-B`, and a fresh client whose `init` threw on an `http://` base URL still held the key. - `ZeroBounceWarmup` redacts a failure to read the response body (for example a connection closed mid-body) like every other error. In 4.0.0 and earlier that error was rethrown as it came from `fetch`, so a `fetch` implementation that quotes the request or the key in it passed the key to the caller. - Error messages are also redacted for the JSON-escaped form of every secret (the API key, the Warmup key, and the SMTP username and password), with and without `/` escaped as `\/`. 4.0.0 and earlier removed the raw, URL-encoded and `escape()` forms only, so a secret containing `"` or `\` (or `/`, where the body escapes it as `\/`) stayed readable in a message built from a body that quotes a JSON request (for example a 400 echoing `validateBatch`'s body or `testSmtpConfiguration`'s password). - Error messages are also redacted for the URL-encoded forms of every secret's JSON-escaped copy (spaces as `%20` and, as `URLSearchParams` writes them, as `+`), for the `URLSearchParams` form of the secret itself, and for a twice JSON-escaped copy (with or without `/` escaped as `\/` at either step, also URL- and form-encoded). Earlier, an SMTP password or key containing `"`, `\`, `'` or a space stayed readable in a message built from a body that echoes the request URL-encoded (for example a 500 quoting `testSmtpConfiguration`'s JSON body URL-encoded, or quoting it as a JSON string). - `ZeroBounceWarmup` JSON methods reject a 2xx answer served as `text/html` (a proxy or challenge page) with a `ZBApiError`, even when its body parses as JSON. 4.0.0 and earlier returned such a body as the result. - The API key is held in a private field of `ZeroBounceSDK` and `ZeroBounceWarmup`, not in a property. `console.log("%o", client)`, `util.inspect(client, { showHidden: true })` and every walk of the object's properties now show `api_key: '***'` or nothing, never the key. 4.0.0 kept the key in a non-enumerable `_api_key` property, which `%o` and `showHidden` printed. The default `util.inspect` output shows the key as `api_key: '***'` (or `null` before `init`). - Redaction decodes `\UXXXX` (capital U, four hex digits) and `\UXXXXXXXX`, as well as `\u{...}`/`\U{...}`; 4.0.0 returned a key echoed as `\U007a\U0062...` verbatim. A surrogate pair may be written with `\u` or `\U` for either half. - Redaction reads runs of `\xHH` and octal byte escapes as UTF-8 (`\xc3\xa9` is "é"), and `%XX` runs as Latin-1 as well (`%E9` is "é"): a non-ASCII key echoed by byte is no longer returned. - Redaction works on at most 64 KiB (UTF-8) of text; longer text is replaced by `ZeroBounce: the text was omitted because it is too long to show.` (adversarial 1 MB text took seconds, synchronously). ### Added - `InboxPlacementProviderGroup`, the type of `emailProviders` and `gatewayProviders` in `InboxPlacementProvidersResponse` (the same shape as before, now named). - `ValidationFileStatusResponse` and `ScoringFileStatusResponse` declare the optional `message` (a string) that a file-status answer can carry. 4.0.0 did not declare it; a list of strings is joined with `"\n"` (see the file job bullet under Fixed). - `init` options `bulkBaseURL` (default `https://bulkapi.zerobounce.net/v2`) and `bulkRootBaseURL` (default `https://bulkapi.zerobounce.net`), checked like the other base URLs, so tests and callers can point the bulk calls at a stub. - Types: the statics `ZeroBounceSDK.ListEvaluatorURL`, `InboxPlacementURL`, `EmailFinderURL` and `DomainSearchURL` are declared in `zeroBounceSDK.d.ts` (the `.d.mts` re-exports it); the file options accept `File | Blob | Uint8Array`. ### Changed - `timeout` of `ValidateEmailOptions` and `ValidateBatchOptions` is typed `number | string` (a string of digits only is accepted), and its JSDoc, the README and `documentation.md` state the ranges: 3-60 for `validateEmail`, 10-120 for `validateBatch`. - `getCredits` returns `Credits` as the string its type declares when the API sends a JSON integer: `{"Credits":2375323}` resolves to `{ Credits: "2375323" }`. 4.0.0 returned the number as it came, although `GetCreditsResponse.Credits` is typed `string`. The string form the API sends (`"12345"`, `"-1"`) is returned unchanged. - `zeroBounceSDK.d.ts` declares the runtime statics `ZeroBounceSDK.ZeroBounceWarmup`, `ZeroBounceSDK.ZBApiError`, `ZeroBounceSDK.ZeroBounceSDK` and `ZeroBounceSDK.default` (`Warmup` was already declared); `ZeroBounceSDK.ZBApiError` is the only route to the error class from the `