Skip to content

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.

Examples
10
Languages
8
SDK needed
None

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

    Cost
    The SMS that carries the code, at the route rate plus the fee. No per-verification fee.
    Languages
    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

    Cost
    The call that reads the code, per billing increment plus the fee.
    Languages
    cURL, Node, Python, PHP, Go, Java, C#, Ruby
    Quickstart
  • Send an SMS

    A transactional reminder, then its status.

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

    Cost
    The route rate per segment plus the fee.
    Languages
    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

    Cost
    Billable seconds at the route rate plus the fee. Unanswered calls cost nothing.
    Languages
    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

    Cost
    Free.
    Languages
    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

    Cost
    Free.
    Languages
    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

    Cost
    Buying charges the setup price plus the first month; it asks for --confirm first.
    Languages
    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

    Cost
    Creating and simulating are free. Calls bill per AI-connected minute.
    Languages
    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.25 a test, refunded if the route does not ring. The call's minutes are billed if it connects.
    Languages
    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

    Cost
    Moves the USDC you choose, $5 to $50,000; it asks for --confirm first.
    Languages
    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.

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.