WHAT YOU'LL LEARN
  • every Api.* extension and the props it accepts

Overview
anchor

Api.* extensions customize the API Lambda — loading custom code, registering HTTP routes, and passing build-time parameters into the bundle.

Api.Extension
anchor

Registers a custom extension on the API Lambda (GraphQL schema factories, event handlers, use cases, etc.).

PropTypeRequiredDescription
srcstringYesPath to the extension file
exportNamestringNoExport name to use. Defaults to the filename without extension.

Can be used multiple times.

Api.Route
anchor

Registers a custom HTTP route on the API Gateway and GraphQL Lambda. See Add Custom API Routes for a full guide.

PropTypeRequiredDescription
pathstringYesRoute path, must start with /. Use {paramName} for path parameters.
methodstringYesHTTP method: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, or ANY
srcstringYesPath to the route handler file, including the .ts extension
routeNamestringNoPulumi resource name (kebab-case). Auto-derived from path and method if omitted.

Can be used multiple times.

Adding or removing a route requires yarn webiny deploy api — route registration modifies API Gateway configuration.

Api.BuildParam
anchor

Passes a build-time parameter into the API Lambda bundle, accessible via BuildParams at runtime.

PropTypeRequiredDescription
paramNamestringYesParameter name
valuestring \| number \| boolean \| object \| arrayYesParameter value

Can be used multiple times.