Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Set up API keys using the API Gateway REST API

Focus mode
Set up API keys using the API Gateway REST API - Amazon API Gateway

To set up API keys, do the following:

  • Configure API methods to require an API key.

  • Create or import an API key for the API in a region.

Before setting up API keys, you must have created an API and deployed it to a stage. After you create an API key value, it cannot be changed.

For the REST API calls to create and deploy an API, see restapi:create and deployment:create, respectively.

Note

For best practices to consider, see Best practices for API keys and usage plans.

Require an API key on a method

To require an API key on a method, do one of the following:

  • Call method:put to create a method. Set apiKeyRequired to true in the request payload.

  • Call method:update to set apiKeyRequired to true.

Create or import API keys

To create or import an API key, do one of the following:

You cannot change the value of the new API key. To learn how to configure a usage plan, see Create, configure, and test usage plans using the API Gateway CLI and REST API.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.