# AddApiKeyOptions

Options to the UsagePlan.addApiKey() method.

Used as argument in: [IUsagePlan.addApiKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.IUsagePlan.html#addapikey)

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

## Example

TypeScript:

```ts
declare const usagePlan: apigwv2.UsagePlan;
declare const apiKey: apigwv2.ApiKey;

usagePlan.addApiKey(apiKey, {
 overrideLogicalId: 'MyCustomLogicalId',
});
```

Python:

```python
# usage_plan: apigwv2.UsagePlan
# api_key: apigwv2.ApiKey

usage_plan.add_api_key(api_key,
    override_logical_id="MyCustomLogicalId"
)
```

Java:

```java
UsagePlan usagePlan;
ApiKey apiKey;

usagePlan.addApiKey(apiKey, AddApiKeyOptions.builder()
        .overrideLogicalId("MyCustomLogicalId")
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
UsagePlan usagePlan;
ApiKey apiKey;

usagePlan.AddApiKey(apiKey, new AddApiKeyOptions {
    OverrideLogicalId = "MyCustomLogicalId"
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var usagePlan UsagePlan
var apiKey ApiKey

usagePlan.addApiKey(apiKey, &AddApiKeyOptions{
	OverrideLogicalId: jsii.String("MyCustomLogicalId"),
})
```

## Properties

- `overrideLogicalId`: string — Override the CloudFormation logical id of the AWS::ApiGateway::UsagePlanKey resource.

  **Default:** autogenerated by the CDK
