API Documentation
Use the API to get prices, order numbers, poll for SMS, and manage your wallet programmatically. All amounts are in USD cents.
Overview
The API lets you:
- Get your wallet balance (and optional transaction history)
- Get platform price for a service and country (includes our markup)
- List your activations (paginated)
- Create an activation (order a number)
- Get a single activation by ID
- Poll an activation for SMS status and code (charge is applied when SMS is received)
- Cancel an activation (refund if already charged)
You need an API key. Create one from your API keys page (logged in).
Authentication
Every request must include your API key in one of these ways:
- Header:
X-Api-Key: YOUR_API_KEY - Header:
Authorization: Bearer YOUR_API_KEY
If the key is missing or invalid, the API returns 401 Unauthorized with a JSON body including "code": "invalid_key" and a friendly message.
Base URL & paths
All endpoints use the same base URL. You pass the path as a query parameter path= (or as PATH_INFO if your server supports it).
Base URL:
https://tempcode77.com/api/v1/index.php
Example: To get wallet balance, request:
https://tempcode77.com/api/v1/index.php?path=wallet
With path= you can use: wallet, price, activations, activations/123, activations/123/poll, activations/123/cancel.
Rate limits
180 requests per minute per API key. The limit resets every minute.
If you exceed the limit, the API returns 429 Too Many Requests with header Retry-After: 60 and a friendly error message (code: rate_limit).
Errors
All errors return JSON with "ok": false and an "error" message (friendly, human-readable). Many include a "code" for programmatic handling. For balance errors, balance_cents and required_cents may be included.
- 400 Bad Request
- Invalid or missing parameters (
code: invalid_params). - 401 Unauthorized
- Missing or invalid API key (
code: invalid_key). - 402 Payment Required
- Insufficient wallet balance (
code: insufficient_balance). Response may includebalance_centsandrequired_centsso you can show the user how much to add. - 404 Not Found
- Activation not found or path not recognized (
code: not_found). - 405 Method Not Allowed
- Wrong HTTP method for the path (e.g. POST on wallet).
- 429 Too Many Requests
- Rate limit exceeded (
code: rate_limit).
Catalog (services & countries)
These endpoints do not require an API key. Use them to get valid service_id and country_id values for the Price and Create activation endpoints.
Returns all services. Each item includes service_id, name, and (from our categorization) type and type_label (e.g. social_media, messaging, shopping).
Query parameters
| type | Optional. Filter by category: social_media, messaging, shopping, banking, email, gaming, streaming, travel, food, dating, other. |
|---|---|
| grouped | Optional. Set to 1 to get by_type (slug → { label, services[] }) and types (slug, label) for building category filters. |
Example
curl -X GET "https://tempcode77.com/api/services.php?grouped=1"
Returns all countries. Each item has country_id and name.
Example
curl -X GET "https://tempcode77.com/api/countries.php"
Wallet
Returns your wallet balance in cents. Optionally include transaction history.
Query parameters
| transactions | Optional. Set to 1 or any non-empty value to include the last 20 wallet transactions in the response. |
|---|
Response (200)
{
"ok": true,
"data": {
"balance_cents": 12500,
"transactions": [
{
"type": "deposit",
"amount_cents": 1000,
"balance_after_cents": 12500,
"description": "Deposit",
"created_at": "2025-02-15 12:00:00"
}
]
}
}
Example
curl -X GET "https://tempcode77.com/api/v1/index.php?path=wallet" \ -H "X-Api-Key: YOUR_API_KEY"
Price
Returns the platform price (including our markup) for a service and country. Also returns backend (Platfone) cost and availability. Prices are live from Platfone and cached for 90 seconds so you get up-to-date rates without excessive requests.
Query parameters
| service_id | Required. Service ID (e.g. whatsapp, telegram). Alphanumeric, dashes, underscores; 1–30 chars. |
|---|---|
| country_id | Required. Country ID (e.g. us, uk). 2–9 chars. |
Response (200)
{
"ok": true,
"data": {
"price": {
"suggested": 287,
"min": 210,
"max": 510
},
"backend_cents": 260,
"sell_price_cents": 287,
"count": 124335
}
}
sell_price_cents is what you pay when you create an activation. backend_cents is the Platfone cost we use for the order.
Example
curl -X GET "https://tempcode77.com/api/v1/index.php?path=price&service_id=whatsapp&country_id=us" \ -H "X-Api-Key: YOUR_API_KEY"
List activations
Returns a paginated list of your activations (most recent first).
Query parameters
| page | Optional. Page number (default 1). |
|---|---|
| limit | Optional. Items per page, 1–50 (default 20). |
Response (200)
{
"ok": true,
"data": {
"activations": [
{
"id": 42,
"activation_id": "abc123...",
"phone": "+14155551234",
"country_id": "us",
"service_id": "whatsapp",
"price_cents": 260,
"sell_price_cents": 287,
"sms_status": "smsRequested",
"activation_status": "active",
"created_at": "2025-02-15 12:00:00"
}
],
"page": 1,
"limit": 20,
"total": 1
}
}
Example
curl -X GET "https://tempcode77.com/api/v1/index.php?path=activations&page=1&limit=10" \ -H "X-Api-Key: YOUR_API_KEY"
Create activation
Orders a phone number for the given service and country. You are charged when the SMS is received (see Poll activation).
Request body (JSON or form)
| service_id | Required. Service ID (e.g. whatsapp). |
|---|---|
| country_id | Required. Country ID (e.g. us). |
| max_price | Optional. Max you are willing to pay (USD cents, 1–10000). Defaults to current suggested price. |
Response (200)
{
"ok": true,
"data": {
"id": 43,
"activation_id": "platfone_activation_id",
"phone": "+14155551234",
"country_id": "us",
"service_id": "whatsapp",
"sell_price_cents": 287,
"price_cents": 260
}
}
Use the returned id (our internal ID) for path=activations/{id}, path=activations/{id}/poll, and path=activations/{id}/cancel.
Example
curl -X POST "https://tempcode77.com/api/v1/index.php?path=activations" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"service_id": "whatsapp", "country_id": "us"}'
Get activation
Returns a single activation by our internal id (returned when you create an activation). This endpoint syncs from Platfone before returning, so you get the latest state (including sms_code and sms_text when the SMS has been received). You can use either Get activation or Poll activation to retrieve the code; both update our DB and charge your wallet once when SMS is received.
Path
{id} — integer ID of the activation (e.g. path=activations/43).
Response (200)
{
"ok": true,
"data": {
"id": 43,
"activation_id": "...",
"phone": "+14155551234",
"country_id": "us",
"service_id": "whatsapp",
"price_cents": 260,
"sell_price_cents": 287,
"sms_status": "smsReceived",
"activation_status": "active",
"billing_status": "billed",
"sms_code": "123456",
"sms_text": "Your code is 123456",
"expire_at": 1730123456,
"is_retriable": true
}
}
Example
curl -X GET "https://tempcode77.com/api/v1/index.php?path=activations/43" \ -H "X-Api-Key: YOUR_API_KEY"
Poll activation
Fetches the latest activation state from Platfone and updates our DB. When sms_status becomes smsReceived or retryReceived, your wallet is charged sell_price_cents (once per activation). Poll every 5–10 seconds until you get the SMS or the activation expires.
Path
{id} — our internal activation ID (e.g. path=activations/43/poll).
Response (200)
{
"ok": true,
"data": {
"phone": "+14155551234",
"sms_status": "smsReceived",
"activation_status": "active",
"sms_code": "123456",
"sms_text": "Your code is 123456",
"expired": false
}
}
sms_status: smsRequested (waiting), smsReceived (first SMS), retryRequested, retryReceived. When smsReceived or retryReceived, sms_code and sms_text are set and you have been charged.
Example
curl -X GET "https://tempcode77.com/api/v1/index.php?path=activations/43/poll" \ -H "X-Api-Key: YOUR_API_KEY"
Cancel activation
Cancels the activation. If you were already charged (SMS received), the amount is refunded to your wallet.
Path
{id} — our internal activation ID (e.g. path=activations/43/cancel).
Response (200)
{
"ok": true,
"data": {
"result": "canceled"
}
}
Example
curl -X POST "https://tempcode77.com/api/v1/index.php?path=activations/43/cancel" \ -H "X-Api-Key: YOUR_API_KEY"
Usage flow
- Get
service_idandcountry_idfrom the catalog:GET /api/services.phpandGET /api/countries.php(no API key). - Get price:
GET path=price&service_id=...&country_id=...to show the user the cost. - Create activation:
POST path=activationswithservice_idandcountry_id. You receiveid,phone,activation_id. - Show the user the
phoneand ask the service to send SMS to that number. - Poll or Get:
GET path=activations/{id}/pollorGET path=activations/{id}every 5–10 seconds untilsms_statusissmsReceived(orretryReceived) orexpiredis true. Both endpoints sync from Platfone and returnsms_code/sms_textwhen the SMS has arrived; your balance is debited once. - When SMS is received, use
sms_codeandsms_text. - Optional: cancel with
POST path=activations/{id}/cancelif the user abandons (refund if already charged).