# WebSocketApiKeySelectionExpression

Represents the currently available API Key Selection Expressions.

- 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#L38)
- Type last changed: v2.112.0 · 1 Dec 2023

## Example

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

## Initializer

```ts
new WebSocketApiKeySelectionExpression(customApiKeySelector: string)
```

## Properties

- `AUTHORIZER_USAGE_IDENTIFIER_KEY`: [WebSocketApiKeySelectionExpression](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApiKeySelectionExpression.html) (static) — The API will extract the key value from the `usageIdentifierKey` attribute in the `context` map, returned by the Lambda Authorizer.

  See https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html

- `customApiKeySelector`: string — The expression used by API Gateway.

- `HEADER_X_API_KEY`: [WebSocketApiKeySelectionExpression](/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.WebSocketApiKeySelectionExpression.html) (static) — The API will extract the key value from the `x-api-key` header in the user request.
