Amazon API Gateway
API Reference

HTTP APIs are in beta for Amazon API Gateway and are subject to change.

Apis

Represents your APIs as a collection. A collection offers a paginated view of your APIs.

URI

/v2/apis

HTTP Methods

GET

Operation ID: GetApis

Gets a collection of Api resources.

Query Parameters

Name Type Required Description
nextToken String False

The next page of elements from this collection. Not valid for the last element of the collection.

maxResults String False

The maximum number of elements to be returned for this resource.

Responses

Status Code Response Model Description
200 Apis

Success

400 BadRequestException

One of the parameters in the request is invalid.

404 NotFoundException

The resource specified in the request was not found.

429 LimitExceededException

The client is sending more than the allowed number of requests per unit of time.

POST

Operation ID: CreateApi

Creates an Api resource.

Responses

Status Code Response Model Description
201 Api

The request has succeeded and has resulted in the creation of a resource.

400 BadRequestException

One of the parameters in the request is invalid.

404 NotFoundException

The resource specified in the request was not found.

409 ConflictException

The resource already exists.

429 LimitExceededException

The client is sending more than the allowed number of requests per unit of time.

PUT

Operation ID: ImportApi

Imports an API.

Query Parameters

Name Type Required Description
failOnWarnings String False

Specifies whether to rollback the API creation (true) or not (false) when a warning is encountered. The default value is false.

basepath String False

Represents the base path of the imported API. Supported only for HTTP APIs.

Responses

Status Code Response Model Description
201 Api

The request has succeeded and has resulted in the creation of a resource.

400 BadRequestException

One of the parameters in the request is invalid.

404 NotFoundException

The resource specified in the request was not found.

409 ConflictException

The resource already exists.

429 LimitExceededException

The client is sending more than the allowed number of requests per unit of time.

Schemas

Request Bodies

Example POST

{ "name": "string", "description": "string", "version": "string", "protocolType": enum, "routeSelectionExpression": "string", "apiKeySelectionExpression": "string", "disableSchemaValidation": boolean, "tags": { }, "target": "string", "credentialsArn": "string", "routeKey": "string", "corsConfiguration": { "allowOrigins": [ "string" ], "allowCredentials": boolean, "exposeHeaders": [ "string" ], "maxAge": integer, "allowMethods": [ "string" ], "allowHeaders": [ "string" ] } }

Example PUT

{ "body": "string" }

Response Bodies

Example Apis

{ "items": [ { "apiId": "string", "name": "string", "description": "string", "version": "string", "protocolType": enum, "routeSelectionExpression": "string", "apiKeySelectionExpression": "string", "disableSchemaValidation": boolean, "warnings": [ "string" ], "importInfo": [ "string" ], "apiEndpoint": "string", "createdDate": "string", "tags": { }, "corsConfiguration": { "allowOrigins": [ "string" ], "allowCredentials": boolean, "exposeHeaders": [ "string" ], "maxAge": integer, "allowMethods": [ "string" ], "allowHeaders": [ "string" ] } } ], "nextToken": "string" }

Example Api

{ "apiId": "string", "name": "string", "description": "string", "version": "string", "protocolType": enum, "routeSelectionExpression": "string", "apiKeySelectionExpression": "string", "disableSchemaValidation": boolean, "warnings": [ "string" ], "importInfo": [ "string" ], "apiEndpoint": "string", "createdDate": "string", "tags": { }, "corsConfiguration": { "allowOrigins": [ "string" ], "allowCredentials": boolean, "exposeHeaders": [ "string" ], "maxAge": integer, "allowMethods": [ "string" ], "allowHeaders": [ "string" ] } }

Example BadRequestException

{ "message": "string" }

Example NotFoundException

{ "message": "string", "resourceType": "string" }

Example ConflictException

{ "message": "string" }

Example LimitExceededException

{ "message": "string", "limitType": "string" }

Properties

Api

Represents an API.

Property Type Required Description
apiId

string

False

The API ID.

name

string

True

The name of the API.

description

string

False

The description of the API.

version

string

False

A version identifier for the API.

protocolType

ProtocolType

True

The API protocol.

routeSelectionExpression

string

True

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.

apiKeySelectionExpression

string

False

An API key selection expression. Supported only for WebSocket APIs. See API Key Selection Expressions.

