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:

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:

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 include balance_cents and required_cents so 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.

GET https://tempcode77.com/api/services.php

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

typeOptional. Filter by category: social_media, messaging, shopping, banking, email, gaming, streaming, travel, food, dating, other.
groupedOptional. 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"
GET https://tempcode77.com/api/countries.php

Returns all countries. Each item has country_id and name.

Example

curl -X GET "https://tempcode77.com/api/countries.php"

Wallet

GET path=wallet

Returns your wallet balance in cents. Optionally include transaction history.

Query parameters

transactionsOptional. 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

GET path=price&service_id={service_id}&country_id={country_id}

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_idRequired. Service ID (e.g. whatsapp, telegram). Alphanumeric, dashes, underscores; 1–30 chars.
country_idRequired. 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

GET path=activations

Returns a paginated list of your activations (most recent first).

Query parameters

pageOptional. Page number (default 1).
limitOptional. 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

POST path=activations

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_idRequired. Service ID (e.g. whatsapp).
country_idRequired. Country ID (e.g. us).
max_priceOptional. 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

GET path=activations/{id}

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

GET path=activations/{id}/poll

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

POST path=activations/{id}/cancel

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

  1. Get service_id and country_id from the catalog: GET /api/services.php and GET /api/countries.php (no API key).
  2. Get price: GET path=price&service_id=...&country_id=... to show the user the cost.
  3. Create activation: POST path=activations with service_id and country_id. You receive id, phone, activation_id.
  4. Show the user the phone and ask the service to send SMS to that number.
  5. Poll or Get: GET path=activations/{id}/poll or GET path=activations/{id} every 5–10 seconds until sms_status is smsReceived (or retryReceived) or expired is true. Both endpoints sync from Platfone and return sms_code/sms_text when the SMS has arrived; your balance is debited once.
  6. When SMS is received, use sms_code and sms_text.
  7. Optional: cancel with POST path=activations/{id}/cancel if the user abandons (refund if already charged).