POST /api/v1/tool-proxy
Generic tool proxy for Telnyx ConvAI tool calls during voice calls
Tool Proxy
Proxies tool calls from Telnyx Conversational AI during active voice calls. Looks up tool configuration from the database, injects authentication, and forwards the request.
Volume: ~29K runs/week | Auth: None (internal Telnyx callback)
Request
POST /api/v1/tool-proxy
Content-Type: application/jsonBody Parameters
| Field | Type | Required | Description |
|---|---|---|---|
tool_id | string | ✅ | Tool ID (internal or external) |
body | object | ✅ | Tool call payload to forward |
location_id | string | GHL location ID (for auth token) | |
contact_id | string | GHL contact ID | |
assistant_id | string | Assistant making the tool call | |
direction | string | Call direction | |
to | string | Destination number | |
from | string | Source number | |
call_control_id | string | Telnyx call control ID |
Responses
Success
Returns the proxied tool response:
{
"status": 200,
"response": {
"result": "Appointment scheduled for Tuesday at 2 PM"
}
}Tool Not Configured
{ "error": "Tool not configured", "tool_id": "unknown_tool" }Proxy Error
{
"error": "Tool execution failed",
"status": 502,
"tool_id": "tool_123"
}Test with cURL
curl -X POST http://localhost:3000/api/v1/tool-proxy \
-H "Content-Type: application/json" \
-d '{
"tool_id": "tool_schedule_appointment",
"body": {
"date": "2026-04-01",
"time": "14:00",
"contact_name": "John Doe"
},
"location_id": "loc_123",
"contact_id": "contact_789"
}'Pipeline Flow
- Look up tool configuration from DB (Prisma
Tool+ToolHeader) - If tool not found: auto-register and return error
- Fetch SubAccount access token (if
location_idprovided) - Build headers from tool config (including auth token injection)
- Forward request to tool's configured URL
- Return proxied response
Auto-Registration
Unknown tools are automatically registered in the database with:
name: thetool_iddescription: "Auto-registered tool: {tool_id}"toolType: "CUSTOM"
Configure the tool's URL and headers in the database to make it functional.