API Gateway

Serverless API Gateway

Ship public HTTP APIs and webhooks on serverless functions with route-level auth, path parameters, CORS, and rate limits — no separate ingress layer to deploy or maintain.

Publish HTTPS routes that map straight to functions, apply policies per path, and go live at /gw/{workspace}/{path} — no extra gateway deploy, no DNS cutover.

  • For APIs — define paths and HTTP methods, set per-route auth (none, API key, or Bearer) and CORS rules, and read path parameters like /users/:id directly in your handler.
  • For webhooks — every route gets a stable public URL on your workspace, ingress auth you control, and the same function handoff model as the rest of your HTTP surface.
  • For agent tools — expose one HTTPS route per tool or action, backed by the same serverless deploys, secrets, and observability as every other gateway route.

Related guides and docs

Get started free

How serverless API routing works

1

Define a route

Map any HTTP method and path to a function, including wildcards and path parameters like /users/:id.

2

Set authentication

Pick none, API key, or Bearer token auth for each route — every route carries its own policy.

3

Go live instantly

Your route is available at /gw/{workspace}/{path} the moment you save it — no deploy step, no DNS changes.

API gateway features for APIs and webhooks

Path parameters

Declare /users/:id and read event.pathParameters.id in your handler; wildcard routes like /admin/* work too.

Rate limiting

Protect your functions from abuse by capping requests per minute on each route.

CORS configuration

Set allowed origins and headers per route, so every endpoint gets exactly the CORS policy it needs.

Any HTTP method

Route GET, POST, PUT, DELETE independently — or use ANY to catch them all.

Example route config and function handler

create-route.json
// CreateApiRouteInput (gateway UI or API)
{
  "method": "POST",
  "path": "/users",
  "functionId": "create-user",
  "authType": "api-key",
  "rateLimit": 100,
  "corsEnabled": true,
  "corsOrigins": ["https://myapp.com"]
}
create-user/index.js
export async function handler(event, context) {
  const payload = typeof event.body === 'string' ? JSON.parse(event.body || '{}') : (event || {});
  const { name, email } = payload;
  if (!name) {
    return { statusCode: 400, body: JSON.stringify({ error: 'name required' }) };
  }
  const user = await db.users.create({ name, email });

  return {
    statusCode: 201,
    body: JSON.stringify(user),
  };
}

Get started free

Deploy your first function in minutes. No credit card required.

Get started free