https://your-api.jojapi.net.
APIs are moving to the edge gateway, where every API runs as its own Worker. The Worker tab of an API on the edge shows the template described here. APIs still on the classic gateway use the previous Target form and its template expressions; they will be moved over time. The My APIs list shows which gateway serves each API: Classic (not moved yet), Template (edge gateway, Worker generated from the template) or Code (edge gateway, your own Worker code).
The template
Origins: one or more base URLs including any path prefix, e.g.https://api.example.com/v2. The consumer’s path and query string are appended as they are: /users/42?x=1 reaches https://api.example.com/v2/users/42?x=1. With several origins a request goes to one of them at random and moves on to the next when the first does not answer (network error or timeout), which gives you simple load balancing and failover. IP addresses and non-standard ports work too; such requests leave through the platform’s egress relay, so the gateway’s published IP addresses stay valid for your allowlists. A variable may stand in for the host: https://{env.HOST}.
HTTP method: the consumer’s method, or an override.
Timeout: up to 90 seconds per origin (the platform’s maximum).
Request headers and query parameters: add or overwrite values (a header can also be removed from the forwarded request). Values accept placeholders.
Switches:
- Forward the consumer’s headers — off means only the headers you set reach the origin.
- Forward the consumer’s query string — off means only the parameters you set are sent.
- Consumer context headers — sends
x-jojapi-user-id,x-jojapi-user-nick,x-jojapi-user-planandx-jojapi-endpoint-creditsto the origin, the way the classic gateway did.
Beyond the template
Different origins or paths per endpoint, response rewrites, request body transformations, several upstream calls per request, or usage computed from the response body are matters of code. View generated code shows the Worker the template produces; Edit code takes it over. APIs moved from the classic gateway with endpoint-specific targets arrive in code mode already, with generated code that behaves exactly like their classic targets did. See Worker code.Placeholders
Header values and query parameters interpolate{placeholder} values from the request and the consumer’s account:
The Vars button on each field lists them, including your variables.
Variables
Variables are named values bound to your API’s Worker. Use them for anything you would rather not type into the template: upstream API keys, tokens, a proxy URL.- Secret variables are encrypted at rest and never shown again after you save them. To rotate one, save a new value under the same name.
- Plain variables are shown in Studio; use them for non-sensitive settings such as a region or a version.
{env.NAME} in the template, or read env.NAME in code. Names use capital letters, digits and underscores, for example UPSTREAM_API_KEY.
