Embedded Routing Stack

Provision customers, routing policies, keys, budgets, and usage programmatically

The Embedded Routing API lets a platform built on Gateway provision each end customer as a Customer with its own routing policies, BYOK vendor keys, budgets, and usage. Attach one to a model request with the customer field on Create response or any SDK-compatible surface. Walkthrough: Embedded routing guide.

Base URL and authentication

https://api-gateway.merge.dev

Authenticate with the mg_ API key you send model requests with; the organization comes from the key.

Authorization: Bearer mg_...

Reference

Endpoints under /v1/customersWhat it covers
/, /{customer_id}Create, list, update, and delete customers
/{customer_id}/routing-policies, /{customer_id}/default-routing-policyThe customer’s routing policies and its default
/{customer_id}/keysThe customer’s BYOK vendor keys. See Customer keys.
/{customer_id}/api-keysCustomer API keys bound to one customer, up to 5 each
/{customer_id}/budgetsThe customer’s budgets
/{customer_id}/controls, /{customer_id}/modelsThe customer’s ZDR, vendor, and region controls, and the models it can route to
/{customer_id}/pi-settings, /{customer_id}/dlp-settingsPer-customer prompt injection and DLP overrides
/usage, /{customer_id}/usageSpend across customers or for one. See Usage.

A customer API key can call only routes for its own customer, and changing budgets, controls, or anything but its own name, deleting itself, or minting keys returns 403. Another customer’s ID returns 404. Errors use a detail object.

Next steps