# BasePathMappingProps

Extends: BasePathMappingProps
Extends: BasePathMappingOptions
Used as props by: BasePathMapping

- Source: [`aws-apigateway/lib/base-path-mapping.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-apigateway/lib/base-path-mapping.ts#L39)
- Type last changed: v2.224.0 · 13 Nov 2025

## Example

```ts
declare const api: apigateway.RestApi;

const domainName = apigateway.DomainName.fromDomainNameAttributes(this, 'DomainName', {
  domainName: 'domainName',
  domainNameAliasHostedZoneId: 'domainNameAliasHostedZoneId',
  domainNameAliasTarget: 'domainNameAliasTarget',
});

new apigateway.BasePathMapping(this, 'BasePathMapping', {
  domainName: domainName,
  restApi: api,
});
```

## Properties

- `attachToStage`: boolean = true — Whether to attach the base path mapping to a stage.

  Use this property to create a base path mapping without attaching it to the Rest API default stage.
  This property is ignored if `stage` is provided.

- `basePath`: string — The base path name that callers of the API must provide in the URL after the domain name (e.g. `example.com/base-path`). If you specify this property, it can't be an empty string.

  **Default:** map requests from the domain root (e.g. `example.com`). If this is undefined, no additional mappings will be allowed on this domain name.

- `domainName`: [IDomainNameRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_apigateway.IDomainNameRef.html) (required) — The DomainName to associate with this base path mapping.

- `restApi`: [IRestApiRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_apigateway.IRestApiRef.html) (required) — The RestApi resource to target.

- `stage`: [Stage](/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.Stage.html) — The Deployment stage of API [disable-awslint:ref-via-interface].

  **Default:** map to deploymentStage of restApi otherwise stage needs to pass in URL
