# IRestApi

Extends: [IResource](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResource.html), [IRestApiRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_apigateway.IRestApiRef.html)
Implemented by: [LambdaRestApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.LambdaRestApi.html), [RestApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.RestApi.html), [RestApiBase](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.RestApiBase.html), [SpecRestApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.SpecRestApi.html), StepFunctionsRestApi
Obtainable from: [RestApi.fromRestApiAttributes](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.RestApi.html#fromrestapiattributes), [RestApi.fromRestApiId](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.RestApi.html#fromrestapiid)
Used as argument in: [ApiGateway (initializer)](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events_targets.ApiGateway.html#initializer), [ApiGatewayEnrichment (initializer)](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-enrichments-alpha.ApiGatewayEnrichment.html#initializer), ApiGatewayTarget (initializer)

- Source: [`aws-apigateway/lib/restapi.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-apigateway/lib/restapi.ts#L44)
- Type last changed: v2.224.0 · 13 Nov 2025

## Properties

- `deploymentStage`: [Stage](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.Stage.html) — API Gateway stage that points to the latest deployment (if defined).

- `env`: [ResourceEnvironment](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `latestDeployment`: [Deployment](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.Deployment.html) — API Gateway deployment that represents the latest changes of the API.

  This resource will be automatically updated every time the REST API model changes.
  `undefined` when no deployment is configured.

- `node`: [Node](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `restApiId`: string — The ID of this API Gateway RestApi.

- `restApiName`: string — The name of this API Gateway RestApi.

- `restApiRef`: [RestApiReference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_apigateway.RestApiReference.html) — A reference to a RestApi resource.

- `restApiRootResourceId`: string — The resource ID of the root resource.

- `root`: [IResource](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.IResource.html) — Represents the root resource ("/") of this API. Use it to define the API model:.

  api.root.addMethod('ANY', redirectToHomePage); // "ANY /"
     api.root.addResource('friends').addMethod('GET', getFriendsHandler); // "GET /friends"

- `stack`: [Stack](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

## Methods

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `arnForExecuteApi(method?: string, path?: string, stage?: string): string` — Gets the "execute-api" ARN.

  **Parameters**

  - `method` — The method (default `*`).
  - `path` — The resource path.
  - `stage` — The stage (default `*`).

  **Returns:** The "execute-api" ARN.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
