# WebSocketApiProps

Props for WebSocket API.

Extends: WebSocketApiProps
Used as props by: WebSocketApi

- Source: [`aws-apigatewayv2/lib/websocket/api.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-apigatewayv2/lib/websocket/api.ts#L60)
- Type last changed: v2.216.0 · 22 Sep 2025

## Example

```ts
const webSocketApi = new apigwv2.WebSocketApi(this, 'mywsapi',{
  apiKeySelectionExpression: apigwv2.WebSocketApiKeySelectionExpression.HEADER_X_API_KEY,
});
```

## Properties

- `apiKeySelectionExpression`: [WebSocketApiKeySelectionExpression](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApiKeySelectionExpression.html) — An API key selection expression.

  **Default:** Key is not required to access these APIs

  Providing this option will require an API Key be provided to access the API.

- `apiName`: string — Name for the WebSocket API resource.

  **Default:** id of the WebSocketApi construct.

- `connectRouteOptions`: [WebSocketRouteOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketRouteOptions.html) — Options to configure a '$connect' route.

  **Default:** no '$connect' route configured

- `defaultRouteOptions`: [WebSocketRouteOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketRouteOptions.html) — Options to configure a '$default' route.

  **Default:** no '$default' route configured

- `description`: string = none — The description of the API.

- `disableSchemaValidation`: boolean = false — Avoid validating models when creating a deployment.

- `disconnectRouteOptions`: [WebSocketRouteOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketRouteOptions.html) — Options to configure a '$disconnect' route.

  **Default:** no '$disconnect' route configured

- `ipAddressType`: [IpAddressType](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.IpAddressType.html) — The IP address types that can invoke the API.

  **Default:** undefined - AWS default is IPV4

- `routeSelectionExpression`: string = '$request.body.action' — The route selection expression for the API.
