SDK Reference
Full API reference forzerodrop-client.
Installation
ZeroDrop class
Parameters
Without an API key, anyone who knows an inbox’s name can read it, one sender can reach only 5 different inboxes a day (past that, the inbox gets a notice from
notice@zerodrop.dev instead of the email), and each inbox expires 30 minutes after its latest email, on a shared domain. With a free key (zerodrop-client 0.3.0 or later), generateInbox() starts names with your key’s prefix, only your key can read those inboxes, and mail to them isn’t limited. mail.prefix holds the prefix ("k7x2"), or null without a key.
generateInbox()
waitForLatest()
ZeroDropTimeoutError if no email arrives within the timeout, and ZeroDropHeldError at once if ZeroDrop held the email (see Error types).
Options
fetchLatest()
null if the inbox is empty or no email matches the filter. Throws ZeroDropHeldError if nothing matches and the inbox holds a notice that ZeroDrop held an email.
ZeroDropEmail type
otp
4-8 digit numeric code extracted from the email body. Detected near labels likecode, otp, pin, verification. null if not detected.
magicLink
Verification or reset URL extracted from the email body. Detected for URLs containingverify, confirm, reset, token, activate, or auth. null if not detected.
Error types
ZeroDropTimeoutError
Thrown when no email arrives within the timeout.ZeroDropHeldError
Thrown when ZeroDrop held the email. Without an API key, one sender can reach only 5 different inboxes a day. Past that, the email isn’t stored, and the inbox gets a notice fromnotice@zerodrop.dev instead. waitForLatest() throws at once rather than waiting for the timeout, and the message is the server’s reason. A free key from zerodrop.dev/keys lifts the limit for inboxes under your key’s prefix.
ZeroDropHeldError is new in zerodrop-client 0.4.0. Older versions treat the notice as an email: without a filter, waitForLatest returns it (its otp is null), and a filter such as { hasOtp: true } skips it, so the wait ends in ZeroDropTimeoutError.
ZeroDropNetworkError
Thrown when the API is unreachable. Includes a link to the status page.ZeroDropAuthError
Thrown on a 401: the inbox belongs to an account’s prefix and the request had no key or the wrong one. The message carries the server’s reason.Zero telemetry
The SDK does not send analytics, usage metrics, or environment data to any server. The only network requests made are explicit inbox polls tozerodrop.dev/api/inbox/{name}.
Your CI pipeline is your business.