Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Check out our upcoming events and meetups! View events →
Declare, type, and ship a function that returns your Telnyx account balance through the binding.
telnyx-edge new-func --language ts --name balance-check cd balance-check
[telnyx]
func.toml
# func.toml [edge_compute] func_id = "60c5ce48-…" # created by new-func func_name = "balance-check" [telnyx] binding = "MY_TELNYX"
telnyx-edge types
env.MY_TELNYX
// index.ts import * as http from "node:http"; import { env } from "@telnyx/edge-runtime"; const port = Number(process.env.PORT ?? 8080); http.createServer(async (req, res) => { // Match /health and any /health/* probe path the platform requires // (the scaffold generates this guard — keep it). if (req.url === "/health" || req.url?.startsWith("/health/")) { return res.writeHead(200).end(); } const { data } = await env.MY_TELNYX.balance.retrieve(); res.writeHead(200, { "content-type": "application/json" }); res.end(JSON.stringify(data)); }).listen(port);
telnyx-edge ship
ship
curl https://balance-check-<id>.telnyxcompute.com
{ "credit_limit": "1000.00", "frozen": "0.00", "currency": "USD", "available_credit": "1100.00", "pending": "0.00", "balance": "100.00", "record_type": "balance" }
Was this page helpful?