Skip to main content

Create Route

POST /v1/routes
Creates a new route in your tenant.

Request Body

FieldTypeRequiredDescription
namestringYesDisplay name for the route
target_base_urlstringYesThe upstream API base URL to proxy requests to
base_environmentstringNoDefault environment (defaults to production)
inject_headers_jsonobjectNoHeaders to inject into proxied requests
inject_body_jsonobjectNoBody fields to inject into proxied requests
injection_rulesobject[]NoAdvanced injection rules for secrets
ip_allowliststring[]NoIP addresses or CIDR ranges allowed to call this route
method_configsobjectNoPer-HTTP-method configuration overrides
collection_idstringNoAssign to a collection

Response

Returns the newly created route record (the full routes table row, including all columns). Note this differs from the Get Route response, which returns a projected shape with additional derived fields (environment_override_count, payload_structure, injection_rules, ip_allowlist, data_plane_node_id, and configured_environments) that are not included here. Call Get Route to retrieve those fields.
curl -X POST https://api.knoxcall.com/v1/routes \
  -H "Authorization: Bearer tk_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Payment Gateway",
    "target_base_url": "https://api.stripe.com/v1"
  }'
import requests

resp = requests.post(
    "https://api.knoxcall.com/v1/routes",
    headers={
        "Authorization": "Bearer tk_live_abc123...",
        "Content-Type": "application/json"
    },
    json={
        "name": "Payment Gateway",
        "target_base_url": "https://api.stripe.com/v1"
    }
)
route = resp.json()
const resp = await fetch("https://api.knoxcall.com/v1/routes", {
  method: "POST",
  headers: {
    Authorization: "Bearer tk_live_abc123...",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    name: "Payment Gateway",
    target_base_url: "https://api.stripe.com/v1"
  })
});
const route = await resp.json();

Errors

StatusTypeDescription
400validation_errorMissing required fields or invalid environment
403plan_limitRoute limit reached for your subscription plan
409conflictA route with this name already exists