# ApiKeyOptions

The options for creating an API Key.

- Source: [`aws-apigatewayv2/lib/websocket/api-key.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-apigatewayv2/lib/websocket/api-key.ts#L36)
- Type last changed: v2.212.0 · 20 Aug 2025

## Example

TypeScript:

```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';
const apiKeyOptions: apigatewayv2.ApiKeyOptions = {
  apiKeyName: 'apiKeyName',
  description: 'description',
  value: 'value',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_apigatewayv2 as apigatewayv2

api_key_options = apigatewayv2.ApiKeyOptions(
    api_key_name="apiKeyName",
    description="description",
    value="value"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apigatewayv2.*;

ApiKeyOptions apiKeyOptions = ApiKeyOptions.builder()
        .apiKeyName("apiKeyName")
        .description("description")
        .value("value")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Apigatewayv2;

var apiKeyOptions = new ApiKeyOptions {
    ApiKeyName = "apiKeyName",
    Description = "description",
    Value = "value"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

apiKeyOptions := &ApiKeyOptions{
	ApiKeyName: jsii.String("apiKeyName"),
	Description: jsii.String("description"),
	Value: jsii.String("value"),
}
```

## Properties

- `apiKeyName`: string — A name for the API key.

  **Default:** automatically generated name

  If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the API key name.

- `description`: string = none — A description of the purpose of the API key.

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

  Must be at least 20 characters long.
