1. Packages
  2. AWS Cloud Control
  3. API Docs
  4. apigatewayv2
  5. getApi

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.27.0 published on Monday, Apr 14, 2025 by Pulumi

aws-native.apigatewayv2.getApi

Explore with Pulumi AI

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.27.0 published on Monday, Apr 14, 2025 by Pulumi

The AWS::ApiGatewayV2::Api resource creates an API. WebSocket APIs and HTTP APIs are supported. For more information about WebSocket APIs, see About WebSocket APIs in API Gateway in the API Gateway Developer Guide. For more information about HTTP APIs, see HTTP APIs in the API Gateway Developer Guide.

Using getApi

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getApi(args: GetApiArgs, opts?: InvokeOptions): Promise<GetApiResult>
function getApiOutput(args: GetApiOutputArgs, opts?: InvokeOptions): Output<GetApiResult>
Copy
def get_api(api_id: Optional[str] = None,
            opts: Optional[InvokeOptions] = None) -> GetApiResult
def get_api_output(api_id: Optional[pulumi.Input[str]] = None,
            opts: Optional[InvokeOptions] = None) -> Output[GetApiResult]
Copy
func LookupApi(ctx *Context, args *LookupApiArgs, opts ...InvokeOption) (*LookupApiResult, error)
func LookupApiOutput(ctx *Context, args *LookupApiOutputArgs, opts ...InvokeOption) LookupApiResultOutput
Copy

> Note: This function is named LookupApi in the Go SDK.

