[ aws . apigatewayv2 ]



See also: AWS API Documentation


--api-id <value>
[--export-version <value>]
[--include-extensions | --no-include-extensions]
--output-type <value>
--specification <value>
[--stage-name <value>]
[--endpoint-url <value>]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]


--api-id (string)

The API identifier.

--export-version (string)

The version of the API Gateway export algorithm. API Gateway uses the latest version by default. Currently, the only supported version is 1.0.

--include-extensions | --no-include-extensions (boolean)

Specifies whether to include API Gateway extensions in the exported API definition. API Gateway extensions are included by default.

--output-type (string)

The output type of the exported definition file. Valid values are JSON and YAML.

Possible values:

  • YAML
  • JSON

--specification (string)

The version of the API specification to use. OAS30, for OpenAPI 3.0, is the only supported value.

Possible values:

  • OAS30

--stage-name (string)

The name of the API stage to export. If you don’t specify this property, a representation of the latest API configuration is exported.

outfile (string) Filename where the content will be saved

Global Options

--debug (boolean)

Turn on debug logging.

--endpoint-url (string)

Override command’s default URL with the given URL.

--no-verify-ssl (boolean)

By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.

--no-paginate (boolean)

Disable automatic pagination.

--output (string)

The formatting style for command output.

  • json
  • text
  • table
  • yaml
  • yaml-stream

--query (string)

A JMESPath query to use in filtering the response data.

--profile (string)

Use a specific profile from your credential file.

--region (string)

The region to use. Overrides config/env settings.

--version (string)

Display the version of this tool.

--color (string)

Turn on/off color output.

  • on
  • off
  • auto

--no-sign-request (boolean)

Do not sign requests. Credentials will not be loaded if this argument is provided.

--ca-bundle (string)

The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.

--cli-read-timeout (int)

The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.

--cli-connect-timeout (int)

The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.

--cli-binary-format (string)

The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob fileb:// will always be treated as binary and use the file contents directly regardless of the cli-binary-format setting. When using file:// the file contents will need to properly formatted for the configured cli-binary-format.

  • base64
  • raw-in-base64-out

--no-cli-pager (boolean)

Disable cli pager for output.

--cli-auto-prompt (boolean)

Automatically prompt for CLI input parameters.

--no-cli-auto-prompt (boolean)

Disable automatically prompt for CLI input parameters.



To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information.

Unless otherwise stated, all examples have unix-like quotation rules. These examples will need to be adapted to your terminal’s quoting rules. See Using quotation marks with strings in the AWS CLI User Guide .

To export an OpenAPI definition of an HTTP API

The following export-api example exports an OpenAPI 3.0 definition of an API stage named prod to a YAML file named stage-definition.yaml. The exported definition file includes API Gateway extensions by default.

aws apigatewayv2 export-api \
    --api-id a1b2c3d4 \
    --output-type YAML \
    --specification OAS30 \
    --stage-name prod \

This command produces no output.

For more information, see Exporting an HTTP API from API Gateway in the Amazon API Gateway Developer Guide.


body -> (blob)

Represents an exported definition of an API in a particular output format, for example, YAML. The API is serialized to the requested specification, for example, OpenAPI 3.0.