npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@temp-mail-io/sdk

v0.1.0

Published

Official Node.js SDK for the temp-mail.io API

Downloads

74

Readme

@temp-mail-io/sdk

Official Node.js SDK for the temp-mail.io API.

  • TypeScript-first, ships with .d.ts
  • Zero runtime dependencies — uses the built-in fetch
  • Works on Node.js 18+, Deno, Bun, and any other fetch-capable runtime

Install

npm install @temp-mail-io/sdk

Usage

import { TempMailClient } from '@temp-mail-io/sdk'

const client = new TempMailClient('YOUR_API_KEY')

const email = await client.createEmail()
console.log(`Your temporary email: ${email.email}`)

const messages = await client.listEmailMessages(email.email)
for (const message of messages) {
  console.log(`From: ${message.from}`)
  console.log(`Subject: ${message.subject}`)
}

Grab an API key at https://temp-mail.io/profile/api.

API

new TempMailClient(apiKey | options)

new TempMailClient('YOUR_API_KEY')

new TempMailClient({
  apiKey: 'YOUR_API_KEY',
  baseUrl: 'https://api.temp-mail.io', // override for staging/testing
  timeoutMs: 30_000, // per-request timeout
  fetch: globalThis.fetch, // custom fetch implementation
  userAgent: 'my-app/1.0' // custom User-Agent header
})

Methods

| Method | Description | | -------------------------- | -------------------------------------------------- | | listDomains() | List available domains (public / premium / custom) | | createEmail(options?) | Create a temporary email address | | deleteEmail(email) | Delete a temporary email | | listEmailMessages(email) | List messages received on an address | | getMessage(id) | Get a single message by id | | deleteMessage(id) | Delete a single message | | getMessageSourceCode(id) | Get the raw .eml source for a message | | downloadAttachment(id) | Download an attachment as Uint8Array | | getRateLimit() | Current rate-limit counters |

All methods return a promise and throw on non-2xx responses (see Errors below).

Rate limits

Every successful response carries X-Ratelimit-* headers. The client caches the last-seen values on client.lastRateLimit, so you can check remaining quota without spending another request:

await client.listDomains()
console.log(client.lastRateLimit) // { limit, remaining, used, reset }

Errors

All errors extend TempMailError, which carries statusCode, code, type, detail, and requestId fields (the last one is the API's meta.request_id for support tickets).

import {
  TempMailError,
  AuthenticationError,
  RateLimitError,
  ValidationError,
  NotFoundError
} from '@temp-mail-io/sdk'

try {
  await client.createEmail({ domain: 'does-not-exist.com' })
} catch (err) {
  if (err instanceof RateLimitError) {
    // back off until err.statusCode 429 resets
  } else if (err instanceof ValidationError) {
    console.error(err.detail, err.requestId)
  } else {
    throw err
  }
}

| Class | Triggered by | | --------------------- | ------------------------------------------------- | | AuthenticationError | api_key_invalid, api_key_empty, 401, 403 | | RateLimitError | rate_limited, 429 | | ValidationError | validation_error, 400, 422 | | NotFoundError | not_found, 404 | | TempMailError | Everything else (network failures, timeouts, 5xx) |

License

MIT