Official SDK Libraries ยท v1.0.0

Integrate HS Mail in Minutes

Official client libraries for PHP, Node.js, and Python. Full type safety, built-in authentication, automatic error handling โ€” everything you need to work with the HS Mail API without writing a single raw HTTP call.

๐Ÿ˜

PHP SDK

Packagist
v1.0.0
composer require hsmail/hsmail-sdk
  • PHP 8.0+
  • Guzzle HTTP Client
  • 5 Typed Exceptions
  • Composer / Packagist
โฌก

Node.js SDK

npm
v1.0.0
npm install hsmail-sdk
  • Node 18+ / TypeScript
  • Zero Dependencies
  • 25+ Type Definitions
  • npm / yarn / pnpm
๐Ÿ

Python SDK

PyPI
v1.0.0
pip install hsmail-sdk
  • Python 3.8+
  • requests Library
  • Pythonic Naming
  • pip / PyPI

Complete API Coverage

All 18 endpoints across 6 resource groups โ€” fully wrapped by every SDK.

๐Ÿ‘คProfile
1 endpoint
  • GET /v1/profile
๐Ÿ“ฆProducts
2 endpoints
  • GET /v1/products
  • GET /v1/products/:id
๐Ÿ›’Orders
5 endpoints
  • POST /v1/orders
  • GET /v1/orders/:id
  • GET /v1/orders/:id/messages
  • POST /v1/orders/:id/message
  • POST /v1/orders/:id/reopen
๐Ÿ“ฌMailbox
8 endpoints
  • Outlook read / check / refresh
  • Gmail read / check
  • Facebook bulk / single
  • Instagram check
  • Hotmail Creator
๐Ÿ”Tools
1 endpoint
  • POST /v1/tools/2fa
๐Ÿ“กStatus
1 endpoint
  • GET /v1/ping

What You Can Build

Every capability of the HS Mail platform, directly accessible from your code.

Browse and filter the full product catalogue by category
Place MANUAL, API, and SERVICE type orders instantly
Poll order status and retrieve delivered items
Read Outlook / Hotmail inboxes and extract OTPs via OAuth
Refresh Outlook OAuth tokens without user interaction
Check Outlook, Gmail, Facebook, Instagram account live/dead status
Manage service-order chat โ€” send messages, reopen under warranty
Batch-create Hotmail accounts (up to 1,000 per job)
Generate TOTP 2FA codes from Base32 secrets in real-time
IP whitelisting for extra API key security

Authentication System

Flexible, secure, and zero-config inside the SDK โ€” just pass your key.

Bearer Token

Pass your key via Authorization: Bearer header โ€” the standard, secure method.

Query Parameter

Alternatively append ?api_key=xxx โ€” useful for quick testing.

IP Whitelisting

Lock your key to specific IP addresses from the dashboard for zero-trust security.

Account Guards

Keys are automatically invalidated if the account is banned, suspended, or unverified.

http
# Method 1 โ€” Authorization header (recommended)
Authorization: Bearer hs_live_xxxxxxxxxxxxxxxxxxxxxxxx

# Method 2 โ€” Query parameter (quick testing)
GET https://api.hsmail.shop/v1/profile?api_key=hs_live_xxx

Rate Limiting

Every SDK handles rate limit errors automatically with typed exceptions.

Rate Limit

100 req / min

Limit Header

X-RateLimit-Remaining

Exceeded Code

RATE_LIMIT_EXCEEDED (429)

Recovery

Wait 60 seconds, then retry

php
// PHP
try { ... }
catch (RateLimitException $e) {
    sleep(60); // wait & retry
}
typescript
// Node.js
} catch (err) {
  if (err instanceof RateLimitError)
    await sleep(60_000);
}
python
# Python
except RateLimitError:
    import time
    time.sleep(60)

Unified Error Hierarchy

Same exception structure across all three SDKs โ€” easy to learn once, use everywhere.

Exception / Error ClassHTTP StatusWhen It's Thrown
AuthenticationException401 / 403Invalid key, banned, suspended, or unverified account
RateLimitException429More than 100 requests per minute
NotFoundException404Product, order, or resource does not exist
InsufficientBalanceException400Account balance too low to complete the order
ValidationException400 / 422Out of stock, order closed, invalid parameters
HsMailException (base)AnyCatch-all for unexpected API errors

Quick Start โ€” 3 Steps

From zero to first API call in under 2 minutes.

01

Get Your API Key

Log into the HS Mail dashboard โ†’ Settings โ†’ API Keys โ†’ Generate โ†’ Copy your key (starts with "hs_live_").

Open Dashboard โ†’
02

Install the SDK

Pick your language and run the install command. The SDK has no build steps โ€” just install and import.

bash
npm install hsmail-sdk   # Node.js
pip install hsmail-sdk   # Python
composer require hsmail/hsmail-sdk  # PHP
03

Make Your First Call

Initialise the client with your key. All methods return typed objects โ€” no JSON parsing needed.

typescript
import { HsMailClient } from 'hsmail-sdk';
const client = new HsMailClient({ apiKey: 'hs_live_xxx' });
const profile = await client.getProfile();
console.log(profile.balance); // e.g. 500 BDT

Ready to Build?

Pick your language, install the SDK, and go. Full reference documentation is one click away.