# RateLimitedApiKeyProps

RateLimitedApiKey properties.

Extends: [ApiKeyProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.ApiKeyProps.html)
Used as props by: [RateLimitedApiKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.RateLimitedApiKey.html)

- 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#L207)
- Type last changed: v2.212.0 · 20 Aug 2025

## Example

TypeScript:

```ts
declare const api: apigwv2.WebSocketApi;
declare const stage: apigwv2.WebSocketStage;

const key = new apigwv2.RateLimitedApiKey(this, 'rate-limited-api-key', {
  customerId: 'test-customer',
  apiStages: [{
    api: api,
    stage: stage
  }],
  quota: {
    limit: 10000,
    period: apigwv2.Period.MONTH
  },
  throttle: {
    rateLimit: 100,
    burstLimit: 200
  }
});
```

Python:

```python
# api: apigwv2.WebSocketApi
# stage: apigwv2.WebSocketStage

key = apigwv2.RateLimitedApiKey(self, "rate-limited-api-key",
    customer_id="test-customer",
    api_stages=[apigwv2.UsagePlanPerApiStage(
        api=api,
        stage=stage
    )],
    quota=apigwv2.QuotaSettings(
        limit=10000,
        period=apigwv2.Period.MONTH
    ),
    throttle=apigwv2.ThrottleSettings(
        rate_limit=100,
        burst_limit=200
    )
)
```

Java:

```java
WebSocketApi api;
WebSocketStage stage;

RateLimitedApiKey key = RateLimitedApiKey.Builder.create(this, "rate-limited-api-key")
        .customerId("test-customer")
        .apiStages(List.of(UsagePlanPerApiStage.builder()
                .api(api)
                .stage(stage)
                .build()))
        .quota(QuotaSettings.builder()
                .limit(10000)
                .period(Period.MONTH)
                .build())
        .throttle(ThrottleSettings.builder()
                .rateLimit(100)
                .burstLimit(200)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
WebSocketApi api;
WebSocketStage stage;

var key = new RateLimitedApiKey(this, "rate-limited-api-key", new RateLimitedApiKeyProps {
    CustomerId = "test-customer",
    ApiStages = new [] { new UsagePlanPerApiStage {
        Api = api,
        Stage = stage
    } },
    Quota = new QuotaSettings {
        Limit = 10000,
        Period = Period.MONTH
    },
    Throttle = new ThrottleSettings {
        RateLimit = 100,
        BurstLimit = 200
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var api WebSocketApi
var stage WebSocketStage

key := apigwv2.NewRateLimitedApiKey(this, jsii.String("rate-limited-api-key"), &RateLimitedApiKeyProps{
	CustomerId: jsii.String("test-customer"),
	ApiStages: []UsagePlanPerApiStage{
		&UsagePlanPerApiStage{
			Api: api,
			Stage: stage,
		},
	},
	Quota: &QuotaSettings{
		Limit: jsii.Number(10000),
		Period: apigwv2.Period_MONTH,
	},
	Throttle: &ThrottleSettings{
		RateLimit: jsii.Number(100),
		BurstLimit: jsii.Number(200),
	},
})
```

## 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.

- `apiStages`: [UsagePlanPerApiStage](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.UsagePlanPerApiStage.html)[] = none — API Stages to be associated with the RateLimitedApiKey.

- `customerId`: string = none — An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.

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

- `enabled`: boolean = true — Indicates whether the API key can be used by clients.

- `generateDistinctId`: boolean = false — Specifies whether the key identifier is distinct from the created API key value.

- `quota`: [QuotaSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.QuotaSettings.html) = none — Number of requests clients can make in a given time period.

- `throttle`: [ThrottleSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.ThrottleSettings.html) = none — Overall throttle settings for the API.

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

  Must be at least 20 characters long.
