انتقل إلى المحتوى
في هذه الصفحة

OniCode Reseller API v1.0.0

The API your own server calls to buy numbers, read their codes and manage your dollar balance.

  • Base path: /reseller/v1.
  • Authentication: every request sends Authorization: Bearer <key>, the Reseller API key from the website's reseller section (ocr_…, shown once when it is created; creating a new key revokes the old one at once). A missing, unknown, revoked or suspended key gets 401 unauthenticated (as does a key whose account is blocked or deleted). A key with an IP allowlist, used from an address outside it, gets 403 reseller_ip_not_allowed. HTTPS only. Never send your key over plain http: if you ever did, create a new key at once. When you create a new key, switch your servers to it at once: requests still sending the old key get 401, and 20 failed authentications a minute from one address pause that address for up to a minute.
  • Rate limits: past 50 requests a second per key and client address (an IPv6 client counts by its /64), or after 20 failed authentications a minute from one address, requests get 429 rate_limited with a Retry-After header and retryAfterSeconds. Past the per-key limit a 10-second block follows for that key and address: every request during it gets the same 429 with the seconds left, and none lengthens it. The Reseller's own rate (50 a second across all its addresses) answers 429 without a block: retry after Retry-After. Buys (createOrder) and cancels (cancelOrder) have their own per-second limits (10 each), with no block.
  • Limits and blocks: at most a set number of numbers wait for a code at once, and a service in a country (or the whole account) is blocked for a while after too few codes; removeLimits lifts the blocks a few times a UTC day. getLimits gives the rules, the current numbers and the blocks now.
  • Levels: the top-ups credited in the previous UTC week set this week's level, and its discount is already in every price (getLevel).
  • Webhooks: set one https URL in the website's reseller section. Each event is a POST with a JSON body {type, timestamp, data} and the Standard Webhooks headers webhook-id (the same on every retry: deduplicate on it), webhook-timestamp (Unix seconds) and webhook-signature (v1, + Base64 HMAC-SHA256 of id.timestamp.body, keyed with the Base64-decoded part of the secret after whsec_). Verify with any Standard Webhooks library and refuse a timestamp more than 5 minutes off. Answer 2xx within 10 seconds; anything else, redirects included (never followed), is retried by default after 5 s, 30 s, 2 min, 10 min, 30 min, 1 h, 2 h, 4 h, 8 h and 8 h, then given up. Deliveries can arrive out of order and more than once, and a completed order may still get a later order.sms_received. The event bodies are under Webhooks below.
  • Money is the Money schema in US dollars: amountMicros is 1e-6 of a dollar (1.50 USD = 1500000) and currency is USD. Never a float.
  • Prices are the Reseller's own, in USD (listPrices), charged to the Reseller wallet. A number that gets no code (cancelled, expired or failed) is refunded in full.
  • Idempotency: buying (createOrder) and cancelling (cancelOrder) require an Idempotency-Key header, a unique value per action (a UUID). Retrying with the same key returns the same result and never charges twice; the same key with a different request is idempotency_key_reused.
  • Errors are application/problem+json (RFC 9457) with a stable code. Branch on code, never on title or detail.
  • Lists use cursor pagination: ?cursor=&limit= returns { items, nextCursor }; send nextCursor back as cursor until it is absent.
  • JSON fields are camelCase. IDs are opaque strings. Timestamps are RFC 3339 UTC.

The samples read your key from ONICODE_RESELLER_KEY (export ONICODE_RESELLER_KEY=ocr_…).

wallet

GET/reseller/v1/wallet

The Reseller wallet's balance

getWallet

Responses

StatusDescriptionSchema
200The wallet.Wallet
429A 429: `rate_limited`, or `reseller_limit_removals_exhausted` on `removeLimits`. When a wait applies, the `Retry-After` header and `retryAfterSeconds` give the seconds to wait. Both are absent when no wait helps: `reseller_limit_removals_exhausted` with `removalsPerDay` 0 (removing is never possible). Problem
defaultError (RFC 9457). Branch on `code`.Problem

Error codes

  • unauthenticated
  • reseller_ip_not_allowed
  • rate_limited

Example

curl 'https://reseller-api.oni-code.com/reseller/v1/wallet' \
  -H "Authorization: Bearer $ONICODE_RESELLER_KEY"
GET/reseller/v1/wallet/entries

The Reseller wallet's ledger entries, newest first

listWalletEntries

Parameters

NameInTypeRequiredDescription
cursorquerystringnoOpaque cursor from a previous page's `nextCursor`.
limitqueryinteger (int32)noItems per page. More than 50 is `validation_failed`.

Responses

