ZuploZuplo
LoginStart for Free
  • Documentation
  • API Reference
Introduction
Getting Started
    Develop on the web portal
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth4 - Deploy5 - Dynamic Rate LimitingDynamic MCP Server - Quickstart
    Develop locally with the CLI
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth4 - Deploy5 - Dynamic Rate LimitingDynamic MCP Server - Quickstart
Concepts
    How Zuplo WorksRequest LifecycleProject StructureAuthenticationAPI KeysRate LimitingAPI ErrorsRoutingPolicy FundamentalsOpenAPIEnvironmentsSource Control and DeploymentDevelopment Options
Development
Policies
Handlers
API Keys
MCP Server
MCP Gateway
AI Gateway
Developer Portal
Monetization
Deploying & Source Control
Observability
Networking & Infrastructure
Account Management
Programming API
Build with AI
Zuplo CLI
Migration Guides
Platform LimitsSecuritySupportTrust & ComplianceChangelog
powered by Zudoku
Concepts

Request Lifecycle

Every request that reaches Zuplo passes through a well-defined pipeline of stages. Click any stage below to learn what it does, when to use it, and find relevant documentation.

Client Request

Pre-Routing Hooks

Global

When to use

Modify the request URL or headers before Zuplo decides which route handles it. Common for URL normalization, API version routing, or trailing-slash cleanup.

How it works

Receives a standard Request and returns a (possibly modified) Request.

Register with runtime.addPreRoutingHook() in your zuplo.runtime.ts file.

Learn more

Runtime Extensions →Register global hooks and pluginsHooks Reference →All hook types and execution order
Client Response
Client Request
Client Response

Pre-Routing Hooks

Global

When to use

Modify the request URL or headers before Zuplo decides which route handles it. Common for URL normalization, API version routing, or trailing-slash cleanup.

How it works

Receives a standard Request and returns a (possibly modified) Request.

Register with runtime.addPreRoutingHook() in your zuplo.runtime.ts file.

Learn more

Runtime Extensions →Register global hooks and pluginsHooks Reference →All hook types and execution order

Short-circuiting

At several stages, the pipeline can be short-circuited by returning a Response instead of passing the request through:

  • Pre-routing hooks can return a Response to skip routing entirely
  • Request hooks can return a Response to skip policies and the handler
  • Inbound policies can return a Response (e.g., 401 Unauthorized) to skip the handler and outbound policies

This is how authentication policies work: they check credentials and return an error response if the request is not authorized, preventing it from reaching your backend.

Choosing the right extension point

Use a policy when you need reusable logic that applies to multiple routes. Policies are configured per-route in your OpenAPI spec and can be shared across any number of routes. Examples: authentication, rate limiting, request validation, header manipulation.

Use a handler when you need to define the core behavior of a route - forwarding to a backend, generating a response, or implementing business logic. Each route has exactly one handler.

Use a hook when you need logic that runs on every request globally, regardless of route. Examples: adding correlation IDs, security headers, logging, analytics.

I want to...Use
Authenticate requestsInbound policy
Rate limit requestsInbound policy
Validate request bodiesInbound policy
Forward to a backendURL Forward Handler
Return custom responsesFunction Handler
Transform response bodiesOutbound policy
Add headers to all responsesResponse hook
Log every requestResponse final hook
Normalize URLs before routingPre-routing hook
Edit this page
Last modified on March 27, 2026
How Zuplo WorksProject Structure
On this page
  • Short-circuiting
  • Choosing the right extension point