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

fivesim-client

v1.0.0

Published

TypeScript client for 5sim.net SMS verification API

Readme

fivesim

TypeScript client for 5sim.net SMS verification API. Get virtual phone numbers for receiving SMS verification codes.

Installation

npm install fivesim

Quick Start

import { FiveSimClient } from 'fivesim';

const client = new FiveSimClient({ apiKey: 'your-api-key' });

// Get balance
const profile = await client.getProfile();
console.log(`Balance: $${profile.balance}`);

// Buy a number for Telegram in Russia
const order = await client.buyActivation({
  country: 'russia',
  operator: 'any',
  product: 'telegram',
});
console.log(`Phone: ${order.phone}, ID: ${order.id}`);

// Poll for SMS
const status = await client.checkOrder(order.id);
if (status.sms && status.sms.length > 0) {
  console.log(`Received code: ${status.sms[0].code}`);
  // Complete order
  await client.finishOrder(order.id);
}

API Reference

Constructor

const client = new FiveSimClient({
  apiKey: string,        // Required: Your 5sim.net API key
  baseUrl?: string,      // Optional: Custom API URL
  timeout?: number,      // Optional: Request timeout in ms (default: 30000)
});

User Information

getProfile()

Get user profile and balance information.

const profile = await client.getProfile();
// Returns: { id, email, balance, rating, default_country, ... }

getOrderHistory(options?)

Get order history with optional filtering.

const history = await client.getOrderHistory({
  category: 'activation',  // 'activation' or 'hosting'
  limit: 10,
  offset: 0,
});

Guest Access (No Authentication)

getCountries()

Get list of available countries.

const countries = await client.getCountries();
// Returns: { russia: { name: 'Russia', iso: 'ru', prefix: '7' }, ... }

getProducts(country, operator)

Get available products for a country and operator.

const products = await client.getProducts('russia', 'any');
// Returns: { telegram: { category: 'social', qty: 50, price: 0.5 }, ... }

getPrices(options?)

Get prices for products.

const prices = await client.getPrices({
  country: 'russia',
  product: 'telegram',
});

Purchase

buyActivation(options)

Buy an activation number.

const order = await client.buyActivation({
  country: 'russia',     // Country code or 'any'
  operator: 'any',       // Operator name or 'any'
  product: 'telegram',   // Product/service name
  forwarding?: '1',      // Optional forwarding
});
// Returns: Order with id, phone, status, etc.

buyHosting(options)

Buy a hosting number (long-term rental).

const order = await client.buyHosting({
  country: 'russia',
  operator: 'any',
  product: 'telegram',
});

Order Management

checkOrder(id)

Check order status and retrieve SMS messages.

const order = await client.checkOrder(12345);
// Returns: Order with sms array

finishOrder(id)

Complete an order after receiving SMS.

await client.finishOrder(12345);

cancelOrder(id)

Cancel an order and get refund.

await client.cancelOrder(12345);

banNumber(id)

Report a number as already used on target service.

await client.banNumber(12345);

Order Statuses

  • PENDING - Number purchased, waiting for SMS
  • RECEIVED - SMS received
  • FINISHED - Order completed successfully
  • CANCELED - Order canceled, refund processed
  • TIMEOUT - Order expired without receiving SMS
  • BANNED - Number banned/reported

Error Handling

The library provides custom error classes:

import { 
  FiveSimError,
  AuthenticationError,
  RateLimitError,
  ServiceUnavailableError,
  NoNumbersError,
} from 'fivesim';

try {
  const order = await client.buyActivation({ ... });
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Invalid API key');
  } else if (error instanceof RateLimitError) {
    console.error('Rate limit exceeded, wait before retrying');
  } else if (error instanceof NoNumbersError) {
    console.error('No numbers available for this service');
  }
}

Rate Limits

5sim API has the following limits:

  • 100 requests per second per IP address
  • 100 requests per second per API key
  • 100 "buy number" requests per second
  • Exceeding limits 5 times in 10 minutes results in a 10-minute ban

Example Usage

See examples/test-api.ts for a complete example:

# Set your API key
export FIVESIM_API_KEY=your-api-key

# Run basic tests
npx tsx examples/test-api.ts

# Run full activation test (WARNING: uses credits!)
npx tsx examples/test-api.ts --activate

TypeScript Support

This library is written in TypeScript and includes full type definitions. All API methods are fully typed.

License

MIT

Links