Getting Started with API Gateway - Agent
API Gateway tutorialLocal with an AI agent
Build an API gateway that forwards requests to a sample backend and applies policies to each request.
Follow along using
Put a managed gateway in front of any REST API. This path builds it with an AI coding agent.
Create your project
Requirements
Node.js 24.0.0 or higher, a Zuplo account, and an installed coding agent.
-
Create a local and hosted project
Run:
CodeWhen prompted, choose Yes to create a matching Portal project, complete sign-in, and select your Zuplo account. Select the coding agent you use when asked. The CLI creates a project in the Portal and links your local
example-projectdirectory to its working copy. The hosted project stores the API key consumers and receives your deployment. If the CLI reports that project creation failed, runnpx zuplo project create --name example-projectfrom this directory. If linking failed, or after creating the hosted project, runnpx zuplo linkand select its working copy before continuing.Zuplo skills
The scaffold installs Zuplo skills in this project for Codex and Cursor and configures the Claude Code plugin. If setup fails, follow Agent Skills from this directory before starting your agent. The project's
.mcp.jsonalso configures the Zuplo docs MCP server. -
Start the gateway
CodeLeave this running. The agent edits
config/andmodules/, and the dev server hot-reloads.
Hand it to the agent
One prompt covers the whole editor tutorial - forwarding, rate limiting, API key authentication, and dynamic limits. Paste it into Claude Code, Cursor, or Codex from inside your project directory.
-
Copy the prompt
Code -
Review what it changed
Expect edits to
config/routes.oas.json,config/policies.json, a newmodules/rate-limit.ts, and.env.zuplo. Open the local Route Designer at http://localhost:9100 to see the policies on each route.Ask the agent to explain any policy option you do not recognize. It has the policy reference in
node_modules/zuplo/docs/policies/.
Create an API key and test
The API key policy rejects everything until a consumer exists. Consumers live in the Zuplo Portal, not in code.
-
Create two consumers
In the portal, open Services › API Keys › Consumers › Create Consumer. Create
free-consumerwith metadata{ "customerType": "free" }andpremium-consumerwith{ "customerType": "premium" }.Select the environment your local project is linked to with the Dev / Preview / Prod switcher. With a single environment, pick Prod.
-
Test both limits
CodeReplace
FREE_CONSUMER_KEYandPREMIUM_CONSUMER_KEYwith the keys from the Portal. The premium request should succeed; its limit is 1000 requests per minute, so a single request doesn't test the threshold.
Deploy
Zuplo deploys from Git. The agent can do the push; the connection happens in the portal.
-
Ask the agent to push
Code -
Connect the repository in Zuplo
CodeOpen the source-control link from the output, or Settings › Source Control in the portal. Click Connect to GitHub, then Connect on your repository. Zuplo deploys
mainimmediately. Runzuplo infoagain to confirm.Branch environments
Every branch you push gets its own isolated environment. See Branch-Based Deployments.
Wrapping up
You have built an API protected by API key authentication, dynamically rate limited, deployed to the edge, and documented in your developer portal - with an agent doing the configuration while you reviewed each change.
Next steps
- Customize your developer portal or explore integrations
- Grab time with the Zuplo team
- Start generating revenue with the monetization tutorial