# onlinesim-js-api

> Typed, zero-dependency client for the OnlineSim API (SMS numbers, rent, account, free numbers)

Latest version **2.1.0** (published 2026-11-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install onlinesim-js-api
pnpm add onlinesim-js-api
yarn add onlinesim-js-api
bun add onlinesim-js-api
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2026-11-19 |
| First published | 2020-08-05 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 298.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 17 |
| Author | s00d |
| Maintainers | s00d |
| Keywords | onlinesim, sms, virtual-number, sms-activation, api, typescript |

## Links

- npm: https://www.npmjs.com/package/onlinesim-js-api
- Repository: https://github.com/s00d/onlinesim-js-api
- Homepage: https://s00d.github.io/onlinesim-js-api/
- Issues: https://github.com/s00d/onlinesim-js-api/issues
- npm.io page: https://npm.io/package/onlinesim-js-api

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2026-11-19
- 2.0.0 — 2026-11-19
- 1.1.2 — 2024-12-25
- 1.1.1 — 2024-11-26
- 1.1.0 — 2024-11-26
- 1.0.23 — 2023-02-22
- 1.0.22 — 2021-08-19
- 1.0.21 — 2021-08-19
- 1.0.20 — 2021-08-17
- 1.0.19 — 2021-08-17
- 1.0.18 — 2021-08-17
- 1.0.17 — 2021-08-17
- 1.0.16 — 2021-08-02
- 1.0.15 — 2021-08-02
- 1.0.14 — 2020-11-10
- … 13 more at https://npm.io/package/onlinesim-js-api/versions

## README

# onlinesim-js-api

[![npm version](https://img.shields.io/npm/v/onlinesim-js-api.svg)](https://www.npmjs.com/package/onlinesim-js-api)
[![CI](https://github.com/s00d/onlinesim-js-api/actions/workflows/ci.yml/badge.svg)](https://github.com/s00d/onlinesim-js-api/actions/workflows/ci.yml)

Typed JavaScript/TypeScript client for the [OnlineSim](https://onlinesim.io) API: SMS numbers, rent, account and free numbers.
Zero runtime dependencies (global `fetch`), Node.js 18+ and browsers, ESM and CommonJS.

```bash
npm install onlinesim-js-api
```

```ts
import { OnlineSim } from 'onlinesim-js-api'

const client = new OnlineSim({ apiKey: process.env.ONLINESIM_KEY })

const { balance, zbalance } = await client.user.balance()
console.log(`available: ${balance - zbalance} USD`)

const { tzid, number } = await client.numbers.getWithNumber('google', 44)
console.log(`enter ${number} in the app`)
console.log('code:', await client.numbers.waitCode(tzid))
```

## Testing

`MockOnlineSim` is a built-in offline fake of the API: test your integration without network, key or money.
More in the [testing guide](https://s00d.github.io/onlinesim-js-api/testing).

```ts
import assert from 'node:assert/strict'
import { MockOnlineSim } from 'onlinesim-js-api'

const mock = new MockOnlineSim({ balance: 10 })
const client = mock.client()

const tzid = await client.numbers.get('google', 44)
mock.addSmsAfter(tzid, 'Your code: 123-456', 2) // arrives on the third poll
assert.equal(await client.numbers.waitCode(tzid, { interval: 0 }), '123456')
assert.equal(mock.balance(), 9.8)
```

Documentation: **https://s00d.github.io/onlinesim-js-api/** · Changes: [CHANGELOG.md](CHANGELOG.md) · License: Apache-2.0

---
_Source: https://npm.io/package/onlinesim-js-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