StatusDescriptionSchema
200A page of ledger entries.LedgerEntryPage
429A 429: `rate_limited`, or `reseller_limit_removals_exhausted` on `removeLimits`. When a wait applies, the `Retry-After` header and `retryAfterSeconds` give the seconds to wait. Both are absent when no wait helps: `reseller_limit_removals_exhausted` with `removalsPerDay` 0 (removing is never possible). Problem
defaultError (RFC 9457). Branch on `code`.Problem

Error codes

  • validation_failed
  • unauthenticated
  • reseller_ip_not_allowed
  • rate_limited

Example

curl 'https://reseller-api.oni-code.com/reseller/v1/wallet/entries' \
  -H "Authorization: Bearer $ONICODE_RESELLER_KEY"

orders

GET/reseller/v1/services/{serviceId}/prices

A service's prices per country, at the Reseller's own price

listPrices

The website's price tiers for the service in each country, each at the Reseller's own price in USD. Read from the offer cache, so about a minute old. Buy a tier by sending its price to createOrder.

Parameters

NameInTypeRequiredDescription
serviceIdpathstringyes

Responses

StatusDescriptionSchema
200The prices.PriceList
429A 429: `rate_limited`, or `reseller_limit_removals_exhausted` on `removeLimits`. When a wait applies, the `Retry-After` header and `retryAfterSeconds` give the seconds to wait. Both are absent when no wait helps: `reseller_limit_removals_exhausted` with `removalsPerDay` 0 (removing is never possible). Problem
defaultError (RFC 9457). Branch on `code`.Problem

Error codes

  • validation_failed
  • unauthenticated
  • reseller_ip_not_allowed
  • not_found
  • provider_unavailable
  • rate_limited

Example

curl 'https://reseller-api.oni-code.com/reseller/v1/services/whatsapp/prices' \
  -H "Authorization: Bearer $ONICODE_RESELLER_KEY"
POST/reseller/v1/orders

Buy a number

createOrder

