ZuploZuplo
LoginStart for Free
  • Documentation
  • API Reference
Getting Started
Concepts
API Management
    Overview
    Getting Started
      1 - Set up a basic gateway
        2 - Add rate limiting
          3 - Add API key authentication
            4 - Deploy to the edge
              5 - Dynamic rate limiting
              API Keys
              Rate Limiting
              Caching
              GraphQL
              Monetization
              Policies
              Handlers
            AI Gateway
            MCP Gateway
            MCP Server
            Developer Portal
            Development
            Deploying & Source Control
            Analytics
            Observability
            Networking & Infrastructure
            Account Management
            Programming API
            Build with AI
            Zuplo CLI
            Migration Guides
            Platform LimitsVersion Support PolicySecuritySupportTrust & ComplianceChangelog
            powered by Zuplo
            API Management

            Getting Started with API Gateway - Agent

            1. Choose a productAPI Gateway
            2. Choose a workflowLocal with an AI agent
            3. 3Build and testFollow your tutorial

            API Gateway tutorial/Local with an AI agent

            Build an API gateway that forwards requests to a sample backend and applies policies to each request.

            Follow along using

            Zuplo PortalLocal with an editorLocal with an AI agent

            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.

            1. Create a local and hosted project

              Run:

              TerminalCode
              npx create-zuplo-api@latest example-project cd example-project

              When 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-project directory to its working copy. The hosted project stores the API key consumers and receives your deployment. If the CLI reports that project creation failed, run npx zuplo project create --name example-project from this directory. If linking failed, or after creating the hosted project, run npx zuplo link and 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.json also configures the Zuplo docs MCP server.

            2. Start the gateway

              TerminalCode
              npm run dev

              Leave this running. The agent edits config/ and modules/, 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.

            1. Copy the prompt

              Code
              Read this project's agent instructions and the bundled docs in node_modules/zuplo/docs before writing code. Build a Zuplo API gateway in this project: 1. Keep the default todo routes in config/routes.oas.json, but forward them to ${env.BASE_URL} and add BASE_URL=https://echo.zuplo.io to .env.zuplo. 2. Add the rate-limiting inbound policy (rateLimitBy: ip, 2 requests / 1 minute) to every route. 3. Add the api-key-inbound policy to every route, ordered before rate limiting. 4. Make rate limiting dynamic: create modules/rate-limit.ts exporting rateLimit() that returns 1000 req/min for user.data.customerType === "premium", 5 for "free", 30 otherwise, and switch the policy to rateLimitBy: "function". 5. Use the already-running dev server to verify with curl that GET /todos returns 401 without a key. I will create the free and premium keys in the Portal afterward; leave key-based tests for me. Explain each config change in one line and stop before pushing to git.
            2. Review what it changed

              Expect edits to config/routes.oas.json, config/policies.json, a new modules/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.

            1. Create two consumers

              In the portal, open Services › API Keys › Consumers › Create Consumer. Create free-consumer with metadata { "customerType": "free" } and premium-consumer with { "customerType": "premium" }.

              Select the environment your local project is linked to with the Dev / Preview / Prod switcher. With a single environment, pick Prod.

            2. Test both limits

              TerminalCode
              # no key -> 401 curl -i http://localhost:9000/todos # free key -> 429 on the 6th request within one minute for i in 1 2 3 4 5 6; do curl -i http://localhost:9000/todos \ --header 'Authorization: Bearer FREE_CONSUMER_KEY' done # premium key -> 1000 requests per minute curl http://localhost:9000/todos \ --header 'Authorization: Bearer PREMIUM_CONSUMER_KEY'

              Replace FREE_CONSUMER_KEY and PREMIUM_CONSUMER_KEY with 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.

            1. Ask the agent to push

              Code
              Commit everything, create an empty GitHub repo called example-project with gh, add it as origin and push main.
            2. Connect the repository in Zuplo

              TerminalCode
              npx zuplo info

              Open 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 main immediately. Run zuplo info again 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
            On this page
            • Create your project
              • Create a local and hosted project
              • Start the gateway
            • Hand it to the agent
              • Copy the prompt
              • Review what it changed
            • Create an API key and test
              • Create two consumers
              • Test both limits
            • Deploy
              • Ask the agent to push
              • Connect the repository in Zuplo
            • Wrapping up
              • Next steps