Skip to content
Markets open
Example gallery

Runnable examples in eight languages

Each example is one self-contained program that calls the REST API directly, with no SDK in between, so you can see every request and response. The same example takes the same arguments and prints the same output in every language, and each one states what it costs to run. For a short version with the steps explained, start from a quickstart.

The whole collection, with a mock API to run it against, is on GitHub.

10 examples, 8 languages

  • Verify by SMS

    Send a one-time code by text, then check what the user typed.

    POST/verify/startPOST/verify/check

    CostThe SMS that carries the code, at the route rate plus the fee. No per-verification fee.

    cURL · Node · Python · PHP · Go · Java · C# · Ruby

    Quickstart
  • Verify by voice

    The same flow, with the code read aloud on a call.

    POST/verify/startPOST/verify/check

    CostThe call that reads the code, per billing increment plus the fee.

    cURL · Node · Python · PHP · Go · Java · C# · Ruby

    Quickstart
  • Send an SMS

    A transactional reminder, then its status.

    POST/comms/smsGET/comms/sms/{id}

    CostThe route rate per segment plus the fee.

    cURL · Node · Python · PHP · Go · Java · C# · Ruby

    Quickstart
  • Make a call

    Place a call and read its outcome, duration and cost.

    POST/comms/callsGET/comms/calls

    CostBillable seconds at the route rate plus the fee. Unanswered calls cost nothing.

    cURL · Node · Python · PHP · Go · Java · C# · Ruby

    Quickstart
  • Price a number

    Rank every route for a number by real cost, then preview Smart Routing.

    GET/routes/price-numberGET/routes/resolve

    CostFree.

    cURL · Node · Python · PHP · Go · Java · C# · Ruby

    Quickstart
  • Webhooks

    A small receiver that verifies signatures before trusting a delivery.

    X-PX-SignatureX-PX-Timestamp

    CostFree.

    cURL · Node · Python · PHP · Go · Java · C# · Ruby

    Quickstart
  • Phone numbers

    Search the number store, buy a number and point it at your SIP server.

    GET/dids/searchPOST/dids/buyPATCH/dids/{id}/routing

    CostBuying charges the setup price plus the first month; it asks for --confirm first.

    cURL · Node · Python · PHP · Go · Java · C# · Ruby

    Quickstart
  • AI voice agent

    Create an agent, rehearse a turn and attach it to a campaign.

    POST/ai-agentsPOST/ai-agents/{id}/simulate

    CostCreating and simulating are free. Calls bill per AI-connected minute.

    cURL · Node · Python · PHP · Go · Java · C# · Ruby

    Quickstart
  • Caller ID test

    See which caller ID a route actually delivers to a handset.

    POST/cli-testsGET/cli-tests/{id}

    Cost$0.50 per test, charged only if the route rang.

    cURL · Node · Python · PHP · Go · Java · C# · Ruby

    Quickstart
  • x402 top-up

    Fund the balance with USDC on Base: read the 402 terms, sign, retry.

    POST/topups/x402

    CostMoves the USDC you choose, $5 to $50,000; it asks for --confirm first.

    Node · Python

Every example reads its key from PACKETEXCHANGE_API_KEY and sends an idempotency key on anything that sends, dials or buys. The two that spend more than a message (buying a number and an x402 top-up) stop and explain what would happen unless you pass --confirm.

Start building

Run one with your own key

Open an account, add credit from $5 and create a key. Test keys, on invite-only test credit, run every request without delivering it.