# CfnRouteProps

Properties for defining a `CfnRoute`.

Extends: CfnRouteProps
Used as props by: CfnRoute

- Source: Generated code
- Type last changed: v2.227.0 · 21 Nov 2025

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigatewayv2 as apigatewayv2 } from 'aws-cdk-lib';

declare const requestModels: any;
declare const requestParameters: any;
const cfnRouteProps: apigatewayv2.CfnRouteProps = {
  apiId: 'apiId',
  routeKey: 'routeKey',

  // the properties below are optional
  apiKeyRequired: false,
  authorizationScopes: ['authorizationScopes'],
  authorizationType: 'authorizationType',
  authorizerId: 'authorizerId',
  modelSelectionExpression: 'modelSelectionExpression',
  operationName: 'operationName',
  requestModels: requestModels,
  requestParameters: requestParameters,
  routeResponseSelectionExpression: 'routeResponseSelectionExpression',
  target: 'target',
};
```

## Properties

- `apiId`: string | [IApiRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_apigatewayv2.IApiRef.html) (required) — The API identifier.

- `apiKeyRequired`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Specifies whether an API key is required for the route.

  Supported only for WebSocket APIs.

- `authorizationScopes`: string[] — The authorization scopes supported by this route.

- `authorizationType`: string — The authorization type for the route.

  For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer.

- `authorizerId`: string | [IAuthorizerRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_apigatewayv2.IAuthorizerRef.html) — The identifier of the `Authorizer` resource to be associated with this route.

  The authorizer identifier is generated by API Gateway when you created the authorizer.

- `modelSelectionExpression`: string — The model selection expression for the route.

  Supported only for WebSocket APIs.

- `operationName`: string — The operation name for the route.

- `requestModels`: any — The request models for the route.

  Supported only for WebSocket APIs.

- `requestParameters`: any — The request parameters for the route.

  Supported only for WebSocket APIs.

- `routeKey`: string (required) — The route key for the route.

  For HTTP APIs, the route key can be either `$default` , or a combination of an HTTP method and resource path, for example, `GET /pets` .

- `routeResponseSelectionExpression`: string — The route response selection expression for the route.

  Supported only for WebSocket APIs.

- `target`: string | [IIntegrationRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_apigatewayv2.IIntegrationRef.html) — The target for the route.
