01 / Authentication
One operator token, two portal rails
All operator endpoints live under /api/v1/switch and require your operator bearer token in the Authorization header. Self-service portals are separate, magic-link-authenticated rails.
- Operator API:
Authorization: Bearer <operator_api_key>under/api/v1/switch. - Customer portal:
/api/v1/sub-portal- theauth/*endpoints are public (magic-link request/verify); all others need the portal session token minted at verify. - Supplier portal:
/api/v1/vendor-portal- same magic-link model as the customer portal. - Every response is wrapped as
{ success, data }except raw documents (invoice HTML/XML, portal CSV). Resources are scoped to your operator - another operator's resource returns404.
curl "https://packetexchange.io/api/v1/switch/entity-counts" \
-H "Authorization: Bearer <operator_api_key>"
# → { "success": true, "data": { "customers": 0, ... } }02 / Getting started
Zero to a previewable route
Create a supplier trunk
POST /suppliers with { label, sipHost, transport }. (Or promote a purchased marketplace route via /suppliers/promote.)
Add a cost deck
POST /suppliers/:id/rates/bulk with your termination rates - billed longest-prefix on live traffic.
Create a route group
POST /route-plans, then PUT /route-plans/:id/entries. Priorities give failover; weights load-balance.
Create a customer
POST /customers. The 201 returns the customer’s first apiKey + sipPassword (shown once) - hand these off so they can send you traffic.
Assign routing + preview
POST /customers/:id/routing to bind a plan, then GET /routing/preview?to=... for the resolved dialplan verdict + ordered failover chain (no side effects).
From there: add a retail SELL deck (POST /sell-rates/bulk), and once traffic flows, generate invoices, record payments, and run settlement. Give both sides self-serve visibility by setting portalEmail and calling the portal-invite endpoints.
curl "https://packetexchange.io/api/v1/switch/routing/preview?to=14155551234&subAccountId=<customerId>" \
-H "Authorization: Bearer <operator_api_key>"
# → resolved dialplan verdict + ordered
# candidates[] failover chain (supplier,
# matchedPrefix, price) - no side effects03 / Customers, Suppliers & Provisioning
Bring suppliers in, connect customers out
Sell-side customers (sub-accounts with their own API key + SIP creds) and buy-side supplier vendor trunks, plus inbound IP ACLs and magic-link portal invites. All under /api/v1/switch, operator bearer auth.
Customers
/switch/customers/switch/customers/switch/customers/:id/switch/customers/:id/switch/customers/:id/portal-invite/application/sub-accounts/:id/credit/application/sub-accounts/:id/debitSuppliers
/switch/suppliers/switch/suppliers/switch/suppliers/promote/switch/suppliers/:id/switch/suppliers/:id/switch/suppliers/:id/switch/suppliers/:id/portal-inviteIP ACLs
/switch/acls/switch/acls/switch/acls/:idOverview
/switch/entity-counts04 / Routing
Dialplans, route groups, LCR & failover
Route plans (ordered suppliers with priority/weight and SIP-code failover), dialplans (match → manipulate → route/block rules), per-customer assignment, and a read-only preview that resolves the full failover chain with no side effects.
Route plans (route groups)
/switch/route-plans/switch/route-plans/switch/route-plans/:id/switch/route-plans/:id/switch/route-plans/:id/switch/route-plans/:id/entriesDialplans
/switch/dialplans/switch/dialplans/switch/dialplans/:id/switch/dialplans/:id/switch/dialplans/:id/switch/dialplans/:id/rulesPer-customer routing
/switch/customers/:id/routing/switch/customers/:id/routingPreview
/switch/routing/preview05 / Rating
Retail SELL decks & per-trunk COST decks
A-Z rate decks billed longest-prefix on live traffic. Prefixes are cleaned to digits (max 24 chars). Single upserts, bulk imports (up to 50,000 rows), deletes, and clears.
Sell rates (retail SELL deck)
/switch/sell-rates/switch/sell-rates/switch/sell-rates/bulk/switch/sell-rates/:id/switch/sell-rates/clearSupplier cost rates (per-trunk)
/switch/suppliers/:id/rates/switch/suppliers/:id/rates/switch/suppliers/:id/rates/bulk/switch/suppliers/:id/rates/:rateId/switch/suppliers/:id/rates/clear/switch/suppliers/:id/rates/archived/switch/suppliers/:id/rates/restore06 / Billing (AR invoices)
Invoices from settled CDR usage
Generate AR invoices over a period, record payments, void, email, render HTML/XML, issue credit notes, and pull AR aging. Invoice print (HTML) and xml return raw documents (not envelope-wrapped).
Invoices
/switch/invoices/switch/invoices/switch/invoices/:id/switch/invoices/:id/payments/switch/invoices/:id/void/switch/invoices/:id/send/switch/invoices/:id/print/switch/invoices/:id/xmlCredit notes, aging & settings
/switch/credit-notes/switch/credit-notes/switch/ar-aging/switch/customers/:id/billing-settings07 / Settlement (AP, counterparties, netting)
Payables, counterparties & netting
AP payables generated from supplier cost, bilateral counterparties, and netting runs that offset AR against AP over a period.
Payables
/switch/payables/switch/payables/switch/payables/:id/switch/payables/:id/payments/switch/payables/:id/void/switch/ap-agingCounterparties & netting
/switch/counterparties/switch/counterparties/switch/counterparties/:id/switch/counterparties/:id/switch/counterparties/:id/netting/switch/netting-runs08 / Reporting & Fraud
Analytics & fraud controls
A shared metric shape (revenue, cost, margin, ASR, ACD, minutes, PDD) across overview, daily time-series, and top-100 breakdowns by customer / supplier / destination - plus per-operator fraud thresholds, high-risk prefixes, and an event feed.
Analytics
/switch/analytics/overview/switch/analytics/timeseries/switch/analytics/breakdownFraud
/switch/fraud/settings/switch/fraud/settings/switch/fraud/events/switch/fraud/summary09 / Self-service Portals
Magic-link portals for both sides
Customers (/api/v1/sub-portal) and suppliers (/api/v1/vendor-portal) get self-serve visibility into CDRs, invoices/payables, rate cards, and key rotation. The auth/* endpoints are public; everything else uses the portal session token minted at verify.
Customer portal (/sub-portal)
/sub-portal/auth/request-link/sub-portal/auth/verify/sub-portal/me/sub-portal/cdrs/sub-portal/cdrs-filtered/sub-portal/cdrs.csv/sub-portal/invoices/sub-portal/rate-card/sub-portal/keys/sub-portal/keys/rotate/sub-portal/topup-requestSupplier portal (/vendor-portal)
/vendor-portal/auth/request-link/vendor-portal/auth/verify/vendor-portal/me/vendor-portal/cdrs/vendor-portal/cdrs.csv/vendor-portal/payables/vendor-portal/payments10 / Webhooks
Events emitted on key writes
Certain Switch writes fire webhooks you can subscribe to:
sell_rate.changedinvoice.createdinvoice.paymentinvoice.sentcredit_note.issuedsub_account.topup_requestedsell_rate.changed carries a kind of upsert or bulk_import. Register webhook endpoints via the core account API.
Moving traffic onto your own switch?
Our carrier team helps with interconnects, rate deck imports, routing design and settlement, from the first trunk to the first invoice.
Email Support
Write to our team and we'll get back to you.
Contact form
Send us a message from the support page.