disableSchemaValidation

boolean

False

Avoid validating models when creating a deployment. Supported only for WebSocket APIs.

warnings

Array of type string

False

The warning messages reported when failonwarnings is turned on during API import.

importInfo

Array of type string

False

The validation information during API import. This may include particular properties of your OpenAPI definition which are ignored during import. Supported only for HTTP APIs.

apiEndpoint

string

Format: uri

False

The URI of the API, of the form {api-id}.execute-api.{region}.amazonaws.com. The stage name is typically appended to this URI to form a complete path to a deployed API stage.

createdDate

string

Format: date-time

False

The timestamp when the API was created.

tags

Tags

False

A collection of tags associated with the API.

corsConfiguration

Cors

False

A CORS configuration. Supported only for HTTP APIs.

Apis

Represents a collection of APIs.

Property Type Required Description
items

Array of type Api

False

The elements from this collection.

nextToken

string

False

The next page of elements from this collection. Not valid for the last element of the collection.

BadRequestException

The request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.

Property Type Required Description
message

string

False

Describes the error encountered.

ConflictException

The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.

Property Type Required Description
message

string

False

Describes the error encountered.

Cors

Represents a CORS configuration. Supported only for HTTP APIs. See Configuring CORS for more information.

Property Type Required Description
allowOrigins

Array of type string

False

Represents a collection of allowed origins. Supported only for HTTP APIs.

allowCredentials

boolean

False

Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs.

exposeHeaders

Array of type string

False

Represents a collection of exposed headers. Supported only for HTTP APIs.

maxAge

integer

False

The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs.

allowMethods

Array of type string

False

Represents a collection of allowed HTTP methods. Supported only for HTTP APIs.

allowHeaders

Array of type string

False

Represents a collection of allowed headers. Supported only for HTTP APIs.

CreateApiInput

Represents the input parameters for a CreateApi request.

Property Type Required Description
name

string

True

The name of the API.

description

string

False

The description of the API.

version

string

False

A version identifier for the API.

protocolType

ProtocolType

True

The API protocol.

routeSelectionExpression

string

False

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.

apiKeySelectionExpression

string

False

An API key selection expression. Supported only for WebSocket APIs. See API Key Selection Expressions.

disableSchemaValidation

boolean

False

Avoid validating models when creating a deployment. Supported only for WebSocket APIs.

tags

Tags

False

The collection of tags. Each tag element is associated with a given resource.

target

string

False

This property is part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes. For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN. The type of the integration will be HTTP_PROXY or AWS_PROXY, respectively. Supported only for HTTP APIs.

credentialsArn

string

False

This property is part of quick create. It specifies the credentials required for the integration, if any. For a Lambda integration, three options are available. To specify an IAM Role for API Gateway to assume, use the role's Amazon Resource Name (ARN). To require that the caller's identity be passed through from the request, specify arn:aws:iam::*:user/*. To use resource-based permissions on supported AWS services, specify null. Currently, this property is not used for HTTP integrations. Supported only for HTTP APIs.

routeKey

string

False

This property is part of quick create. If you don't specify a routeKey, a default route of $default is created. The $default route acts as a catch-all for any request made to your API, for a particular stage. The $default route key can't be modified. You can add routes after creating the API, and you can update the route keys of additional routes. Supported only for HTTP APIs.

corsConfiguration

Cors

False

A CORS configuration. Supported only for HTTP APIs. See Configuring CORS for more information.

ImportApiInput

Represents the input to ImportAPI. Supported only for HTTP APIs.

Property Type Required Description
body

string

True

The OpenAPI definition. Supported only for HTTP APIs.

LimitExceededException

A limit has been exceeded. See the accompanying error message for details.

Property Type Required Description
message

string

False

Describes the error encountered.

limitType

string

False

The limit type.

NotFoundException

The resource specified in the request was not found. See the message field for more information.

Property Type Required Description
message

string

False

Describes the error encountered.

resourceType

string

False

The resource type.

ProtocolType

Represents a protocol type.

  • WEBSOCKET

  • HTTP

Tags

Represents a collection of tags associated with the resource.

Property Type Required Description

*

string

False

See Also

For more information about using this API in one of the language-specific AWS SDKs and references, see the following:

GetApis

CreateApi

ImportApi