Charges exactly price (a tier's price from listPrices) to the Reseller wallet and assigns a number. Never charged more: when the cheapest price now is above price, nothing is charged and the answer is price_changed with currentPrice. With no number at that price, nothing is charged (no_numbers_available). Retrying with the same Idempotency-Key and the same request returns the same order (or the same failure) and never charges twice; the same key with another serviceId, countryId, price or customerRef is idempotency_key_reused. At most limit numbers wait for a code at once (reseller_concurrency_limit, nothing charged). While the service in that country is blocked (reseller_pair_blocked) or every purchase is (reseller_account_blocked), nothing is charged; both carry blockedUntil (see getLimits). A number that gets no code before expiresAt is refunded in full.

Parameters

NameInTypeRequiredDescription
Idempotency-KeyheaderstringyesA unique value per action (UUID recommended). Reuse it only to retry the same request.

Request body

CreateOrderRequest

Responses

StatusDescriptionSchema
201The order, normally in `waiting_sms` with a phone number.Order
429A 429: `rate_limited`, or `reseller_limit_removals_exhausted` on `removeLimits`. When a wait applies, the `Retry-After` header and `retryAfterSeconds` give the seconds to wait. Both are absent when no wait helps: `reseller_limit_removals_exhausted` with `removalsPerDay` 0 (removing is never possible). Problem
defaultError (RFC 9457). Branch on `code`.Problem

Error codes

  • validation_failed
  • unauthenticated
  • reseller_ip_not_allowed
  • not_found
  • reseller_insufficient_balance
  • no_numbers_available
  • price_changed
  • reseller_concurrency_limit
  • reseller_pair_blocked
  • reseller_account_blocked
  • idempotency_key_reused
  • provider_unavailable
  • rate_limited

Example

curl -X POST 'https://reseller-api.oni-code.com/reseller/v1/orders' \
  -H "Authorization: Bearer $ONICODE_RESELLER_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"serviceId":"whatsapp","countryId":"ID","price":{"amountMicros":5898000,"currency":"USD"},"customerRef":"tg-58210443"}'
GET/reseller/v1/orders

The Reseller's orders, newest first

listOrders

Parameters

NameInTypeRequiredDescription
statusqueryarray of OrderStatusnoOnly orders in one of these statuses.
cursorquerystringnoOpaque cursor from a previous page's `nextCursor`.
limitqueryinteger (int32)noItems per page. More than 50 is `validation_failed`.

Responses

StatusDescriptionSchema
200A page of orders.OrderPage
429A 429: `rate_limited`, or `reseller_limit_removals_exhausted` on `removeLimits`. When a wait applies, the `Retry-After` header and `retryAfterSeconds` give the seconds to wait. Both are absent when no wait helps: `reseller_limit_removals_exhausted` with `removalsPerDay` 0 (removing is never possible). Problem
defaultError (RFC 9457). Branch on `code`.Problem

Error codes

  • validation_failed
  • unauthenticated
  • reseller_ip_not_allowed
  • rate_limited

Example

curl 'https://reseller-api.oni-code.com/reseller/v1/orders' \
  -H "Authorization: Bearer $ONICODE_RESELLER_KEY"
GET/reseller/v1/orders/active

Numbers waiting for a code, and ones completed in the last rental

listActiveOrders

Poll it while numbers wait for their codes, rather than each order apart. Use serverTime for countdowns.

Parameters

NameInTypeRequiredDescription
cursorquerystringnoOpaque cursor from a previous page's `nextCursor`.
limitqueryinteger (int32)noItems per page. More than 100 is `validation_failed`.

Responses

StatusDescriptionSchema
200Active orders.ActiveOrders
429A 429: `rate_limited`, or `reseller_limit_removals_exhausted` on `removeLimits`. When a wait applies, the `Retry-After` header and `retryAfterSeconds` give the seconds to wait. Both are absent when no wait helps: `reseller_limit_removals_exhausted` with `removalsPerDay` 0 (removing is never possible). Problem
defaultError (RFC 9457). Branch on `code`.Problem

Error codes

  • validation_failed
  • unauthenticated
  • reseller_ip_not_allowed
  • rate_limited

Example

curl 'https://reseller-api.oni-code.com/reseller/v1/orders/active' \
  -H "Authorization: Bearer $ONICODE_RESELLER_KEY"
GET/reseller/v1/orders/{orderId}

One order

getOrder

Parameters

NameInTypeRequiredDescription
orderIdpathstring (uuid)yes

Responses

StatusDescriptionSchema
200The order.Order
429A 429: `rate_limited`, or `reseller_limit_removals_exhausted` on `removeLimits`. When a wait applies, the `Retry-After` header and `retryAfterSeconds` give the seconds to wait. Both are absent when no wait helps: `reseller_limit_removals_exhausted` with `removalsPerDay` 0 (removing is never possible). Problem
defaultError (RFC 9457). Branch on `code`.Problem

Error codes

  • validation_failed
  • unauthenticated
  • reseller_ip_not_allowed
  • not_found
  • rate_limited

Example

curl 'https://reseller-api.oni-code.com/reseller/v1/orders/ORDER_ID' \
  -H "Authorization: Bearer $ONICODE_RESELLER_KEY"
POST/reseller/v1/orders/{orderId}/cancel

Cancel a waiting number and refund its price

cancelOrder

Allowed from cancelAvailableAt (before it: cancel_not_available_yet with cancelAvailableAt) until a code arrives (then: order_not_cancellable). The whole price comes back to the Reseller wallet. Cancelling a cancelled order returns it as it is.

Parameters

NameInTypeRequiredDescription
Idempotency-KeyheaderstringyesA unique value per action (UUID recommended). Reuse it only to retry the same request.
orderIdpathstring (uuid)yes

Responses

StatusDescriptionSchema
200The order after cancellation (or as it is, if a code arrived first).Order
429A 429: `rate_limited`, or `reseller_limit_removals_exhausted` on `removeLimits`. When a wait applies, the `Retry-After` header and `retryAfterSeconds` give the seconds to wait. Both are absent when no wait helps: `reseller_limit_removals_exhausted` with `removalsPerDay` 0 (removing is never possible). Problem
defaultError (RFC 9457). Branch on `code`.Problem

Error codes

  • validation_failed
  • unauthenticated
  • reseller_ip_not_allowed
  • not_found
  • order_not_cancellable
  • cancel_not_available_yet
  • provider_unavailable
  • rate_limited

Example

curl -X POST 'https://reseller-api.oni-code.com/reseller/v1/orders/ORDER_ID/cancel' \
  -H "Authorization: Bearer $ONICODE_RESELLER_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

level

GET/reseller/v1/level

The Reseller's level this week, the levels table and this week's top-ups

getLevel

The top-ups credited in the previous UTC week (Monday 00:00 to Monday 00:00 UTC) set this week's level, which holds until next Monday, unless the OniCode team pinned one (pinned). Every price the API returns is already the Reseller's own, the level's discount included.

Responses

StatusDescriptionSchema
200The level.Level
429A 429: `rate_limited`, or `reseller_limit_removals_exhausted` on `removeLimits`. When a wait applies, the `Retry-After` header and `retryAfterSeconds` give the seconds to wait. Both are absent when no wait helps: `reseller_limit_removals_exhausted` with `removalsPerDay` 0 (removing is never possible). Problem
defaultError (RFC 9457). Branch on `code`.Problem

Error codes

  • unauthenticated
  • reseller_ip_not_allowed
  • rate_limited

Example

curl 'https://reseller-api.oni-code.com/reseller/v1/level' \
  -H "Authorization: Bearer $ONICODE_RESELLER_KEY"

limits

GET/reseller/v1/limits

The Reseller's limits and the blocks now

getLimits

Responses

StatusDescriptionSchema
200The limits.Limits
429A 429: `rate_limited`, or `reseller_limit_removals_exhausted` on `removeLimits`. When a wait applies, the `Retry-After` header and `retryAfterSeconds` give the seconds to wait. Both are absent when no wait helps: `reseller_limit_removals_exhausted` with `removalsPerDay` 0 (removing is never possible). Problem
defaultError (RFC 9457). Branch on `code`.Problem

Error codes

  • unauthenticated
  • reseller_ip_not_allowed
  • rate_limited

Example

curl 'https://reseller-api.oni-code.com/reseller/v1/limits' \
  -H "Authorization: Bearer $ONICODE_RESELLER_KEY"
POST/reseller/v1/limits/remove

Lift every block now ("Remove limits")

removeLimits

Lifts every block in force (each blocked service and country, and an account block) and counts one use; removalsPerDay uses a UTC day. With no block to lift, nothing is counted and the limits come back as they are. With no use left today: reseller_limit_removals_exhausted with retryAfterSeconds to the next 00:00 UTC (absent when removalsPerDay is 0: removing is never possible), and nothing is lifted. The request rate and the numbers waiting at once can't be lifted. After a removal, a service in a country counts its numbers from the removal on.

Responses

StatusDescriptionSchema
200The limits after the removal.Limits
429A 429: `rate_limited`, or `reseller_limit_removals_exhausted` on `removeLimits`. When a wait applies, the `Retry-After` header and `retryAfterSeconds` give the seconds to wait. Both are absent when no wait helps: `reseller_limit_removals_exhausted` with `removalsPerDay` 0 (removing is never possible). Problem
defaultError (RFC 9457). Branch on `code`.Problem

Error codes

  • unauthenticated
  • reseller_ip_not_allowed
  • rate_limited
  • reseller_limit_removals_exhausted

Example

curl -X POST 'https://reseller-api.oni-code.com/reseller/v1/limits/remove' \
  -H "Authorization: Bearer $ONICODE_RESELLER_KEY"

Webhooks

order.sms_received

A message arrived for an order (the first included).

Body: OrderSmsReceivedEvent

{
  "type": "order.sms_received",
  "timestamp": "2026-11-16T10:31:00Z",
  "data": {
    "orderId": "019a8b2c-4d5e-7f60-8a1b-2c3d4e5f6a01",
    "customerRef": "user-4711",
    "serviceId": "whatsapp",
    "countryId": "ID",
    "status": "completed",
    "message": {
      "code": "123456",
      "text": "Your WhatsApp code: 123456",
      "receivedAt": "2026-11-16T10:31:00Z"
    }
  }
}

order.closed

An order reached a final status. refunded is 0 for completed and the whole price otherwise.

Body: OrderClosedEvent

{
  "type": "order.closed",
  "timestamp": "2026-11-16T10:40:00Z",
  "data": {
    "orderId": "019a8b2c-4d5e-7f60-8a1b-2c3d4e5f6a02",
    "serviceId": "whatsapp",
    "countryId": "ID",
    "status": "expired",
    "refunded": {
      "amountMicros": 250000,
      "currency": "USD"
    },
    "closedAt": "2026-11-16T10:40:00Z"
  }
}

webhook.test

Sent only by the Send test button in the website's reseller section; once, never retried. data is empty.

Body: WebhookTestEvent

{
  "type": "webhook.test",
  "timestamp": "2026-11-16T10:00:00Z",
  "data": {}
}

Schemas

Problem

RFC 9457 problem details. code values used by this API: validation_failed, unauthenticated, not_found, rate_limited, internal_error, reseller_ip_not_allowed, idempotency_key_reused, reseller_insufficient_balance, no_numbers_available, price_changed, reseller_concurrency_limit, reseller_pair_blocked, reseller_account_blocked, reseller_limit_removals_exhausted, order_not_cancellable, cancel_not_available_yet, provider_unavailable. Some codes carry extra fields (listed below): rate_limited carries retryAfterSeconds, price_changed currentPrice, reseller_concurrency_limit limit, reseller_insufficient_balance balance, cancel_not_available_yet cancelAvailableAt, reseller_pair_blocked and reseller_account_blocked blockedUntil and retryAfterSeconds, and reseller_limit_removals_exhausted retryAfterSeconds (when a wait applies).

FieldTypeRequiredDescription
typestringyes
titlestringyesShort English summary for developers. Don't show it to users.
statusintegeryes
codestringyes
detailstringnoEnglish details for developers.
requestIdstringno
retryAfterSecondsintegerno`rate_limited`, `reseller_pair_blocked`, `reseller_account_blocked`, `reseller_limit_removals_exhausted`: seconds to wait, as the `Retry-After` header says. Absent on `reseller_limit_removals_exhausted` when `removalsPerDay` is 0.
blockedUntilstring (date-time)no`reseller_pair_blocked`, `reseller_account_blocked`: when the block ends.
currentPriceMoneyno`price_changed`: the cheapest price now. Buy at it (or a higher tier) to go ahead.
limitintegerno`reseller_concurrency_limit`: the most numbers that may wait for a code at once.
balanceMoneyno`reseller_insufficient_balance`: the Reseller wallet's balance.
cancelAvailableAtstring (date-time)no`cancel_not_available_yet`: when cancelling is allowed.
errorsarray of objectno`validation_failed`: one entry per invalid field.
errors[].fieldstringyes
errors[].messagestringyes
{
  "type": "https://docs.oni-code.com/errors/rate_limited",
  "title": "Too many requests",
  "status": 429,
  "code": "rate_limited",
  "retryAfterSeconds": 1
}

Money

A fiat amount in micros (1e-6 of the unit). 0.99 USD = 990000.

FieldTypeRequiredDescription
amountMicrosinteger (int64)yes
currencystringyes
{
  "amountMicros": 990000,
  "currency": "USD"
}

Wallet

FieldTypeRequiredDescription
balanceMoneyyesThe Reseller wallet's balance in USD. Never negative.
{
  "balance": {
    "amountMicros": 125500000,
    "currency": "USD"
  }
}

LedgerEntryKind

topup_credit: a Reseller top-up was credited. admin_credit, admin_debit: an entry made by the OniCode team. forfeit: the balance was given up when the account was deleted. order_charge: a number was bought. order_refund: an order's price came back (cancelled, expired or failed). Clients must tolerate new values.

  • topup_credit
  • admin_credit
  • admin_debit
  • forfeit
  • order_charge
  • order_refund

LedgerEntry

FieldTypeRequiredDescription
idstring (uuid)yes
kindLedgerEntryKindyes
amountMoneyyesSigned: positive for a credit, negative for a debit.
balanceAfterMoneyyesThe balance after this entry.
topupIdstring (uuid)noThe Reseller top-up a `topup_credit` entry credited.
orderIdstring (uuid)noThe order an `order_charge` or `order_refund` belongs to.
createdAtstring (date-time)yes
{
  "id": "019a8b2c-4d5e-7f60-8a1b-2c3d4e5f6a70",
  "kind": "topup_credit",
  "amount": {
    "amountMicros": 100000000,
    "currency": "USD"
  },
  "balanceAfter": {
    "amountMicros": 125500000,
    "currency": "USD"
  },
  "topupId": "019a8b2c-4d5e-7f60-8a1b-2c3d4e5f6a71",
  "createdAt": "2026-11-16T10:00:00Z"
}

LedgerEntryPage

FieldTypeRequiredDescription
itemsarray of LedgerEntryyes
nextCursorstringnoAbsent on the last page.
{
  "items": [
    {
      "id": "019a8b30-1a2b-7c3d-8e4f-5a6b7c8d9e01",
      "kind": "order_charge",
      "amount": {
        "amountMicros": -5898000,
        "currency": "USD"
      },
      "balanceAfter": {
        "amountMicros": 119602000,
        "currency": "USD"
      },
      "orderId": "019a8b30-1a2b-7c3d-8e4f-5a6b7c8d9e00",
      "createdAt": "2026-11-16T10:05:00Z"
    },
    {
      "id": "019a8b2c-4d5e-7f60-8a1b-2c3d4e5f6a70",
      "kind": "topup_credit",
      "amount": {
        "amountMicros": 100000000,
        "currency": "USD"
      },
      "balanceAfter": {
        "amountMicros": 125500000,
        "currency": "USD"
      },
      "topupId": "019a8b2c-4d5e-7f60-8a1b-2c3d4e5f6a71",
      "createdAt": "2026-11-16T10:00:00Z"
    },
    {
      "id": "019a8a10-0b1c-7d2e-9f30-4a5b6c7d8e90",
      "kind": "admin_debit",
      "amount": {
        "amountMicros": -4500000,
        "currency": "USD"
      },
      "balanceAfter": {
        "amountMicros": 25500000,
        "currency": "USD"
      },
      "createdAt": "2026-11-15T08:30:00Z"
    }
  ],
  "nextCursor": "MDE5YThhMTAtMGIxYy03ZDJlLTlmMzAtNGE1YjZjN2Q4ZTkw"
}

PriceTier

FieldTypeRequiredDescription
priceMoneyyesThe Reseller's price for a number of this tier, in USD. Send it as `createOrder`'s `price`.
stockinteger (int64)yesNumbers at this price or cheaper.
{
  "price": {
    "amountMicros": 5898000,
    "currency": "USD"
  },
  "stock": 920
}

CountryPrices

FieldTypeRequiredDescription
countryIdstringyes
priceMoneyyesThe cheapest tier's price.
stockinteger (int64)yesNumbers at any price.
tiersarray of PriceTieryesCheapest first. A higher tier reaches more expensive numbers when the cheap ones are gone.
{
  "countryId": "ID",
  "price": {
    "amountMicros": 5898000,
    "currency": "USD"
  },
  "stock": 1350,
  "tiers": [
    {
      "price": {
        "amountMicros": 5898000,
        "currency": "USD"
      },
      "stock": 920
    },
    {
      "price": {
        "amountMicros": 7425000,
        "currency": "USD"
      },
      "stock": 1350
    }
  ]
}

PriceList

The website's price tiers for one service, per country, each at the Reseller's own price in USD. From the offer cache, so about a minute old. Buy a tier by sending its price to createOrder.

FieldTypeRequiredDescription
serviceIdstringyes
rentalMinutesintegeryesHow long a number waits for its code; without one it is refunded then. Rounded up to whole 5 minutes, for display: each order's `expiresAt` is authoritative.
itemsarray of CountryPricesyes
{
  "serviceId": "whatsapp",
  "rentalMinutes": 20,
  "items": [
    {
      "countryId": "ID",
      "price": {
        "amountMicros": 5898000,
        "currency": "USD"
      },
      "stock": 1350,
      "tiers": [
        {
          "price": {
            "amountMicros": 5898000,
            "currency": "USD"
          },
          "stock": 920
        },
        {
          "price": {
            "amountMicros": 7425000,
            "currency": "USD"
          },
          "stock": 1350
        }
      ]
    }
  ]
}

CreateOrderRequest

FieldTypeRequiredDescription
serviceIdstringyes
countryIdstringyes
priceMoneyyesA tier's `price` from `listPrices`. USD only: another currency, or an amount of 0 or less, is `validation_failed`. Charged exactly that, never more.
customerRefstringnoYour own ID for the end customer, opaque, returned as sent: 1 to 64 printable ASCII characters, no spaces.
{
  "serviceId": "whatsapp",
  "countryId": "ID",
  "price": {
    "amountMicros": 5898000,
    "currency": "USD"
  },
  "customerRef": "tg-58210443"
}

OrderStatus

pending: being bought. waiting_sms: the number is assigned and waits for its code. completed: a code arrived. cancelled, expired (no code before expiresAt) and failed (no number was bought) are refunded in full. Clients must tolerate unknown values.

  • pending
  • waiting_sms
  • completed
  • cancelled
  • expired
  • failed

OrderMessage

FieldTypeRequiredDescription
codestringno
textstringyes
receivedAtstring (date-time)yes
{
  "code": "739106",
  "text": "Your WhatsApp code: 739-106",
  "receivedAt": "2026-11-16T10:06:12Z"
}

Order

FieldTypeRequiredDescription
idstring (uuid)yes
statusOrderStatusyes
serviceIdstringyes
countryIdstringyes
phoneNumberstringnoE.164, present from `waiting_sms` on.
priceMoneyyesWhat the order was charged, in USD.
refundedMoneyyesWhat came back to the Reseller wallet: 0, or the whole price (cancelled, expired or failed).
codestringnoThe latest code received.
messagesarray of OrderMessageyes
customerRefstringnoThe order's `customerRef`, as sent.
createdAtstring (date-time)yes
expiresAtstring (date-time)noWhen the rental ends: a waiting number without a code is refunded then.
cancelAvailableAtstring (date-time)noFrom then on the order can be cancelled (`cancelOrder`), until a code arrives.
closedAtstring (date-time)noWhen the order reached a final status.
{
  "id": "019a8b30-1a2b-7c3d-8e4f-5a6b7c8d9e00",
  "status": "waiting_sms",
  "serviceId": "whatsapp",
  "countryId": "ID",
  "phoneNumber": "+6281234567890",
  "price": {
    "amountMicros": 5898000,
    "currency": "USD"
  },
  "refunded": {
    "amountMicros": 0,
    "currency": "USD"
  },
  "messages": [],
  "customerRef": "tg-58210443",
  "createdAt": "2026-11-16T10:05:00Z",
  "expiresAt": "2026-11-16T10:24:00Z",
  "cancelAvailableAt": "2026-11-16T10:10:00Z"
}

OrderPage

FieldTypeRequiredDescription
itemsarray of Orderyes
nextCursorstringnoAbsent on the last page.
{
  "items": [
    {
      "id": "019a8b30-1a2b-7c3d-8e4f-5a6b7c8d9e00",
      "status": "completed",
      "serviceId": "whatsapp",
      "countryId": "ID",
      "phoneNumber": "+6281234567890",
      "price": {
        "amountMicros": 5898000,
        "currency": "USD"
      },
      "refunded": {
        "amountMicros": 0,
        "currency": "USD"
      },
      "code": "739106",
      "messages": [
        {
          "code": "739106",
          "text": "Your WhatsApp code: 739-106",
          "receivedAt": "2026-11-16T10:06:12Z"
        }
      ],
      "customerRef": "tg-58210443",
      "createdAt": "2026-11-16T10:05:00Z",
      "expiresAt": "2026-11-16T10:24:00Z",
      "cancelAvailableAt": "2026-11-16T10:10:00Z",
      "closedAt": "2026-11-16T10:06:12Z"
    }
  ],
  "nextCursor": "MDE5YThiMzAtMWEyYi03YzNkLThlNGYtNWE2YjdjOGQ5ZTAw"
}

ActiveOrders

Numbers waiting for a code, and ones completed in the last rental.

FieldTypeRequiredDescription
itemsarray of Orderyes
serverTimestring (date-time)yesThe server's time now, for countdowns to `expiresAt` and `cancelAvailableAt`.
nextCursorstringnoAbsent on the last page.
{
  "items": [
    {
      "id": "019a8b30-1a2b-7c3d-8e4f-5a6b7c8d9e00",
      "status": "waiting_sms",
      "serviceId": "whatsapp",
      "countryId": "ID",
      "phoneNumber": "+6281234567890",
      "price": {
        "amountMicros": 5898000,
        "currency": "USD"
      },
      "refunded": {
        "amountMicros": 0,
        "currency": "USD"
      },
      "messages": [],
      "createdAt": "2026-11-16T10:05:00Z",
      "expiresAt": "2026-11-16T10:24:00Z",
      "cancelAvailableAt": "2026-11-16T10:10:00Z"
    }
  ],
  "serverTime": "2026-11-16T10:07:30Z"
}

LevelStep

One level of the levels table.

FieldTypeRequiredDescription
levelintegeryesThe level, from 1.
thresholdMoneyyesThe top-ups credited in a UTC week that reach this level the next week, in USD. Reached at exactly this amount.
discountPercentintegeryesUp to this much off our margin at this level.
{
  "level": 1,
  "threshold": {
    "amountMicros": 500000000,
    "currency": "USD"
  },
  "discountPercent": 10
}

Level

The Reseller's level this UTC week. The top-ups credited in the previous week set it, and it holds from weekStart to weekEnd. Its discount comes off our margin only, never off the provider's cost, which is why it is "up to"; every price the API returns already includes it.

FieldTypeRequiredDescription
levelintegeryesThe level this week. 0: none (no discount).
discountPercentintegeryesUp to this much off our margin; your prices already include it. 0 at level 0.
pinnedbooleanyesThe level was set by the OniCode team. It holds every week, whatever the top-ups, until the team unpins it.
weekStartstring (date-time)yesThis week's start: Monday 00:00 UTC.
weekEndstring (date-time)yesThis week's end: the next Monday 00:00 UTC.
thisWeekTopupsMoneyyesThe top-ups credited since `weekStart`, in USD. They set next week's level.
nextWeekLevelintegeryesThe level `thisWeekTopups` give next week so far. 0: none. While `pinned`, the pinned level holds instead.
levelsarray of LevelStepyesThe levels table, lowest first. Empty: no levels yet, so no discount.
{
  "level": 1,
  "discountPercent": 10,
  "pinned": false,
  "weekStart": "2026-11-16T00:00:00Z",
  "weekEnd": "2026-11-23T00:00:00Z",
  "thisWeekTopups": {
    "amountMicros": 1200000000,
    "currency": "USD"
  },
  "nextWeekLevel": 2,
  "levels": [
    {
      "level": 1,
      "threshold": {
        "amountMicros": 500000000,
        "currency": "USD"
      },
      "discountPercent": 10
    },
    {
      "level": 2,
      "threshold": {
        "amountMicros": 1000000000,
        "currency": "USD"
      },
      "discountPercent": 15
    },
    {
      "level": 3,
      "threshold": {
        "amountMicros": 2500000000,
        "currency": "USD"
      },
      "discountPercent": 25
    },
    {
      "level": 4,
      "threshold": {
        "amountMicros": 5000000000,
        "currency": "USD"
      },
      "discountPercent": 40
    },
    {
      "level": 5,
      "threshold": {
        "amountMicros": 10000000000,
        "currency": "USD"
      },
      "discountPercent": 60
    }
  ]
}

PairBlock

A service in a country the Reseller can't buy until until.

FieldTypeRequiredDescription
serviceIdstringyes
countryIdstringyes
untilstring (date-time)yesWhen the block ends.
{
  "serviceId": "whatsapp",
  "countryId": "ID",
  "until": "2026-11-16T10:35:00Z"
}

Limits

The Reseller's limits and the blocks in force now. Every number in these rules is a setting of ours, with today's value in brackets, and may change; the fields here always carry the current ones.

  • Request rate: at most requestsPerSecond requests a second (50). Past it, every request gets 429 rate_limited. A key used from one client address is then blocked for a set length (10 seconds) that no request lengthens; the rate across all the Reseller's addresses answers 429 without a block. Buys and cancels have their own limits a second (10 each), with no block.
  • Numbers waiting at once: at most maxWaitingNumbers numbers (100) are being bought or wait for a code at once; a buy past it is reseller_concurrency_limit.
  • Service-and-country block: each time one of your numbers is cancelled or expires without a code (not when the OniCode team cancels it), its service in its country is checked. The check counts the numbers there that ended (completed, cancelled or expired; not ones the OniCode team cancelled) and were bought within a set window (the last 24 hours), or since that pair's last block ended or was lifted when that is later. With at least a set number of them (100) and under a set share of them with a code (6%), the pair is blocked for a set time (30 minutes): buying it is reseller_pair_blocked, and it is listed in pairBlocks. Numbers still waiting don't count.
  • Account block: when a pair block starts and a set number of pairs (5) are blocked at once, every purchase is blocked for a set time (30 minutes): buying is reseller_account_blocked, and accountBlockedUntil is present.
  • Remove limits (removeLimits) lifts every block in force, removalsPerDay times a UTC day (5). The request rate and the numbers waiting at once can't be lifted.
FieldTypeRequiredDescription
requestsPerSecondintegeryesRequests a second the key may make from one client address, and the Reseller in all; past it, `rate_limited` (a block follows per key and address).
maxWaitingNumbersintegeryesThe most numbers that may be bought or wait for a code at once.
waitingNumbersintegeryesThe numbers being bought or waiting for a code now.
accountBlockedUntilstring (date-time)noPresent while every purchase is blocked: when the block ends.
pairBlocksarray of PairBlockyesThe services in countries blocked now.
removalsPerDayintegeryesHow many times a UTC day `removeLimits` can lift the blocks. 0: never.
removalsUsedTodayintegeryesRemovals used this UTC day.
removalsResetAtstring (date-time)yesThe next 00:00 UTC, when `removalsUsedToday` starts again from 0.
{
  "requestsPerSecond": 50,
  "maxWaitingNumbers": 100,
  "waitingNumbers": 12,
  "pairBlocks": [
    {
      "serviceId": "whatsapp",
      "countryId": "ID",
      "until": "2026-11-16T10:35:00Z"
    }
  ],
  "removalsPerDay": 5,
  "removalsUsedToday": 1,
  "removalsResetAt": "2026-11-17T00:00:00Z"
}

OrderSmsReceivedEvent

FieldTypeRequiredDescription
type"order.sms_received"yes
timestampstring (date-time)yesWhen the message was received.
dataobjectyes
data.orderIdstring (uuid)yes
data.customerRefstringnoYour reference for the order; absent when none.
data.serviceIdstringyes
data.countryIdstringyes
data.statusstringyesThe order's status now.
data.messageobjectyes
data.message.codestringnoThe verification code; absent when none.
data.message.textstringyes
data.message.receivedAtstring (date-time)yes

OrderClosedEvent

FieldTypeRequiredDescription
type"order.closed"yes
timestampstring (date-time)yesWhen the order closed.
dataobjectyes
data.orderIdstring (uuid)yes
data.customerRefstringnoYour reference for the order; absent when none.
data.serviceIdstringyes
data.countryIdstringyes
data.statusone of: completed, cancelled, expired, failedyes
data.refundedobjectyes0 for completed; the whole price otherwise.
data.refunded.amountMicrosinteger (int64)yes1e-6 of a US dollar.
data.refunded.currencystringyes
data.closedAtstring (date-time)yes

WebhookTestEvent

FieldTypeRequiredDescription
type"webhook.test"yes
timestampstring (date-time)yesWhen it was sent.
dataobjectyes