Stay organized with collections Save and categorize content based on your preferences.
Creating an API config PrerequisitesBefore you can create an API config, ensure that you have:
Prepared your development environment as described in Configuring your development environment.
Created an API definition as an OpenAPI spec.
Optionally created an API as described in Creating an API. If the API does not already exist, then creating the API config creates it.
Many of the gcloud
commands shown below require you to specify the ID of the API config, in the form: CONFIG_ID. API Gateway enforces the following requirements for the API config ID:
Use the Google Cloud CLI to upload your API definition to create an API config. When you upload the API definition, you are required to specify the name of the API. If the API does not already exist in API Gateway then this command also creates it.
Note: API Gateway supports creation of API definitions as OpenAPI specs for all available backend services. API Gateway also supports the use of gRPC service definitions and configurations for gRPC services on Cloud Run.To create an API config:
Change directory to the directory containing your API definition.
For more on creating the OpenAPI spec for your API definition, see OpenAPI overview and Quickstart: Deploy an API on API Gateway.
For more on creating a gRPC service definition and configuration for your API definition, see Configuring a gRPC service and Getting started with API Gateway and Cloud Run for gRPC.
Validate the project ID returned from the following command to make sure that the service isn't created in the wrong project.
gcloud config list project
If you need to change the default project, run the following command and replace PROJECT_ID with the Google Cloud project ID in which you want to create the service::
gcloud config set project PROJECT_ID
View help for the api-configs create
command:
gcloud api-gateway api-configs create --help
Run the following command to create the API config:
gcloud api-gateway api-configs create CONFIG_ID \ --api=API_ID --openapi-spec=API_DEFINITION \ --project=PROJECT_ID --backend-auth-service-account=SERVICE_ACCOUNT_EMAIL
where:
As it is creating the API and API config, API Gateway outputs information to the terminal. This operation may take several minutes to complete as the API config is propagated to downstream systems. Creation of a complex API config could take up to ten minutes to complete successfully. While a config is being created, do not attempt to create another config for the same API. Only one config may be created for any API at a time.
On successful completion, you can use the following command to view details about the new API config:
gcloud api-gateway api-configs describe CONFIG_ID \ --api=API_ID --project=PROJECT_ID
This command returns the following:
createTime: '2020-02-04T18:33:11.882707149Z' displayName: CONFIG_ID gatewayConfig: backendConfig: googleServiceAccount: 1111111@developer.gserviceaccount.com labels: '' name: projects/PROJECT_ID/locations/global/apis/API_ID/configs/CONFIG_ID serviceRollout: rolloutId: 2020-02-04r2 state: ACTIVE updateTime: '2020-02-04T18:33:12.219323647Z'
Enable the API using the managed service name of the API. You can find this value in the Managed Service column for your API on the APIs landing page:
gcloud services enable MANAGED_SERVICE_NAME.apigateway.PROJECT_ID.cloud.goog
You only have to run this command once when you create the API. If you later modify the API, you do not have to rerun the command.
The Google Cloud CLI takes many options, including those described in the gcloud Reference. In addition, for API Gateway, you can set the following options when creating an API config:
--async
: Return control to the terminal immediately, without waiting for the operation to complete.--display-name=NAME
: Specifies the display name of the API config, meaning the name shown in the UI. Do not use spaces in the name. Use hyphens and underscores instead. The default value is CONFIG_ID.--labels=KEY1=VALUE1,KEY2=VALUE2,...
: Specifies labels associated with the API config.For example:
gcloud api-gateway api-configs create CONFIG_ID \ --api=API_ID --openapi-spec=API_DEFINITION \ --project=PROJECT_ID --backend-auth-service-account=SERVICE_ACCOUNT_EMAIL \ --async --display-name=MyConfig --labels=a=1,b=2
You can see the labels in the output of the describe
command shown above, or in the list
command by including the --format
option:
gcloud api-gateway api-configs list \ --api=API_ID --project=PROJECT_ID --format="table(name, labels)"Listing API configs
To list API configs for a specific project:
gcloud api-gateway api-configs list --project=PROJECT_ID
This command returns the following:
NAME DISPLAY_NAME ROLLOUT_ID STATE CREATE_TIME projects/PROJECT_ID/locations/global/apis/API_ID/configs/CONFIG_ID CONFIG_ID 2020-02-04r0 ACTIVE 2020-02-04T16:18:02.369859863Z
To list API configs for a specific API in a project:
gcloud api-gateway api-configs list --api=API_ID --project=PROJECT_ID
Use the project, API, and config IDs to obtain detailed information about the API config:
gcloud api-gateway api-configs describe CONFIG_ID \ --api=API_ID --project=PROJECT_IDUpdating an API config
You cannot modify an existing API config other than to update its labels and its display name.
Note: Every time you upload an API definition, API Gateway creates a new API config.To update an API definition:
Use the same command to create the new API config as you used to create the initial API config, as shown above in Creating an API config.
Use the following gcloud
to update an existing API config:
--display-name
--update-labels
--clear-labels
--remove-labels
For example:
gcloud api-gateway api-configs update CONFIG_ID \ --api=API_ID --project=PROJECT_ID \ --update-labels=a=1,b=2
Use the following command to view all update options:
gcloud api-gateway api-configs update --helpDeleting an API config Warning: If you deployed the API config to a gateway, the API config may not be deleted until the gateway is no longer using that API config.
Before you delete an API config that is in use, you must either:
See Deploying an API to a gateway for more.
Use the following gcloud
command to delete an existing API config:
gcloud api-gateway api-configs delete CONFIG_ID --api=API_ID --project=PROJECT_IDWhat's next
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Before creating an API config, you must have prepared your development environment and created an API definition as an OpenAPI spec, and optionally, you may have already created the API."],["The API config ID must adhere to specific formatting rules, including a maximum length of 63 characters and the use of only lowercase letters, numbers, and dashes, without starting with a dash or using underscores."],["Creating an API config involves using the Google Cloud CLI to upload your API definition, specifying the API name, and if the API doesn't exist, the command will also create it, this is done by following through the steps of changing the correct directory, setting the correct project ID, and running the `gcloud api-gateway api-configs create` command."],["API configs can be listed, described, and updated, however, updating an API definition requires creating a new API config, as existing configs cannot be modified except for labels and display names."],["Deleting an API config requires that it is not in use by any deployed gateway, either through deploying a different config or deleting the gateway, then using the `gcloud api-gateway api-configs delete` command."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4