public static class GetApi 
{
    public static Task<GetApiResult> InvokeAsync(GetApiArgs args, InvokeOptions? opts = null)
    public static Output<GetApiResult> Invoke(GetApiInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetApiResult> getApi(GetApiArgs args, InvokeOptions options)
public static Output<GetApiResult> getApi(GetApiArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws-native:apigatewayv2:getApi
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ApiId This property is required. string
The API identifier.
ApiId This property is required. string
The API identifier.
apiId This property is required. String
The API identifier.
apiId This property is required. string
The API identifier.
api_id This property is required. str
The API identifier.
apiId This property is required. String
The API identifier.

getApi Result

The following output properties are available:

ApiEndpoint string
The default endpoint for an API. For example: https://abcdef.execute-api.us-west-2.amazonaws.com .
ApiId string
The API identifier.
ApiKeySelectionExpression string
An API key selection expression. Supported only for WebSocket APIs. See API Key Selection Expressions.
CorsConfiguration Pulumi.AwsNative.ApiGatewayV2.Outputs.ApiCors
A CORS configuration. Supported only for HTTP APIs. See Configuring CORS for more information.
Description string
The description of the API.
DisableExecuteApiEndpoint bool
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint.
Name string
The name of the API. Required unless you specify an OpenAPI definition for Body or S3BodyLocation.
RouteSelectionExpression string
The route selection expression for the API. For HTTP APIs, the routeSelectionExpression must be ${request.method} ${request.path}. If not provided, this will be the default for HTTP APIs. This property is required for WebSocket APIs.
Tags Dictionary<string, string>
The collection of tags. Each tag element is associated with a given resource.
Version string
A version identifier for the API.
ApiEndpoint string
The default endpoint for an API. For example: https://abcdef.execute-api.us-west-2.amazonaws.com .
ApiId string
The API identifier.
ApiKeySelectionExpression string
An API key selection expression. Supported only for WebSocket APIs. See API Key Selection Expressions.
CorsConfiguration ApiCors
A CORS configuration. Supported only for HTTP APIs. See Configuring CORS for more information.
Description string
The description of the API.
DisableExecuteApiEndpoint bool
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint.
Name string
The name of the API. Required unless you specify an OpenAPI definition for Body or S3BodyLocation.
RouteSelectionExpression string
The route selection expression for the API. For HTTP APIs, the routeSelectionExpression must be ${request.method} ${request.path}. If not provided, this will be the default for HTTP APIs. This property is required for WebSocket APIs.
Tags map[string]string
The collection of tags. Each tag element is associated with a given resource.
Version string
A version identifier for the API.
apiEndpoint String
The default endpoint for an API. For example: https://abcdef.execute-api.us-west-2.amazonaws.com .
apiId String
The API identifier.
apiKeySelectionExpression String
An API key selection expression. Supported only for WebSocket APIs. See API Key Selection Expressions.
corsConfiguration ApiCors
A CORS configuration. Supported only for HTTP APIs. See Configuring CORS for more information.
description String
The description of the API.
disableExecuteApiEndpoint Boolean
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint.
name String
The name of the API. Required unless you specify an OpenAPI definition for Body or S3BodyLocation.
routeSelectionExpression String
The route selection expression for the API. For HTTP APIs, the routeSelectionExpression must be ${request.method} ${request.path}. If not provided, this will be the default for HTTP APIs. This property is required for WebSocket APIs.
tags Map<String,String>
The collection of tags. Each tag element is associated with a given resource.
version String
A version identifier for the API.
apiEndpoint string
The default endpoint for an API. For example: https://abcdef.execute-api.us-west-2.amazonaws.com .
apiId string
The API identifier.
apiKeySelectionExpression string
An API key selection expression. Supported only for WebSocket APIs. See API Key Selection Expressions.
corsConfiguration ApiCors
A CORS configuration. Supported only for HTTP APIs. See Configuring CORS for more information.
description string
The description of the API.
disableExecuteApiEndpoint boolean
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint.
name string
The name of the API. Required unless you specify an OpenAPI definition for Body or S3BodyLocation.
routeSelectionExpression string
The route selection expression for the API. For HTTP APIs, the routeSelectionExpression must be ${request.method} ${request.path}. If not provided, this will be the default for HTTP APIs. This property is required for WebSocket APIs.
tags {[key: string]: string}
The collection of tags. Each tag element is associated with a given resource.
version string
A version identifier for the API.
api_endpoint str
The default endpoint for an API. For example: https://abcdef.execute-api.us-west-2.amazonaws.com .
api_id str
The API identifier.
api_key_selection_expression str
An API key selection expression. Supported only for WebSocket APIs. See API Key Selection Expressions.
cors_configuration ApiCors
A CORS configuration. Supported only for HTTP APIs. See Configuring CORS for more information.
description str
The description of the API.
disable_execute_api_endpoint bool
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint.
name str
The name of the API. Required unless you specify an OpenAPI definition for Body or S3BodyLocation.
route_selection_expression str
The route selection expression for the API. For HTTP APIs, the routeSelectionExpression must be ${request.method} ${request.path}. If not provided, this will be the default for HTTP APIs. This property is required for WebSocket APIs.
tags Mapping[str, str]
The collection of tags. Each tag element is associated with a given resource.
version str
A version identifier for the API.
apiEndpoint String
The default endpoint for an API. For example: https://abcdef.execute-api.us-west-2.amazonaws.com .
apiId String
The API identifier.
apiKeySelectionExpression String
An API key selection expression. Supported only for WebSocket APIs. See API Key Selection Expressions.
corsConfiguration Property Map
A CORS configuration. Supported only for HTTP APIs. See Configuring CORS for more information.
description String
The description of the API.
disableExecuteApiEndpoint Boolean
Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint.
name String
The name of the API. Required unless you specify an OpenAPI definition for Body or S3BodyLocation.
routeSelectionExpression String
The route selection expression for the API. For HTTP APIs, the routeSelectionExpression must be ${request.method} ${request.path}. If not provided, this will be the default for HTTP APIs. This property is required for WebSocket APIs.
tags Map<String>
The collection of tags. Each tag element is associated with a given resource.
version String
A version identifier for the API.

Supporting Types

ApiCors

AllowCredentials bool
Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs.
AllowHeaders List<string>
Represents a collection of allowed headers. Supported only for HTTP APIs.
AllowMethods List<string>
Represents a collection of allowed HTTP methods. Supported only for HTTP APIs.
AllowOrigins List<string>
Represents a collection of allowed origins. Supported only for HTTP APIs.
ExposeHeaders List<string>
Represents a collection of exposed headers. Supported only for HTTP APIs.
MaxAge int
The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs.
AllowCredentials bool
Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs.
AllowHeaders []string
Represents a collection of allowed headers. Supported only for HTTP APIs.
AllowMethods []string
Represents a collection of allowed HTTP methods. Supported only for HTTP APIs.
AllowOrigins []string
Represents a collection of allowed origins. Supported only for HTTP APIs.
ExposeHeaders []string
Represents a collection of exposed headers. Supported only for HTTP APIs.
MaxAge int
The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs.
allowCredentials Boolean
Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs.
allowHeaders List<String>
Represents a collection of allowed headers. Supported only for HTTP APIs.
allowMethods List<String>
Represents a collection of allowed HTTP methods. Supported only for HTTP APIs.
allowOrigins List<String>
Represents a collection of allowed origins. Supported only for HTTP APIs.
exposeHeaders List<String>
Represents a collection of exposed headers. Supported only for HTTP APIs.
maxAge Integer
The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs.
allowCredentials boolean
Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs.
allowHeaders string[]
Represents a collection of allowed headers. Supported only for HTTP APIs.
allowMethods string[]
Represents a collection of allowed HTTP methods. Supported only for HTTP APIs.
allowOrigins string[]
Represents a collection of allowed origins. Supported only for HTTP APIs.
exposeHeaders string[]
Represents a collection of exposed headers. Supported only for HTTP APIs.
maxAge number
The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs.
allow_credentials bool
Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs.
allow_headers Sequence[str]
Represents a collection of allowed headers. Supported only for HTTP APIs.
allow_methods Sequence[str]
Represents a collection of allowed HTTP methods. Supported only for HTTP APIs.
allow_origins Sequence[str]
Represents a collection of allowed origins. Supported only for HTTP APIs.
expose_headers Sequence[str]
Represents a collection of exposed headers. Supported only for HTTP APIs.
max_age int
The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs.
allowCredentials Boolean
Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs.
allowHeaders List<String>
Represents a collection of allowed headers. Supported only for HTTP APIs.
allowMethods List<String>
Represents a collection of allowed HTTP methods. Supported only for HTTP APIs.
allowOrigins List<String>
Represents a collection of allowed origins. Supported only for HTTP APIs.
exposeHeaders List<String>
Represents a collection of exposed headers. Supported only for HTTP APIs.
maxAge Number
The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs.

Package Details

Repository
AWS Native pulumi/pulumi-aws-native
License
Apache-2.0

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.27.0 published on Monday, Apr 14, 2025 by Pulumi