# StageOptions

Struct · Stable

Options required to create a new stage.

Options that are common between HTTP and Websocket APIs.

- Source: [`aws-apigatewayv2/lib/common/stage.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-apigatewayv2/lib/common/stage.ts#L61)
- Type last changed: v2.204.0 · 4 Jul 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';
import { aws_apigatewayv2 as interfaces_apigatewayv2 } from 'aws-cdk-lib/interfaces';

declare const accessLogSettings: apigatewayv2.IAccessLogSettings;
declare const domainNameRef: interfaces_apigatewayv2.IDomainNameRef;
const stageOptions: apigatewayv2.StageOptions = {
  accessLogSettings: accessLogSettings,
  autoDeploy: false,
  description: 'description',
  detailedMetricsEnabled: false,
  domainMapping: {
    domainName: domainNameRef,

    // the properties below are optional
    mappingKey: 'mappingKey',
  },
  stageVariables: {
    stageVariablesKey: 'stageVariables',
  },
  throttle: {
    burstLimit: 123,
    rateLimit: 123,
  },
};
```

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
from aws_cdk.interfaces import aws_apigatewayv2 as interfaces_apigatewayv2

# access_log_settings: apigatewayv2.IAccessLogSettings
# domain_name_ref: interfaces_apigatewayv2.IDomainNameRef

stage_options = apigatewayv2.StageOptions(
    access_log_settings=access_log_settings,
    auto_deploy=False,
    description="description",
    detailed_metrics_enabled=False,
    domain_mapping=apigatewayv2.DomainMappingOptions(
        domain_name=domain_name_ref,

        # the properties below are optional
        mapping_key="mappingKey"
    ),
    stage_variables={
        "stage_variables_key": "stageVariables"
    },
    throttle=apigatewayv2.ThrottleSettings(
        burst_limit=123,
        rate_limit=123
    )
)
```

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.*;
import software.amazon.awscdk.interfaces.apigatewayv2.*;

IAccessLogSettings accessLogSettings;
IDomainNameRef domainNameRef;

StageOptions stageOptions = StageOptions.builder()
        .accessLogSettings(accessLogSettings)
        .autoDeploy(false)
        .description("description")
        .detailedMetricsEnabled(false)
        .domainMapping(DomainMappingOptions.builder()
                .domainName(domainNameRef)

                // the properties below are optional
                .mappingKey("mappingKey")
                .build())
        .stageVariables(Map.of(
                "stageVariablesKey", "stageVariables"))
        .throttle(ThrottleSettings.builder()
                .burstLimit(123)
                .rateLimit(123)
                .build())
        .build();
```

C#:

```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;
using Amazon.CDK.Interfaces.Apigatewayv2;

IAccessLogSettings accessLogSettings;
IDomainNameRef domainNameRef;

var stageOptions = new StageOptions {
    AccessLogSettings = accessLogSettings,
    AutoDeploy = false,
    Description = "description",
    DetailedMetricsEnabled = false,
    DomainMapping = new DomainMappingOptions {
        DomainName = domainNameRef,

        // the properties below are optional
        MappingKey = "mappingKey"
    },
    StageVariables = new Dictionary<string, string> {
        { "stageVariablesKey", "stageVariables" }
    },
    Throttle = new ThrottleSettings {
        BurstLimit = 123,
        RateLimit = 123
    }
};
```

Go:

```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"
import "github.com/aws/aws-cdk-go/awscdk"

var accessLogSettings IAccessLogSettings
var domainNameRef IDomainNameRef

stageOptions := &StageOptions{
	AccessLogSettings: accessLogSettings,
	AutoDeploy: jsii.Boolean(false),
	Description: jsii.String("description"),
	DetailedMetricsEnabled: jsii.Boolean(false),
	DomainMapping: &DomainMappingOptions{
		DomainName: domainNameRef,

		// the properties below are optional
		MappingKey: jsii.String("mappingKey"),
	},
	StageVariables: map[string]*string{
		"stageVariablesKey": jsii.String("stageVariables"),
	},
	Throttle: &ThrottleSettings{
		BurstLimit: jsii.Number(123),
		RateLimit: jsii.Number(123),
	},
}
```

## Properties

- `accessLogSettings`: [IAccessLogSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.IAccessLogSettings.html) — Settings for access logging.

  **Default:** No access logging

- `autoDeploy`: boolean = false — Whether updates to an API automatically trigger a new deployment.

- `description`: string — The description for the API stage.

  **Default:** no description

- `detailedMetricsEnabled`: boolean = false — Specifies whether detailed metrics are enabled.

- `domainMapping`: [DomainMappingOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.DomainMappingOptions.html) — The options for custom domain and api mapping.

  **Default:** no custom domain and api mapping configuration

- `stageVariables`: { [key: string]: string } — Stage variables for the stage. These are key-value pairs that you can define and use in your API routes.

  **Default:** No stage variables

  The allowed characters for variable names and the required pattern for variable values are specified here: https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-apigateway-stage.html#cfn-apigateway-stage-variables

- `throttle`: [ThrottleSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.ThrottleSettings.html) — Throttle settings for the routes of this stage.

  **Default:** no throttling configuration
