Reseller API
JSON API for resellers: wallet, products, buy and renew numbers, SMS, and webhooks. Get a token from Developers and call the API. No browser login.
Base URL
https://sim.lastsim.co/api/v1/reseller
Format
JSON requests and responses over HTTPS
Want to skip reading? Import the Postman collection, set token, and run the requests.
Quickstart
From a token to a purchased number:
- Get a token from Developers (sandbox is the default).
- GET /me — confirm the token works and check your wallet balance.
- POST /sandbox/wallet/topup if you're on a sandbox token (otherwise skip).
- POST /numbers/quote — get a price quote first.
- POST /numbers/purchase — buy it. Your wallet is debited automatically.
Try it all with a sandbox token first. Nothing real gets charged. The Postman collection covers the same calls.
Authentication
Every request needs a bearer token. Open Developers, create a key (sandbox is the default). No approval step. You can hold several live and sandbox tokens at once and revoke them individually to rotate. Each token has abilities. Give read-only integrations a read-only token.
curl https://sim.lastsim.co/api/v1/reseller/wallet/balance \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
Abilities
| Ability | Grants access to |
|---|---|
wallet:read | Wallet balance, transactions, transfer history, sandbox top-up |
wallet:transfer | Transfer balance to another user. Separate from wallet:read — moving money is a higher-risk action than reading a balance. |
numbers:read | Order status, list numbers |
numbers:purchase | Purchase and renew numbers |
sms:read | List SMS, sandbox SMS simulation |
sms:send | Send an outbound SMS (separate from sms:read, since sending spends your wallet and reading does not) |
webhook:manage | Register/rotate/unregister webhook, test, view and resend deliveries |
clients:read | List clients and their numbers |
clients:write | Create a client. Separate from clients:read — creating a client gives someone a real LastSim login. |
IP allowlist (optional)
From your reseller dashboard you can restrict your account to up to 5 entries — exact IPv4/IPv6
addresses or CIDR ranges (e.g. 203.0.113.0/24).
Leave it empty to allow any IP. Useful when your server has no fixed egress IP.
Request correlation
Every response includes an X-Request-ID
header (UUID). Include it when contacting support so we can find the matching server audit log.
Live vs. sandbox
Live and sandbox use the same base URL. The token decides which one you hit. Issue Live or Sandbox keys from Developers, as many per environment as you like. Each token is bound to one environment.
Live token
- Real wallet balance, real debits
- Real Virtual Numbers / Estonia numbers
- Real, billable SMS
Sandbox token
- Fake wallet balance you top up for free, with no payment gateway
- Fake numbers in the same format as real ones, with no external carrier calls
- Fake SMS you trigger yourself. Nothing goes out to a real phone.
The catalog (GET /products) and
its pricing are identical in both environments. Sandbox only fakes money and carriers.
Webhooks, idempotency, and rate limits behave like live.
Two endpoints exist only for sandbox tokens, because they have no live
equivalent: topping up
your fake balance and simulating
an inbound SMS. Calling either with a live token returns 422 sandbox_only.
See the full sandbox walkthrough below.
Client accounts differ in two ways. See POST /clients.
Premium numbers are the one catalog sandbox fakes, because each one is a single real number we own. Sandbox sells a short fixed list from ranges reserved for fiction, and the hand-over takes about a minute instead of hours.
Round numbers are faked the same way: a short fixed list in four countries (US, CA, GB, EE) that follows the live rules, including registration_required (Estonia). Sandbox never contacts our number supplier.
Idempotency
Six endpoints require an Idempotency-Key
header:
POST /numbers/purchase,
POST /numbers/{id}/renew,
POST /numbers/renew,
POST /sms,
POST /clients, and
POST /wallet/transfer.
Pick any unique string. A UUID is fine. Retry after a timeout with the
same key and body and you get the original result back, not a second charge
(for purchase, that's the order's current state). Reuse a key with a different
body and it's a conflict:
409 idempotency_key_reused. Keys
live for 24 hours. Failed calls aren't cached. Top up your wallet and retry with the same key.
Two other 409s can come back on
the same key. idempotency_in_progress
means an earlier request with that key is still running; wait a moment, then retry the same key
and body. idempotency_indeterminate
means the first attempt may have succeeded or failed. We can't tell. Don't
retry that one automatically. Poll the order status (for purchase), ask GET /sms/status (for POST /sms), or contact support.
Purchase, renew, and send SMS share one wallet lock per account. Parallel money calls wait in line. You won't overdraft.
Who owns the number?
Two options: the number stays on your account, or you put it on a client account. This is LastSim ownership, not your CRM. You keep your own customer/order records either way.
Terminology
| Term | Meaning |
|---|---|
| Reseller | Your account. The one making API calls. |
| Customer | The person using your product. With metadata, they never need to know LastSim exists. |
| Client | A real LastSim account you create for a customer via POST /clients. Not the same thing as a row in your own customers table. |
| Number owner | Whichever LastSim account the number sits on — yours, or a client's. |
| Metadata | Your own tag on a number. It doesn't change who owns it. |
- Building a white-label product? Your customer should never see LastSim. Tag numbers with metadata and keep the number on your own account.
- Selling to people who should hold their own number and sign in themselves? Create a client and buy the number for them.
Tag with metadata
Customer
│
▼
Your app + database (customer_id, order_id)
│
▼
Your LastSim account
│
▼
Phone number ← metadata: {"customer_id": "422"}
Create a client
Customer
│
▼
LastSim client account (POST /clients)
│
▼
Phone number
| Tag numbers with metadata | Create a client | |
|---|---|---|
| Who owns the number | Your account | The client account you created for them |
| Where their record lives | Your database | A real LastSim account |
| Can they sign in to LastSim | No | Yes, with Telegram or Google |
| Brand they see | Yours only | LastSim |
| Who pays | You | You — your wallet is debited either way |
| Incoming SMS & webhooks | Delivered to your API (GET /sms, webhook) | Not delivered — the client owns the number |
| Who they contact for support | You | You or LastSim |
| If you stop reselling | They depend on you | Their number and account keep working |
| Setup needed | None | One-time activation: $200 lifetime wallet top-up, done once per reseller account |
| Best for | White-label products | Customers who should hold and access their own number |
These aren't exclusive. The only thing that decides ownership is client_id on a purchase call:
- Omit client_id → the number belongs to your own account.
- Provide client_id → the number belongs to that client account.
- Metadata is just your tag. It doesn't change ownership. You can set metadata and client_id on the same purchase if you need both.
In practice
1. White-label SIM app
You sell under your brand. Buy the number on your own account and tag it with your customer_id. You handle support and billing.
2. Marketplace where the customer should hold the account
You sell a number once and don't want ongoing support for it. Create a client and buy the number with client_id set. If you stop reselling, the customer keeps their number and can use LastSim directly.
3. Client owns the number; you still track orders in metadata
You create clients so customers can sign in directly, but you still reconcile against your own order system. Send both client_id and metadata on the same purchase call. client_id decides who owns the number; metadata keeps your internal records.
- Metadata is a label, not an owner. Setting it never moves a number into anyone else's account.
- You don't need a client for every customer. Most integrations only need metadata. Clients are for when the end user should log into LastSim.
- A client account isn't the same thing as a row in your own customers table. You keep your own customer/order records regardless of which model you use.
- Ownership is set once, at purchase time, via client_id. There's no endpoint to move an existing number onto a client afterward, or back to your own account.
- Client-owned numbers don't show up in GET /numbers — that endpoint only lists your own. Use GET /clients/{id}/numbers instead. POST /numbers/{id}/renew works for both your own numbers and a client's, by id. Their inbound SMS won't appear in GET /sms or hit your webhook either.
Metadata
Optional key/value tag on a number or order, for example
{"customer_id": "422"}
to track which of your customers a number belongs to. Opaque to LastSim — for your own
records. Send an optional metadata
object on purchase or
renew, or set it independently
any time with PUT /numbers/{id}/metadata.
- Up to 50 keys, key names ≤40 characters, string values ≤500 characters.
- Setting metadata replaces the whole object; it isn't merged with what was there before.
- Omitting metadata on a renew call leaves the number's existing tag untouched.
- Look numbers up by tag with GET /numbers?metadata_key=customer_id&metadata_value=422, so you can find numbers by your own IDs without maintaining a separate map.
- For a Virtual Number purchase the number doesn't exist yet at purchase time, so your metadata is stored on the order immediately and copied onto the number the first time you poll its order status after it's assigned.
- Tags are yours, not your customer's. If the person should own the number and sign in themselves, see clients.
Rate limiting
Limits apply per token, not per IP. Go over your limit and
you get 429 rate_limited. Every
response carries X-RateLimit-Limit
and X-RateLimit-Remaining; a 429
adds Retry-After (seconds to wait),
mirrored in the body as details.retry_after.
Money calls on one account also share a wallet lock (see
Idempotency).
The round-number reads (areas, numbers,
lookup, quote) also count against a separate budget of 20 a minute per token, because each can reach our
number inventory. Going over it is the same 429.
Purchases don't count against it.
Errors
All errors use the same JSON shape. That includes 404, 405, and 500:
{
"error": {
"code": "insufficient_balance",
"message": "Wallet balance is insufficient for this purchase.",
"details": { "required": 9.00, "available": 5.00, "currency": "USD" }
}
}
| HTTP | code | When |
|---|---|---|
| 401 | unauthenticated | Missing or invalid bearer token |
| 403 | suspended | Reseller account missing or suspended |
| 403 | ip_denied | Client IP is not on the account allowlist (exact IP or CIDR) |
| 403 | forbidden | Token lacks the required ability |
| 402 | insufficient_balance | Wallet balance can't cover this purchase/renewal |
| 404 | idempotency_key_not_found | SMS status lookup: no send is on record for this key, so nothing was sent or charged |
| 404 | not_found / number_not_found / sms_not_found | Unknown order, number, or message id (or not owned by you), or an unknown route/URL |
| 405 | method_not_allowed | Wrong HTTP method for this path (e.g. GET on a POST-only endpoint) |
| 409 | idempotency_key_reused | Same key, different request body |
| 409 | idempotency_in_progress | Same key, request still in progress. Wait, then retry. |
| 409 | idempotency_indeterminate | A previous attempt with this key may have crashed mid-flight — don't auto-retry, check order status or contact support |
| 422 | validation_failed | Missing/invalid request parameter |
| 422 | invalid_product / invalid_duration / invalid_quantity | Purchase parameters don't match the catalog; also invalid_duration on renew when the requested months isn't one the number offers (details.allowed_months), and on a premium quote or purchase outside 1 to 60 months (details.min_months, details.max_months) |
| 422 | purchase_failed | Unexpected error completing the order — details.order_id is included so you can reference it with support |
| 422 | number_expired | Expired Virtual Number, not renewable via the API |
| 422 | not_eligible | Wrong number type for the requested renewal, not operator-approved, or the number has no renewal price on file (open a support ticket) |
| 422 | sandbox_not_supported / sandbox_only | Endpoint/feature not available for this token's environment |
| 422 | invalid_webhook_url | Non-HTTPS or SSRF-unsafe URL |
| 422 | webhook_verification_failed | Verification ping didn't get a 2xx |
| 422 | webhook_not_configured | No verified webhook to test/rotate against |
| 422 | invalid_delivery_state | Webhook resend called on a delivery that isn't currently exhausted |
| 422 | idempotency_key_required | Missing the required Idempotency-Key header |
| 422 | invalid_number_type | Number isn't a Virtual Number or SMS Panel type for this action |
| 422 | invalid_destination / no_rate / source_not_eligible / sms_package_required / sms_package_expired | SMS send: bad destination, no rate for it, or the source number can't send. The two sms_package codes mean an Estonia number needs its SMS sending package activated or renewed first |
| 403 | client_accounts_not_activated | Clients haven't been activated for this account, in either environment. details shows how much of the deposit requirement is still outstanding |
| 404 | client_not_found | Unknown client id, or one that belongs to another account |
| 404 / 409 | number_unavailable | Premium number not for sale (sold, or never listed): 404 on lookup and quote, 409 on purchase |
| 404 / 409 | number_unavailable | Round number not for sale (sold, or never listed): 404 on lookup and quote, 409 on purchase |
| 404 | area_not_found | The area_id of a random round-number quote or purchase is not an area we know |
| 422 | country_not_available | Round numbers are not sold in that country |
| 422 | registration_required | The number's area needs identity or address registration, which can't be done through the API. Nothing was reserved or charged |
| 409 | price_changed | The price is now above your max_total. details.total_price has the new total. Nothing was charged |
| 503 | catalog_unavailable | The round-number inventory can't be read right now. Retry after details.retry_after seconds (also the Retry-After header). This is not "the number doesn't exist", and nothing was charged |
| 422 | client_contact_required | Neither mobile nor email was given |
| 422 | client_contact_taken | That mobile or email already belongs to a LastSim account |
| 422 | invalid_client_email | Client email must be a Gmail address (Google sign-in is the only door in for that channel) |
| 429 | client_creation_limit_reached | Daily client-creation cap hit — details.limit has the number |
| 502 | gateway_failed | SMS send: the carrier gateway rejected the send |
| 429 | rate_limited | Per-token throttle exceeded — see Retry-After / details.retry_after |
| 500 | internal_error | Server blew up. Retry idempotent calls with the same key. |
Account
GET /me
Returns your token's environment, abilities, client activation gate, and webhook status. Works with any active reseller token; no specific ability is required.
{
"company_name": "Acme Resellers Ltd",
"status": "active",
"environment": "live",
"rate_limit_tier": "standard",
"rate_limit_per_minute": 60,
"allowed_ips": [],
"token": { "name": "prod-server-1", "abilities": ["wallet:read", "numbers:read", "numbers:purchase", "sms:read"], "last_used_at": "2025-11-04T09:12:00+00:00" },
"webhook": { "url": "https://reseller.example.com/lastsim-webhook", "is_active": true, "is_verified": true },
"clients": {
"is_activated": false,
"activation": { "deposited": 120.00, "required": 200.00, "remaining": 80.00, "currency": "USD" }
}
}
Read clients before calling any client endpoint. is_activated is false until the one-time activation is done on the website, and activation shows what's still outstanding — same value on both your tokens.
Wallet
GET /wallet/balance
Current wallet balance. Ability: wallet:read.
{
"balance": 342.30,
"currency": "USD"
}
GET /wallet/transactions
Same filter conditions as the web wallet history page. Ability: wallet:read. Sandbox writes a real row for every top-up, purchase, and renewal. Filter with since and type like live. A fresh sandbox account has never bought or renewed anything, so its list starts empty.
| Query param | Description |
|---|---|
| since | Only transactions on/after this date |
| type | Live: charge, purchase, refund, transfer_in, transfer_out, referral_profit, create_voucher_code, cashback, cashback_reversal. Sandbox only ever produces charge, purchase, or renewal — the three things a sandbox account can actually do. |
| page / per_page | Pagination (default per_page: 20) |
{
"data": [
{ "id": 9931, "type": "purchase", "amount": -12.00, "description": "Purchase: Product #1",
"remaining": 330.30, "created_at": "2025-11-04T10:02:11+00:00" }
],
"meta": { "current_page": 1, "per_page": 20, "total": 1, "total_pages": 1 }
}
POST /wallet/transfer
Transfer balance from your wallet to another LastSim user, identified by their registered email or phone number. Minimum transfer: $1.00. Ability: wallet:transfer. Requires an Idempotency-Key header — re-sending the same key replays the original result without debiting again. Live only — sandbox returns 422 sandbox_not_supported.
| Field | Type | Description |
|---|---|---|
| recipient | string | The recipient's registered email or phone number (international format, e.g. +37255012345) |
| amount | number | Amount to transfer in USD. Minimum $1.00. |
curl -X POST https://sim.lastsim.co/api/v1/reseller/wallet/transfer \
-H "Authorization: Bearer ls_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: tr-abc123" \
-d '{ "recipient": "[email protected]", "amount": 10.00 }'
{
"sender_transaction_id": 9120,
"recipient_transaction_id": 9121,
"amount": 10.00,
"currency": "USD",
"wallet_balance_after": 132.50,
"recipient": {
"id": 4401,
"display_name": "Jane Smith"
}
}
| Error code | Status | Meaning |
|---|---|---|
| recipient_not_found | 422 | No LastSim account found for the given email or phone number |
| self_transfer | 422 | The recipient is the same account as the sender |
| insufficient_balance | 402 | Not enough balance. Details include required, available, and currency |
| sandbox_not_supported | 422 | Sandbox tokens cannot initiate transfers |
GET /wallet/transfers
Your wallet transfer history — both transfers you sent (type: transfer_out) and transfers you received (type: transfer_in), newest first. Ability: wallet:read. Live only — sandbox returns 422 sandbox_not_supported.
| Query param | Description |
|---|---|
| page / per_page | Pagination (default per_page: 20) |
{
"data": [
{ "id": 9120, "type": "transfer_out", "amount": -10.00, "currency": "USD",
"description": "Transfer to Jane Smith", "remaining": 132.50,
"created_at": "2026-08-30T10:00:00+00:00" },
{ "id": 9050, "type": "transfer_in", "amount": 25.00, "currency": "USD",
"description": "Transfer from John Doe", "remaining": 142.50,
"created_at": "2026-08-28T15:30:00+00:00" }
],
"meta": { "current_page": 1, "per_page": 20, "total": 2, "total_pages": 1 }
}
Products
GET /products
Country list with pricing labels, the same data as the public /buy page. No specific ability required. This data is not faked in sandbox.
{
"countries": [
{ "slug": "united-states", "name": "United States", "code": "US",
"price_label": "from $5.00/mo", "price_sublabel": "3 months · $9.00 total" },
{ "slug": "estonia", "name": "Estonia", "code": "EE",
"price_label": "from $12.00", "price_sublabel": "3 months total" }
]
}
GET /products/{country}
Purchasable products for one country (by slug), with the same fields the web checkout uses: prefix, capabilities, durations, quantity limits, activation default. A country can have more than one product (one per prefix), and the capabilities keys differ by country — Estonia exposes its SMS-panel set (sms_in, call_forwarding, voicemail); other countries expose the send/receive and voice set. Send one of the listed months as duration_months; any other value is refused with invalid_duration.
One-month purchases: standard products in every listed country now offer duration_months: 1. For non-Estonia products, the initial one-month package is 80% of the initial three-month total, rounded per number before multiplying by quantity, with a floor of setup plus one standard month for unusually high setup fees. Setup is included in the quoted total. Estonia retains its existing prices. Read the current durations and use purchase quote for the exact quantity; do not calculate a one-month price by dividing the three-month total by three.
price_per_month is the average initial purchase price (total_price / months), including setup. It is not the recurring renewal rate. Purchase and renewal durations are separate: manual Virtual Number renewals still start at three months; read the owned number's renewal object and request a renewal quote.
Example: Estonia (one SMS Panel product)
{
"country": "Estonia",
"country_slug": "estonia",
"products": [
{
"product_id": 1,
"prefix": "372",
"type": "estonia",
"capabilities": { "sms_in": true, "call_forwarding": true, "voicemail": true },
"durations": [
{ "months": 1, "price_per_month": 9.9, "total_price": 9.9 },
{ "months": 3, "price_per_month": 4, "total_price": 12 },
{ "months": 6, "price_per_month": 3, "total_price": 18 },
{ "months": 12, "price_per_month": 2.5, "total_price": 30 },
{ "months": 24, "price_per_month": 2.04, "total_price": 49 },
{ "months": 36, "price_per_month": 1.86, "total_price": 67 },
{ "months": 48, "price_per_month": 1.75, "total_price": 84 },
{ "months": 60, "price_per_month": 1.67, "total_price": 100 }
],
"quantity_limits": { "min": 1, "max": 100 },
"activate_now_default": true,
"activation_note": "Your paid period starts when the number activates, not at payment."
}
]
}
Example: Canada (two DID products, one per prefix)
{
"country": "Canada",
"country_slug": "canada",
"products": [
{
"product_id": 116,
"prefix": "647",
"type": "mobile",
"capabilities": { "sms_in": true, "voice_in": true, "sms_out": true, "voice_out": true },
"durations": [
{ "months": 1, "price_per_month": 9.6, "total_price": 9.6 },
{ "months": 3, "price_per_month": 4, "total_price": 12 },
{ "months": 6, "price_per_month": 3.5, "total_price": 21 },
{ "months": 9, "price_per_month": 3.33, "total_price": 30 },
{ "months": 12, "price_per_month": 3.25, "total_price": 39 }
],
"quantity_limits": { "min": 1, "max": 100 },
"activate_now_default": true,
"activation_note": "Your paid period starts when the number activates, not at payment."
},
{
"product_id": 115,
"prefix": "778",
"type": "mobile",
"capabilities": { "sms_in": true, "voice_in": true, "sms_out": true, "voice_out": true },
"durations": [
{ "months": 1, "price_per_month": 9.6, "total_price": 9.6 },
{ "months": 3, "price_per_month": 4, "total_price": 12 },
{ "months": 6, "price_per_month": 3.5, "total_price": 21 },
{ "months": 9, "price_per_month": 3.33, "total_price": 30 },
{ "months": 12, "price_per_month": 3.25, "total_price": 39 }
],
"quantity_limits": { "min": 1, "max": 100 },
"activate_now_default": true,
"activation_note": "Your paid period starts when the number activates, not at payment."
}
]
}
Numbers
POST /numbers/quote
Preview the total a purchase would charge — no order, no charge. Same formula the purchase endpoint uses, so they can't drift apart. Ability: numbers:purchase or numbers:read.
curl -X POST https://sim.lastsim.co/api/v1/reseller/numbers/quote \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "product_id": 1, "duration_months": 3, "quantity": 10 }'
{
"product_id": 1, "duration_months": 3, "quantity": 10,
"total_price": 120.00, "currency": "USD"
}
Example: one-month UK purchase quote
POST /numbers/quote
{ "product_id": 112, "duration_months": 1, "quantity": 1 }
200 OK
{ "product_id": 112, "duration_months": 1, "quantity": 1, "total_price": 13.44, "currency": "USD" }
POST /numbers/purchase
Purchase a number; your wallet is debited automatically. Ability: numbers:purchase. Requires an Idempotency-Key header (see above).
One-month purchases use duration_months: 1 and the same price returned by POST /numbers/quote. For example, the UK standard product 112 currently costs $13.44 for one month, including setup, versus $16.80 for three months. Manual renewal still starts at three months; a one-month purchase does not change the renewal rules.
status: "processing" and an empty
numbers array. Poll
order status until
provisioned. With activate_now: true, every purchased number must be assigned and activated first. Partial delivery and records awaiting activation remain processing. With activate_now: false, a successful purchase returns provisioned with an empty numbers array because activation was deferred.
Request
curl -X POST https://sim.lastsim.co/api/v1/reseller/numbers/purchase \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 8f14e45f-ceea-467e-adde-3f4ede00000a" \
-d '{
"product_id": 1,
"duration_months": 3,
"quantity": 1,
"activate_now": true,
"metadata": { "customer_id": "422" }
}'
Response: Estonia (synchronous)
{
"id": 9,
"kind": "standard",
"client_id": null,
"status": "provisioned",
"numbers": [ { "id": 278, "number": "+37255000045", "is_activated": true } ],
"metadata": { "customer_id": "422" }
}
Response: Virtual Number (asynchronous)
{
"id": 10,
"kind": "standard",
"client_id": null,
"status": "processing",
"numbers": [],
"processing_started_at": "2025-11-04T10:02:11+00:00",
"metadata": { "customer_id": "422" }
}
See Metadata above. For Virtual Number purchases the number itself doesn't exist yet, so your tag lands on it the first time you poll order status after it's assigned.
Buying for a client
Add client_id and the number is
owned by that client instead
of you. Your wallet still pays, and the response echoes the
client_id back. Same pricing, idempotency, and sync/async
behavior as above. Works in sandbox too, against a sandbox client.
{
"product_id": 1,
"duration_months": 3,
"quantity": 1,
"activate_now": true,
"client_id": 41
}
A number owned by a client won't appear in GET /numbers, which lists numbers on your own account. Read it from GET /clients/{id}/numbers instead.
GET /numbers/purchase/{orderId}
Poll this for the result of an asynchronous purchase. Ability: numbers:read. For Virtual Number products, poll every 5–10s starting ~30–60s after purchase. The same endpoint takes a premium order id (prm_…); kind tells the two apart.
status is processing, provisioned, or failed (with failure_reason, e.g. a cancelled premium order); there is no "out of stock" state. If it stays processing well beyond a minute, the carrier most likely has no number available for that prefix. There is no automatic timeout or refund, so treat it as delayed and contact support.
{
"id": 10,
"kind": "standard",
"client_id": null,
"status": "provisioned",
"numbers": [ { "id": 291, "number": "+12135550100", "is_activated": true } ],
"metadata": { "customer_id": "422" }
}
GET /numbers/purchase
Every order you placed, including ones bought for a client, premium and round number orders. This helps if you lose an order id (e.g. your process crashed right after purchase) and need to reconcile. Ability: numbers:purchase or numbers:read. Params: page, per_page, client_id. Each row uses the same shape order status returns.
{
"data": [
{ "id": "prm_812", "kind": "premium", "client_id": null, "status": "processing", "numbers": [], "processing_started_at": "2025-11-04T11:40:00+00:00" },
{ "id": "rnd_903", "kind": "round", "client_id": null, "status": "processing", "numbers": [], "processing_started_at": "2025-11-04T11:41:00+00:00" },
{ "id": 11, "kind": "standard", "client_id": 41, "status": "provisioned", "numbers": [{ "id": 302, "number": "+37255000061", "is_activated": true }] },
{ "id": 10, "kind": "standard", "client_id": null, "status": "provisioned", "numbers": [{ "id": 291, "number": "+12135550100", "is_activated": true }] }
],
"meta": { "current_page": 1, "per_page": 20, "total": 2, "total_pages": 1 }
}
POST /numbers/{id}/renew
Renew a number you own, or one owned by a client — this works by id either way, since you already have the id from GET /numbers or GET /clients/{id}/numbers. An id that's neither returns 404 number_not_found. For a number you don't have the id for, see renew by phone number below. Ability: numbers:purchase. Requires an Idempotency-Key header (see Idempotency above). Retries and concurrent calls can't double-charge or overdraft your wallet.
months. You don't need
to know whether a number runs on an SMS Panel plan or a DID; its renewal
object lists the durations it takes.
- DID — allowed_months is null, so any whole number of months in the min_months–max_months range works (right now 3 to 60).
- SMS Panel (Estonia) — only the values in allowed_months, e.g. [1, 3, 6, 12, 36, 60]. Anything else returns
422 invalid_durationwithdetails.allowed_months.
Request
curl -X POST https://sim.lastsim.co/api/v1/reseller/numbers/278/renew \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 6c1c3e2a-2222-4b3e-9a11-0f0a0a0a0a0a" \
-d '{ "months": 3, "metadata": { "customer_id": "422" } }'
422 number_expired with a
support_ticket_url. Expired-DID recovery involves a live
carrier lookup that can delete the number on a miss, which isn't safe to trigger unattended
from an API call.
Response
{
"number_id": 278,
"number": "+12135559999",
"months": 3,
"expires_at": "2026-05-04T14:30:33+00:00",
"amount_charged": 9.00,
"currency": "USD",
"wallet_balance_after": 491.00,
"invoice_id": 335,
"metadata": { "customer_id": "422" }
}
The response echoes the months renewed. Omit metadata to leave the number's existing tag untouched; sending it fully replaces what was there. Sandbox responses return invoice_id: null since no real invoice exists.
POST /numbers/renew
Renew any number by phone number, no ownership check — even one that isn't yours or a client's. There's no id in this URL on purpose: unlike a number you own, there's no other endpoint that would ever hand you a stranger's internal id, and ids are small sequential integers, so accepting one here would turn this into a way to probe every number in the system. A phone number has to already be known to you.
Ability: numbers:purchase. Requires an Idempotency-Key header. Works for sandbox tokens too: since sandbox numbers are private to your own account, this reaches only your own, addressed by phone number instead of id. A number that isn't yours 404s like an unknown one. Sandbox responses return invoice_id: null, same as renew by id. Preview the charge first with POST /numbers/renew/quote.
Request
curl -X POST https://sim.lastsim.co/api/v1/reseller/numbers/renew \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 9f2c1e4a-3333-4b3e-9a11-1a1a1a1a1a1a" \
-d '{ "number": "+12135559999", "months": 3 }'
Response
{
"number_id": 511,
"number": "+12135559999",
"months": 3,
"expires_at": "2026-05-04T14:30:33+00:00",
"amount_charged": 9.00,
"currency": "USD",
"wallet_balance_after": 482.00,
"invoice_id": 336,
"metadata": {}
}
No metadata parameter here, and metadata in the response is always {} — a live number you reach this way may not be yours or a client's, and reseller_metadata is only ever readable back through endpoints scoped to your own numbers or clients. Sandbox stays metadata-free here too, even though the number is always your own there, so the contract is the same regardless of mode. Use PUT /numbers/{id}/metadata instead.
The charge is billed to your wallet either way, but who actually referred the number's owner — not who paid — decides commission, so paying for a stranger's renewal never routes their referring partner's earnings to you. (Sandbox has no commission concept — this only applies live.)
POST /numbers/renew/quote
Preview the renewal cost for any number you know by phone number, with no charge.
Same lookup and pricing as POST /numbers/renew.
Use this when you don't have an internal id (or shouldn't — ids aren't handed out for numbers that aren't yours).
Ability: numbers:purchase or
numbers:read.
No Idempotency-Key. Works for sandbox tokens the same way renew-by-number does: only your own sandbox numbers.
The response has no number_id. It does include the renewal object so you can constrain months without a GET on the number. SMS Panel quotes return a flat total_cost; DID quotes include the per-month breakdown.
Request
curl -X POST https://sim.lastsim.co/api/v1/reseller/numbers/renew/quote \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "number": "+12135559999", "months": 3 }'
Response (DID)
{
"number": "+12135559999",
"renewal": { "min_months": 3, "max_months": 60, "allowed_months": null },
"currency": "USD",
"months": 3,
"monthly_price": 3.00,
"base_cost": 9.00,
"penalty": 0,
"total_cost": 9.00
}
Response (SMS Panel)
{
"number": "+3725512345",
"renewal": { "min_months": 1, "max_months": 60, "allowed_months": [1, 3, 6, 12, 36, 60] },
"currency": "USD",
"months": 3,
"total_cost": 15.00
}
Same error codes as renew-by-number when the number can't be renewed:
invalid_duration (with details.allowed_months),
number_expired,
not_eligible,
number_not_found.
Sandbox DID quotes omit penalty (sandbox has no expired-DID penalty path).
POST /numbers/{id}/renew/quote
Preview the exact renewal cost, using the same body as renew (months, for every number type) and no charge. It runs the same formula the charge itself uses. Works for a client's number the same way renew itself does — same id, same rules. Ability: numbers:purchase or numbers:read. Works for sandbox tokens too. (An SMS Panel number returns a flat total_cost for the chosen duration; a DID returns the per-month breakdown shown below.) For a number you don't have an id for, use POST /numbers/renew/quote.
{ "number_id": 278, "months": 3, "monthly_price": 3.00, "base_cost": 9.00, "penalty": 0, "total_cost": 9.00, "currency": "USD" }
POST /numbers/{id}/sms-package
Buy or extend the SMS sending package for an Estonia number. Ability: numbers:purchase. Requires an Idempotency-Key header. Works by id for your own numbers and your clients'; any other id returns 404 number_not_found.
sms_package_expired until you buy it again. Buying and renewing are the same call at the same price:
1 month $2.00, 3 months $2.50, 6 months $3.00, 12 months $4.00. Time is added from the later of now and the current expiry,
so renewing early never wastes days and renewing late never charges for time already gone.
Request
curl -X POST https://sim.lastsim.co/api/v1/reseller/numbers/302/sms-package \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 6c1c3e2a-3333-4b3e-9a11-0f0a0a0a0a0a" \
-d '{ "months": 3 }'
months must be one of the number's sms_send_package.allowed_months (see GET /numbers). Anything else returns 422 invalid_duration with details.allowed_months. A number that isn't Estonia returns 422 invalid_number_type; an empty wallet returns 402 insufficient_balance. Sandbox tokens get 422 sandbox_not_supported, the same as POST /sms.
Response
{
"number_id": 302,
"number": "+37255000061",
"months": 3,
"expires_at": "2027-01-18T00:00:00+00:00",
"amount_charged": 2.50,
"currency": "USD",
"wallet_balance_after": 126.90,
"invoice_id": 5503
}
You pay from your wallet; the invoice belongs to the number's owner, same as renew for a client's number. The package does not give you access to incoming SMS; that is the SMS Panel, renewed with renew. sms_send_package.can_send on the number tells you whether it can send right now.
POST /numbers/{id}/sms-package/quote
Preview the cost and the resulting expiry of POST /numbers/{id}/sms-package with the same months body and no charge. Same ownership rules and errors. Ability: numbers:purchase or numbers:read. Live only.
{ "number_id": 302, "currency": "USD", "months": 3, "total_cost": 2.50, "expires_at_after": "2027-01-18T00:00:00+00:00" }
POST /numbers/{id}/auto-renew
Enable or disable auto-renew for a number you own. Ability: numbers:purchase. Takes an explicit boolean, so it's safe to call repeatedly with the same value. Live: available for Virtual Number (DID) and operator-approved SMS Panel numbers. Works for sandbox tokens too, with no operator-approval gate — sandbox never makes the real carrier call that approval depends on, so every sandbox number is eligible.
Unlike renew, this one is self-only in both modes — it doesn't accept a client's number id. Auto-renew keeps charging your wallet. Client numbers: set it on the dashboard, not via API.
curl -X POST https://sim.lastsim.co/api/v1/reseller/numbers/278/auto-renew \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "auto_renew": true }'
{ "number_id": 278, "auto_renew": true }
GET /numbers
Your activated numbers. Ability: numbers:read. Params: type, status (active/expired), expiring_within_days, metadata_key + metadata_value (look up numbers by your own tag; see Metadata above), page, per_page.
{
"data": [
{ "id": 278, "number": "+37257447282", "type": "physical_estonia",
"is_activated": true, "expires_at": "2026-05-04T00:00:00+00:00",
"auto_renew": false, "monthly_price": 4.00,
"renewal": { "min_months": 1, "max_months": 60, "allowed_months": [1, 3, 6, 12, 36, 60] },
"sms_send_package": { "active": true, "expires_at": "2026-12-18T00:00:00+00:00",
"allowed_months": [1, 3, 6, 12], "can_send": true, "blocked_reason": null },
"metadata": { "customer_id": "422" } }
],
"meta": { "current_page": 1, "per_page": 20, "total": 1, "total_pages": 1 }
}
For Estonia / SMS Panel numbers (physical_estonia, virtual_estonia, england_number), expires_at is the SMS panel expiry — the same date shown in your dashboard — not the underlying number record's date. The status and expiring_within_days filters use this same panel date.
The renewal object tells you how to renew this number without knowing its internal type: send any months in allowed_months when that list is present (SMS Panel numbers, like the Estonia one above), or any whole number in [min_months, max_months] when allowed_months is null (DID numbers).
sms_send_package is null for every number type except Estonia (physical_estonia, virtual_estonia), and always null in sandbox. For Estonia it shows whether the paid sending package is active, when it ends, and which durations you can buy. can_send is exactly what POST /sms will accept for this number right now; when it is false, blocked_reason is one of operator_not_approved, sms_package_required, sms_package_expired.
This endpoint means "numbers on my account," so numbers you bought for a client are not here — the client owns those. They're at GET /clients/{id}/numbers, in this same shape.
GET /numbers/{id}
A single number, without paging the full list. Same fields as one row of GET /numbers. Ability: numbers:read.
{ "id": 278, "number": "+37257447282", "type": "physical_estonia",
"is_activated": true, "expires_at": "2026-05-04T00:00:00+00:00",
"auto_renew": false, "monthly_price": 4.00,
"renewal": { "min_months": 1, "max_months": 60, "allowed_months": [1, 3, 6, 12, 36, 60] },
"sms_send_package": { "active": true, "expires_at": "2026-12-18T00:00:00+00:00",
"allowed_months": [1, 3, 6, 12], "can_send": true, "blocked_reason": null },
"metadata": { "customer_id": "422" } }
PUT /numbers/{id}/metadata
Set or replace a number's tag any time, without renewing it. For example, re-tag it, or set it for the
first time on a Virtual Number purchase that didn't include one. Ability:
numbers:purchase. This isn't a money
endpoint, so no Idempotency-Key is needed; a PUT with the same
body is naturally idempotent. Works for both live and sandbox numbers.
curl -X PUT https://sim.lastsim.co/api/v1/reseller/numbers/278/metadata \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "metadata": { "customer_id": "422", "note": "resold via my dashboard" } }'
{ "number_id": 278, "metadata": { "customer_id": "422", "note": "resold via my dashboard" } }
Send {"metadata": {}} to clear the tag entirely.
Premium numbers
Round numbers
Numbers are not paginated. A country can have tens of thousands, and the inventory does not
page. GET /round-numbers returns a sample of at most 10 that match your filters, and
meta.total_count says how many match in all. To see others, narrow with
area, search, region, type or features.
Areas are paginated. Catalog reads are limited to 20 a minute per token (more is 429) and
can answer 503 catalog_unavailable with Retry-After when the inventory is busy.
Some areas (most of Estonia, for example) need identity or address registration. They are listed with
requires_registration: true so you can tell, and can't be bought through the API.
GET /round-numbers/countries
The countries round numbers are sold in, ordered by name. Use country_iso as the country of the other round-number calls. It is a local read: it is not counted against the catalog limit. Ability: numbers:purchase or numbers:read.
> curl "https://sim.lastsim.co/api/v1/reseller/round-numbers/countries" \
-H "Authorization: Bearer YOUR_API_TOKEN"
>{
"data": [
{ "country_iso": "CA", "name": "Canada" },
{ "country_iso": "GB", "name": "United Kingdom" },
{ "country_iso": "US", "name": "United States" }
]
}
GET /round-numbers/areas
The areas a country has. Params: country (ISO code, required), region and type (names from earlier rows, exact match; an unknown name matches nothing), features (see below), page, per_page (up to 50). Ability: numbers:purchase or numbers:read.
> curl "https://sim.lastsim.co/api/v1/reseller/round-numbers/areas?country=US&per_page=20" \
-H "Authorization: Bearer YOUR_API_TOKEN"
>{
"data": [
{
"area_id": "ar_ZHpKljzUmM59WzygFgOJ-KAZrNrwTiDz", "name": "New York", "prefix": "212",
"region": "New York", "city": "New York", "type": "Local", "features": ["voice_in", "sms_in"],
"setup_price": 2.10, "monthly_price": 2.10, "currency": "USD",
"requires_registration": false, "has_numbers": true
}
],
"meta": { "current_page": 1, "per_page": 20, "total": 2193, "total_pages": 110 }
}
area_id is an opaque reference. Pass it back as area; don't parse it or store it for long. has_numbers is false when the area's numbers can't be listed one by one (it only sells a number of its choosing), so there is no number to pick there. Buy a random number from it instead: send its area_id (and no number) to quote and buy.
GET /round-numbers
Numbers for sale. Params: country (required), area (an area_id), search (digits the number contains, at least 3), region, type, features. Ability: numbers:purchase or numbers:read.
> curl "https://sim.lastsim.co/api/v1/reseller/round-numbers?country=US&search=7777" \
-H "Authorization: Bearer YOUR_API_TOKEN"
>{
"data": [
{
"number": "+12125557777", "country": "United States", "country_iso": "US",
"area": "New York", "area_id": "ar_ZHpKljzUmM59WzygFgOJ-KAZrNrwTiDz", "prefix": "212", "features": ["voice_in", "sms_in"],
"setup_price": 2.10, "monthly_price": 2.10, "round_number_fee": 20.00, "currency": "USD",
"min_months": 1, "max_months": 60, "requires_registration": false
}
],
"meta": { "count": 1, "total_count": 14, "is_sample": true }
}
is_sample is true when more numbers match than the response shows. Ask again, or narrow the search, to see others.
features keeps numbers whose area has all the capabilities you list. It is a
comma-separated list of voice_in, voice_out,
sms_in, sms_out, t38.
Order, case and repeats don't matter, and anything else is 422. It works on areas too, and combines with every other filter:
> curl -G https://sim.lastsim.co/api/v1/reseller/round-numbers \
-H "Authorization: Bearer YOUR_API_TOKEN" \
--data-urlencode "country=US" --data-urlencode "features=sms_in,sms_out" --data-urlencode "search=7237"
Capabilities belong to the area, so the filter cuts a country down a lot in some places (Estonia has no SMS at all, so features=sms_in matches nothing there) and almost nothing in others.
GET /round-numbers/{number}?country=US
One number, same shape as a list row. The country is required. A number that is sold or was never listed returns 404 number_unavailable. Ability: numbers:purchase or numbers:read.
POST /round-numbers/quote
What a purchase would charge. No order, no charge. Ability: numbers:purchase or numbers:read.
> curl -X POST https://sim.lastsim.co/api/v1/reseller/round-numbers/quote \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "number": "+12125557777", "country": "US", "months": 12 }'
>{
"number": "+12125557777", "country_iso": "US", "months": 12,
"setup_price": 2.10, "monthly_price": 2.10, "round_number_fee": 20.00,
"total_price": 47.30, "currency": "USD", "requires_registration": false
}
A random number from an area. Send area_id instead of number and country (exactly one of the two). You do not choose the number, so there is no round_number_fee (it is $0) and the number is null: the price is the area's setup fee plus its monthly fee for the months. Any area that does not need registration can be bought this way, and it is the only way for an area whose has_numbers is false. An unknown area_id answers 404 area_not_found.
> curl -X POST https://sim.lastsim.co/api/v1/reseller/round-numbers/quote \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "area_id": "ar_ZHpKljzUmM59WzygFgOJ-KAZrNrwTiDz", "months": 3 }'
>{
"number": null, "random": true, "area_id": "ar_ZHpKljzUmM59WzygFgOJ-KAZrNrwTiDz", "area": "Mobile",
"country_iso": "GB", "months": 3, "setup_price": 4.14, "monthly_price": 4.14,
"round_number_fee": 0, "total_price": 16.56, "currency": "USD", "requires_registration": false
}
POST /round-numbers/purchase
Buy the number. Your wallet is charged the total at once. Ability: numbers:purchase. Requires an Idempotency-Key header (see Idempotency), so a retry can't buy it twice. The price is read again at purchase time. Send max_total (the most you agree to pay) and a higher price returns 409 price_changed instead of being charged.
processing. Poll
order status with its id
(rnd_…); it turns provisioned
once the number is on your account, normally within a couple of minutes. If it turns
failed, the number could not be ordered: contact support with the order id.
Your metadata is copied onto the number.
Request
> curl -X POST https://sim.lastsim.co/api/v1/reseller/round-numbers/purchase \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 5c1e7a52-5f0e-4c51-8d1e-7a2b9c0d1e2f" \
-d '{ "number": "+12125557777", "country": "US", "months": 12, "max_total": 50.00, "metadata": { "customer_id": "422" } }'
Add client_id to buy for one of your
clients. Your wallet pays; the client owns the order and the number,
and the order echoes client_id back. The number is registered on the client's account, so it shows under
GET /clients/{id}/numbers, not in
GET /numbers. The same Idempotency-Key with a different
client_id is refused (409 idempotency_key_reused).
Response (201)
>{
"id": "rnd_903",
"kind": "round",
"client_id": null,
"status": "processing",
"numbers": [],
"processing_started_at": "2025-11-04T11:40:00+00:00",
"metadata": { "customer_id": "422" }
}
A random number. Send area_id instead of number and country to buy a random number from that area ({ "area_id": "ar_…", "months": 3, "max_total": 20.00 }). Same order, same polling; the order's numbers stays empty until the supplier has delivered one, and the number it picks is what provisioned then lists. No round-number fee. client_id, max_total and metadata work as for a chosen number, and the Idempotency-Key is bound to the area.
Errors: 409 number_unavailable, 409 price_changed,
402 insufficient_balance (your wallet, never the client's), 422 registration_required,
422 country_not_available, 422 invalid_duration,
404 client_not_found, 404 area_not_found (random), 403 client_accounts_not_activated, 503 catalog_unavailable.
A 503 or any other error leaves nothing charged, and the same Idempotency-Key can be retried.
The number renews like any other Virtual Number.
Clients
POST /clients
Create a real LastSim account for your customer. You pay for their numbers from your wallet, they own what you buy, and they sign in themselves with Telegram or Google. If you'd rather your customer never sees LastSim, use metadata tags instead. In the dashboard this feature is called Managed Purchases.
Ability: clients:write. Requires an Idempotency-Key header.
403 client_accounts_not_activated and the error
details tell you how much is still outstanding.
Sandbox is gated the same way — it's a real account rule, not something
sandbox fakes, and both your tokens hang off the same account.
Request
curl -X POST https://sim.lastsim.co/api/v1/reseller/clients \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 3c9a1f22-77b4-4c0e-9c1a-2f0b7d5e1a00" \
-d '{
"mobile": "+37255001234",
"email": "[email protected]",
"display_name": "Jane Roe"
}'
Response
{
"id": 41,
"mobile": "+37255001234",
"email": "[email protected]",
"display_name": "Jane Roe",
"status": "pending",
"created_at": "2026-08-15T09:20:11+00:00",
"expires_at": "2026-08-18T09:20:11+00:00",
"purchased_at": null
}
Before you call POST /clients
- Send mobile, email, or both. At least one is required, and each one is a way in: mobile enables the Telegram bot, email enables Google sign-in.
- Email must be a Gmail or Googlemail address. Google sign-in is the only door in for that channel, so any other domain is rejected.
- Neither value may already belong to a LastSim account. Clients are for people who don't have one yet, and an existing user can't be converted into one.
- A client with no purchase is deleted 3 days after creation. expires_at is that deadline. Buy something for them and it goes away.
- There's a daily cap on how many clients you can create. Hit it and you get
429 client_creation_limit_reachedwith the limit in details. - You tell the client how to sign in. LastSim doesn't email or message them on creation.
In sandbox
Clients work the same way in sandbox — same request, same response, same 3-day window. The difference is what's behind it: a sandbox client is a test record, not a real account, so nobody signs in as one and no message ever goes out.
Sandbox doesn't check contacts against live accounts — that would let anyone with a free sandbox
token probe whether a phone number or email is registered with us. A contact that passes in
sandbox may still fail in live with 422 client_contact_taken.
Handle that error in both environments.
GET /clients
Your clients, newest first. Ability: clients:read. Params: status (pending/active), page, per_page.
{
"data": [
{ "id": 41, "mobile": "+37255001234", "email": "[email protected]",
"display_name": "Jane Roe", "status": "active",
"created_at": "2026-08-15T09:20:11+00:00", "expires_at": null,
"purchased_at": "2026-08-15T09:24:03+00:00" }
],
"meta": { "current_page": 1, "per_page": 20, "total": 1, "total_pages": 1 }
}
A client is pending until you buy something for them, then active. An active client has no deletion deadline, so expires_at is null.
GET /clients/{id}
One client. Same fields as a row of GET /clients. Ability: clients:read. An id that isn't yours returns 404 client_not_found.
GET /clients/{id}/numbers
The numbers this client owns, in the same shape as GET /numbers — including the same filters: type, status (active/expired), expiring_within_days, metadata_key + metadata_value, page, per_page. Ability: clients:read.
{
"data": [
{ "id": 302, "number": "+37255000061", "type": "physical_estonia",
"is_activated": true, "expires_at": "2026-11-15T00:00:00+00:00",
"auto_renew": false, "monthly_price": 4.00,
"renewal": { "min_months": 1, "max_months": 60, "allowed_months": [1, 3, 6, 12, 36, 60] },
"sms_send_package": { "active": false, "expires_at": null,
"allowed_months": [1, 3, 6, 12], "can_send": false, "blocked_reason": "sms_package_required" },
"metadata": {} }
],
"meta": { "current_page": 1, "per_page": 20, "total": 1, "total_pages": 1 }
}
Renew any of these the same way you'd renew your own: POST /numbers/{id}/renew accepts a client's number id too, and the charge goes to your wallet either way.
End-to-end example
From nothing to a customer holding their own number.
- GET /me — confirm clients.is_activated is true.
- POST /clients with their mobile and/or Gmail. Keep the returned id.
- POST /numbers/purchase with client_id set to that id. Your wallet is debited.
- For a Virtual Number, poll GET /numbers/purchase/{orderId} until status is provisioned.
- Tell your customer how to sign in: open the Telegram bot and share their phone number, or use "Sign in with Google" with the address you registered.
- GET /clients/{id}/numbers whenever you need to see what they hold.
Steps 1–4 and 6 all work with a sandbox token, so you can build and test the whole flow before spending anything. Step 5 has no sandbox equivalent — nobody signs in as a test record.
From step 5 on, the customer is signing in to LastSim under LastSim's own branding, and can contact LastSim support directly. If that isn't what you want, don't use clients: buy the number on your own account and tag it with metadata.
SMS
GET /sms
Incoming SMS for numbers on your own account — not client-owned numbers (see ownership). Ability: sms:read. Params: number (filter), since, page/per_page. Poll with since to fetch only new messages. Also useful if a webhook delivery is missed.
{
"data": [
{ "id": 5501, "type": "sms_in", "source": "15551234567", "destination": "+37257447282",
"message": "Your code is 482913", "received_at": "2025-11-04T10:05:00+00:00" }
],
"meta": { "current_page": 1, "per_page": 20, "total": 1, "total_pages": 1 }
}
GET /sms/{id}
A single message, without paging the full list. Ability: sms:read.
{ "id": 5501, "type": "sms_in", "source": "15551234567", "destination": "+37257447282",
"message": "Your code is 482913", "received_at": "2025-11-04T10:05:00+00:00" }
POST /sms/quote
Find out what POST /sms would charge for a message,
without sending anything or touching your wallet. It prices the message with the same code the send uses, so
total_cost is the amount a send would debit.
Ability: sms:send or
sms:read. No
Idempotency-Key is needed. Not supported for sandbox tokens.
curl -X POST https://sim.lastsim.co/api/v1/reseller/sms/quote \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"source": "37257447282",
"destination": "+491761234567",
"message": "Hello from LastSim"
}'
{
"source": "37257447282",
"destination": "+491761234567",
"country": "Germany",
"encoding": "gsm7",
"parts": 1,
"rate_per_part": 0.174,
"total_cost": 0.17,
"currency": "USD"
}
The price depends on the number the message leaves from, the destination country, the number of parts and the encoding. Messages sent from an Estonian number are priced from their own carrier tariff; every other number uses the standard one. That is why source is required. encoding is gsm7 for plain text (160 characters in one part, 153 per part after that) or ucs2 as soon as the message has a character outside that set (70 characters in one part, 67 per part after that). total_cost is rate_per_part times parts, rounded to the cent, which is how the wallet is debited. source is required and is checked exactly as POST /sms checks it, so a number that can't send fails here with source_not_eligible, sms_package_required or sms_package_expired. A destination we have no rate for returns 422 no_rate, and a malformed one 422 invalid_destination. The quote does not check your balance; read it from GET /wallet/balance. An Estonia number also needs its sending package, priced separately with its own quote.
POST /sms
Send an outbound SMS from one of your own send-capable numbers. An Estonia number is only send-capable while its
SMS sending package is active;
check sms_send_package.can_send on the number. Ability:
sms:send, which is separate from
sms:read because this spends
your wallet. Requires an Idempotency-Key
header (see Idempotency above).
To see the price first, use
POST /sms/quote. Not supported for sandbox tokens; use
simulate inbound SMS there instead.
curl -X POST https://sim.lastsim.co/api/v1/reseller/sms \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 9b2f0e10-3333-4c1d-8b22-1a1a1a1a1a1a" \
-d '{
"source": "12135550100",
"destination": "+491761234567",
"message": "Hello from LastSim"
}'
{
"sms_id": 5510,
"source": "12135550100",
"destination": "+491761234567",
"message": "Hello from LastSim",
"parts": 1,
"amount_charged": 0.05,
"currency": "USD",
"wallet_balance_after": 341.75
}
You are charged only for a message the carrier accepted. If the carrier refuses it you get 502 gateway_failed and nothing is debited, and the same Idempotency-Key can be used again. If the request times out and you never see a sms_id, don't guess: ask GET /sms/status with the same key.
GET /sms/status
Find out what became of a POST /sms that never gave you an answer,
using the Idempotency-Key you sent with it. Ability:
sms:send or
sms:read. It changes nothing. Not supported for sandbox tokens.
curl "https://sim.lastsim.co/api/v1/reseller/sms/status?idempotency_key=9b2f0e10-3333-4c1d-8b22-1a1a1a1a1a1a" \
-H "Authorization: Bearer YOUR_API_TOKEN"
{
"idempotency_key": "9b2f0e10-3333-4c1d-8b22-1a1a1a1a1a1a",
"state": "sent",
"charged": true,
"sms_id": 5510,
"amount_charged": 0.05,
"currency": "USD"
}
| state | What happened | What to do |
|---|---|---|
| sent | The carrier accepted the message and it was charged. sms_id and amount_charged are filled in. | Nothing. Don't send it again. |
| processing | The request is still running. | Ask again in a few seconds. |
| not_sent | The request died before the message went to the carrier. Not charged. | Safe to send again. Use a new Idempotency-Key, because this one stays closed. |
| unknown | The request died after we recorded the message and before the carrier answered. It may or may not have been sent. It has not been charged. sms_id is filled in. | Don't resend. Contact support with the sms_id; we check with the carrier and settle it, and this endpoint then reports sent or not_sent. |
404 idempotency_key_not_found means no send is on record for that key: it never started, or the carrier refused it (502 gateway_failed). Either way nothing was sent and nothing was charged, and the same key can be used again. We keep a send's record for 7 days. After that, a missing key proves nothing, so check GET /sms (type=sms_out) instead.
Webhooks
We POST new SMS to your URL. Delivery isn't guaranteed — webhooks may duplicate or miss events.
Poll GET /sms
as a backup. Dedupe on the SMS id.
PUT /webhook
Register or replace your webhook URL. Ability: webhook:manage. It must be HTTPS and must not resolve to a private/loopback/link-local address. That check runs at every delivery, not just at registration, so it can't be bypassed with a DNS trick after the fact. On success, LastSim sends a one-time signed verification ping to the URL, and the webhook only activates once your endpoint responds 2xx.
curl -X PUT https://sim.lastsim.co/api/v1/reseller/webhook \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "webhook_url": "https://reseller.example.com/lastsim-webhook" }'
{
"webhook_url": "https://reseller.example.com/lastsim-webhook",
"is_verified": true,
"is_active": true,
"webhook_secret": "b6f1...e02a"
}
webhook_secret is shown exactly once, right
here, so store it immediately. It's the HMAC key that signs
X-LastSim-Signature on every delivery; without
it you can't verify that incoming webhook calls are genuinely from LastSim. No other endpoint or
dashboard page shows it again. If you lose it, use
rotate secret to get a new one.
POST /webhook/rotate-secret
Issue a new signing secret if you lost the original or suspect it leaked. Ability: webhook:manage. The previous secret stops working immediately, so any delivery in flight when you rotate will fail your signature check. Your registered URL and its verified/active state are untouched.
{ "webhook_url": "https://reseller.example.com/lastsim-webhook", "webhook_secret": "f4a2...9c1b" }
DELETE /webhook
Stop all outbound delivery and clear your registered URL/secret. Ability: webhook:manage. Idempotent, so it's safe to call even if nothing is registered. GET /sms keeps working as a polling fallback regardless.
{ "webhook_url": null, "is_active": false }
POST /webhook/test
Fires a test event through the same pipeline as real SMS. Ability: webhook:manage. Logged in your delivery list, tagged as a test.
{ "delivery_id": 1042, "status": "pending" }
GET /webhook/deliveries
Your delivery history. Ability: webhook:manage. Filter by status: pending, delivered, exhausted.
{
"data": [
{ "id": 1042, "sms_id": 5501, "is_test": false,
"webhook_url": "https://reseller.example.com/lastsim-webhook",
"status": "delivered", "attempts_made": 1,
"delivered_at": "2025-11-04T10:05:02+00:00", "created_at": "2025-11-04T10:05:00+00:00" }
],
"meta": { "current_page": 1, "per_page": 20, "total": 1, "total_pages": 1 }
}
GET /webhook/deliveries/{id}
Full per-attempt breakdown for one delivery: every HTTP attempt, its status code (or connection error), and timing. Ability: webhook:manage.
{
"id": 1043, "sms_id": 5502, "is_test": false, "status": "exhausted", "attempts_made": 5,
"delivered_at": null, "created_at": "2025-11-04T09:00:00+00:00",
"attempts": [
{ "attempt_number": 1, "attempted_at": "2025-11-04T09:00:00+00:00", "http_status_code": null,
"error_message": "Connection timed out after 10000ms", "duration_ms": 10000 },
{ "attempt_number": 5, "attempted_at": "2025-11-04T09:04:00+00:00", "http_status_code": 500,
"error_message": "Internal Server Error", "duration_ms": 340 }
]
}
POST /webhook/deliveries/{id}/resend
Manually retry an exhausted delivery once you've fixed your endpoint. It resets to a fresh cycle of up to 5 attempts. Ability: webhook:manage. Returns 422 invalid_delivery_state for anything not currently exhausted.
Verifying signatures
Every webhook POST carries X-LastSim-Signature
(HMAC-SHA256 over {timestamp}.{raw body}, using your
per-reseller webhook secret) and X-LastSim-Timestamp.
Reject timestamps older than ~5 minutes — this closes the replay window even if a signed
payload is ever captured.
Sandbox-only endpoints
These two have no live equivalent, so calling either with a live token returns
422 sandbox_only.
POST /sandbox/wallet/topup
Add free fake balance to a sandbox account, with no payment gateway involved. Ability: wallet:read.
curl -X POST https://sim.lastsim.co/api/v1/reseller/sandbox/wallet/topup \
-H "Authorization: Bearer YOUR_SANDBOX_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "amount": 500 }'
{ "balance": 500.00, "currency": "USD" }
POST /sandbox/sms/simulate
Insert a fake inbound SMS against one of your own sandbox numbers. Ability: sms:read. From here, GET /sms and your registered webhook both run for real, and only the event itself is fake.
curl -X POST https://sim.lastsim.co/api/v1/reseller/sandbox/sms/simulate \
-H "Authorization: Bearer YOUR_SANDBOX_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"sandbox_number_id": 12,
"source": "15551234567",
"message": "test code 4821"
}'
{
"id": 5, "type": "sms_in", "source": "15551234567", "destination": "+37200000045",
"message": "test code 4821", "received_at": "2025-11-04T10:05:00+00:00"
}
Full sandbox walkthrough
End-to-end sandbox integration test. Same calls as live, just against sandbox credentials.
-
1. Top up your fake wallet
POST /sandbox/wallet/topup { "amount": 500 } → 200 { "balance": 500, "currency": "USD" } -
2. Purchase a synchronous (Estonia) number
POST /numbers/purchase { "product_id": 1, "duration_months": 3, "quantity": 1, "activate_now": true } → 201 { "id": "sbx_ord_001", "status": "provisioned", "numbers": [{ "id": 12, "number": "+37200000045", "is_activated": true }] } -
3. Purchase an asynchronous (Virtual Number-type) number
POST /numbers/purchase { "product_id": 456, "duration_months": 3, "quantity": 1, "activate_now": true } → 201 { "id": "sbx_ord_002", "status": "processing", "numbers": [] } ...~60 real seconds later... GET /numbers/purchase/sbx_ord_002 → 200 { "id": "sbx_ord_002", "status": "provisioned", "numbers": [{ "id": 13, "number": "+12135550100", "is_activated": true }] }The fake NANP number is drawn from the industry-reserved 555-01XX block, the same convention film and TV use, so it's never a real number.
-
4. List your numbers
GET /numbers → 200 { "data": [ { "number": "+37200000045", ... }, { "number": "+12135550100", ... } ], "meta": {...} } -
5. Renew the Estonia number and tag it
POST /numbers/12/renew { "months": 3, "metadata": { "customer_id": "422" } } → 200 { "number_id": 12, "months": 3, "expires_at": "...", "amount_charged": 8, "wallet_balance_after": 468, "invoice_id": null, "metadata": { "customer_id": "422" } }Every number renews with months, live or sandbox. This Estonia number's renewal.allowed_months is [1, 3, 6, 12, 36, 60], so months: 3 is valid. It's charged from your fake balance, with no real invoice.
-
6. (Optional) Register a webhook, then simulate an inbound SMS
PUT /webhook { "webhook_url": "https://your-test-server.example.com/hook" } → 200 { "is_verified": true, "is_active": true, "webhook_secret": "..." } POST /sandbox/sms/simulate { "sandbox_number_id": 12, "source": "15551234567", "message": "hello" } → 201 { "id": 5, ... } ...your webhook receiver gets a real, signed POST within seconds... -
7. Confirm via polling too
GET /sms → 200 { "data": [ { "message": "hello", "source": "15551234567", ... } ], "meta": {...} } -
8. Check the fake wallet ledger
GET /wallet/transactions → 200 { "data": [ { "id": 3, "type": "renewal", "amount": -8.00, "description": "Renewal: +37200000045 (3 months)", "remaining": 468.00, "created_at": "..." }, { "id": 2, "type": "purchase", "amount": -22.00, "description": "Purchase: 1x virtual_number (3 months)", "remaining": 476.00, "created_at": "..." }, { "id": 1, "type": "charge", "amount": 500.00, "description": "Sandbox wallet top-up", "remaining": 500.00, "created_at": "..." } ], "meta": {...} }Every step above that touched your fake balance shows up here — same type/since filters as live, just against sandbox's own three transaction types.
Changelog
Every change to an endpoint, request/response shape, or error code goes here. Wording or example fixes on this page don't need a row.
| Date | Version | Changes |
|---|---|---|
| — | v1.0 | Initial release. Account, Wallet, Products, Numbers, Clients, SMS, and Webhooks. |