otpwatch handler_api.php recipes
Get API key

Your software buys numbers through handler_api? Get paid on its volume

If your bot, panel or test-automation service orders numbers for other people, the SimAggregator partner program pays you a percentage of everything they buy through it. The tag is one parameter on every order request. There is no cap, and your users pay the same price as before.

Apply with your software Opens the SimAggregator partner portal. Software review takes one business day and needs API access.

Who it is for

The program pays on your users' volume: your code places the order, your user gets the number. That covers three kinds of software:

If your own team is the only buyer, there is no user volume to count. A plain API key and the handler_api.php reference are all you need.

How softId works

The partner portal shows the order request like this:

order request, as shown on the portal
# handler_api reference: https://otpwatch.com/software-program
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
GET /stubs/handler_api.php?api_key=…&action=getNumber&service=…&country=…&softId=SW-…

softId carries your software's ID. The platform sees the tag, issues the number as usual and credits your partner balance for every completed activation. The payout is calculated from the full price of that activation, with no deductions. Your user pays the normal price: the tag does not change what the order costs.

In the API docs, softId is an optional string of up to 255 characters on getNumber and getNumberV2. Those are the two calls that place an order, so that is where it goes, every time. An order sent without it carries no tag. The rest of the protocol stays exactly as in the reference.

Put it in one place

Add the tag where requests are built, not at each call site. Then no new code path can forget it, and an empty value stops the order instead of sending it untagged.

.env.example
# handler_api reference: https://otpwatch.com/software-program
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
SMS_API_BASE_URL=https://sim-aggregator.org/stubs/handler_api.php
# Key from the SimAggregator dashboard: https://otpwatch.com/key
SMS_API_KEY=
sms.mjs
// handler_api reference: https://otpwatch.com/software-program
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
const BASE_URL = process.env.SMS_API_BASE_URL ?? "https://sim-aggregator.org/stubs/handler_api.php";
const API_KEY = process.env.SMS_API_KEY;
const SOFT_ID = process.env.SIM_SOFT_ID; // your software ID (SW-…)
const ORDERS = new Set(["getNumber", "getNumberV2"]);

export async function sms(action, params = {}) {
  const url = new URL(BASE_URL);
  url.search = new URLSearchParams({ action, api_key: API_KEY, ...params });
  if (ORDERS.has(action)) {
    if (!SOFT_ID) throw new Error("SIM_SOFT_ID is empty: this order would go out untagged");
    url.searchParams.set("softId", SOFT_ID);
  }
  const res = await fetch(url);
  if (!res.ok) throw new Error(`HTTP ${res.status} on ${action}`);
  return (await res.text()).trim();
}
sms.py
# handler_api reference: https://otpwatch.com/software-program
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
import os

import requests

BASE_URL = os.getenv("SMS_API_BASE_URL", "https://sim-aggregator.org/stubs/handler_api.php")
API_KEY = os.environ["SMS_API_KEY"]
SOFT_ID = os.getenv("SIM_SOFT_ID", "")  # your software ID (SW-…)
ORDERS = {"getNumber", "getNumberV2"}


def sms(action: str, **params) -> str:
    query = {"action": action, "api_key": API_KEY, **params}
    if action in ORDERS:
        if not SOFT_ID:
            raise RuntimeError("SIM_SOFT_ID is empty: this order would go out untagged")
        query["softId"] = SOFT_ID
    r = requests.get(BASE_URL, params=query, timeout=30)
    r.raise_for_status()
    return r.text.strip()
sms.php
<?php
// handler_api reference: https://otpwatch.com/software-program
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
const ORDERS = ['getNumber', 'getNumberV2'];

function sms(string $action, array $params = []): string {
    $base = getenv('SMS_API_BASE_URL') ?: 'https://sim-aggregator.org/stubs/handler_api.php';
    $query = ['action' => $action, 'api_key' => getenv('SMS_API_KEY')] + $params;
    if (in_array($action, ORDERS, true)) {
        $softId = getenv('SIM_SOFT_ID');
        if (!$softId) throw new RuntimeException('SIM_SOFT_ID is empty: this order would go out untagged');
        $query['softId'] = $softId;
    }
    $body = file_get_contents($base . '?' . http_build_query($query));
    if ($body === false) throw new RuntimeException("request failed: $action");
    return trim($body);
}

When the ID is wrong

An invalid softId gets the order refused with BAD_SOFTWARE_ID ("Invalid softId" in the API docs). That is a configuration error, not a shortage of numbers: do not retry it the way you retry NO_NUMBERS. Stop ordering, raise an alert and fix the value. The other refusals and what to do with them are on the error codes page.

What you need

API access

A SimAggregator account and an API key. The Get API key button at the top of this page opens the buyer sign-up on sim-aggregator.org; keys are issued in its dashboard, and the handler_api reference lists every call.

An application on the partner portal

Sign up on the partner portal and connect your software. The review takes one business day. A referral link needs no review; software does.

softId on every order

Once the software is approved, put its ID into softId as in the examples above and ship it. Prices for your users stay the same.

Payouts and withdrawal

Each completed activation through your software is credited to your partner balance. Withdraw from $10 by request in the dashboard: requests are processed within one business day, in USDT (TRC-20) or USDC (BEP-20, Polygon).

The portal has two ways in. They differ in what gets tagged and where the payout stops.

Referral linkSoftware program
What is taggeda person who comes through your linkevery order your software sends with softId
Ratea percentage of each purchaseset individually for each piece of software
Cap$50 per referred clientno cap
How long it paysuntil that person reaches the capas long as the software is active
To starta link in a couple of minutes, no reviewapplication and review, one business day
You needan audienceAPI access and software with users

The cap is the line that matters for software. Through a link, the payout from one client stops at $50, however much that client keeps buying. Orders your software places have no such line, for as long as it runs. If you also have a channel or a blog, a referral link and the software program work side by side and pay into the same balance.

Moving your code to this base URL

If your software already speaks handler_api.php to another endpoint, the move is mostly a new base URL and a new key. Migrate by base URL has the checklist: ids, timers, cancellation, refunds and a staging run that costs cents.

Item 7 of that checklist says to drop parameters the reference does not list, and a software tag from your old setup is one of them. softId is the exception: it is in the API docs for getNumber and getNumberV2. Finish the migration first, then add softId and repeat one order on the staging key.

ready to run it?

Apply once, tag every order, and each completed activation your software places counts toward your balance.

Apply with your software

Install for your coding agent

terminal
# Agent skills index: https://otpwatch.com/.well-known/agent-skills/index.json
npx skills add https://otpwatch.com

Two skills: receiving an SMS code in your own app or test, and building a bot that sells numbers. Index: /.well-known/agent-skills/index.json

Updated