HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //snap/google-cloud-cli/394/help/man/man1/gcloud_services_api-keys_create.1
.TH "GCLOUD_SERVICES_API\-KEYS_CREATE" 1



.SH "NAME"
.HP
gcloud services api\-keys create \- create an API key



.SH "SYNOPSIS"
.HP
\f5gcloud services api\-keys create\fR [\fB\-\-annotations\fR=[\fIKEY\fR=\fIVALUE\fR,...]] [\fB\-\-async\fR] [\fB\-\-display\-name\fR=\fIDISPLAY_NAME\fR] [\fB\-\-key\-id\fR=\fIKEY_ID\fR] [\fB\-\-service\-account\fR=\fISERVICE_ACCOUNT\fR] [\fB\-\-api\-target\fR=\fIservice\fR=\fISERVICE\fR,[...]\ \fB\-\-allowed\-application\fR=[\fIsha1_fingerprint\fR=\fISHA1_FINGERPRINT\fR,\fIpackage_name\fR=\fIPACKAGE_NAME\fR,...]\ |\ \fB\-\-allowed\-bundle\-ids\fR=[\fIALLOWED_BUNDLE_IDS\fR,...]\ |\ \fB\-\-allowed\-ips\fR=[\fIALLOWED_IPS\fR,...]\ |\ \fB\-\-allowed\-referrers\fR=[\fIALLOWED_REFERRERS\fR,...]] [\fIGCLOUD_WIDE_FLAG\ ...\fR]



.SH "DESCRIPTION"

Create an API key.



.SH "EXAMPLES"

To create a key with display name and allowed IPs specified:

.RS 2m
$ gcloud services api\-keys create \-\-display\-name="test name" \e
    \-\-allowed\-ips=2620:15c:2c4:203:2776:1f90:6b3b:217,104.133.8.78
.RE

To create a key with annotations:

.RS 2m
$ gcloud services api\-keys create \-\-annotations=foo=bar,abc=def
.RE

To create a key with user\-specified key ID:

.RS 2m
$ gcloud services api\-keys create \-\-key\-id="my\-key\-id"
.RE

To create a key with allowed referrers restriction:

.RS 2m
$ gcloud services api\-keys create \e
    \-\-allowed\-referrers="https://www.example.com/*,http://sub.exampl\e
e.com/*"
.RE

To create a key with allowed IOS app bundle IDs:

.RS 2m
$ gcloud services api\-keys create \-\-allowed\-bundle\-ids=my.app
.RE

To create a key with allowed Android application:

.RS 2m
$ gcloud services api\-keys create \e
    \-\-allowed\-application=sha1_fingerprint=foo1,\e
package_name=bar.foo \e
    \-\-allowed\-application=sha1_fingerprint=foo2,package_name=foo.bar
.RE

To create a key with allowed API targets (service name only):

.RS 2m
$ gcloud services api\-keys create \e
    \-\-api\-target=service=bar.service.com \e
    \-\-api\-target=service=foo.service.com
.RE

To create a key with service account:

.RS 2m
$ gcloud services api\-keys create \e
    \-\-service\-account=my\-service\-account
.RE

To create a key with allowed API targets (service and methods are specified):

.RS 2m
$ gcloud services api\-keys create \-\-flags\-file=my\-flags.yaml
.RE

The content of 'my\-flags.yaml' is as follows:

.RS 2m
\- \-\-api\-target:
    service: "foo.service.com"
\- \-\-api\-target:
    service: "bar.service.com"
    methods:
      \- "foomethod"
      \- "barmethod"
.RE



.SH "FLAGS"

.RS 2m
.TP 2m
\fB\-\-annotations\fR=[\fIKEY\fR=\fIVALUE\fR,...]

Annotations are key resource. Specify annotations as a key\-value dictionary for
small amounts of arbitrary client data.

.TP 2m
\fB\-\-async\fR

Return immediately, without waiting for the operation in progress to complete.

.TP 2m
\fB\-\-display\-name\fR=\fIDISPLAY_NAME\fR

Display name of the key to create.

.TP 2m
\fB\-\-key\-id\fR=\fIKEY_ID\fR

User\-specified ID of the key to create.

.TP 2m
\fB\-\-service\-account\fR=\fISERVICE_ACCOUNT\fR

The email of the service account the key is bound to. If this field is
specified, the key is a service account bound key and auth enabled.

.TP 2m
\fB\-\-api\-target\fR=\fIservice\fR=\fISERVICE\fR,[...]

Repeatable. Specify service and optionally one or multiple specific methods.
Both fields are case insensitive. If you need to specify methods, it should be
specified with the \f5\-\-flags\-file\fR. See $ gcloud topic flags\-file for
details. See the examples section for how to use \f5\-\-api\-target\fR in
\f5\-\-flags\-file\fR.

.TP 2m

At most one of these can be specified:


.RS 2m
.TP 2m
\fB\-\-allowed\-application\fR=[\fIsha1_fingerprint\fR=\fISHA1_FINGERPRINT\fR,\fIpackage_name\fR=\fIPACKAGE_NAME\fR,...]

Repeatable. Specify multiple allowed applications. The accepted keys are
\f5sha1_fingerprint\fR and \f5package_name\fR.

.TP 2m
\fB\-\-allowed\-bundle\-ids\fR=[\fIALLOWED_BUNDLE_IDS\fR,...]

iOS app's bundle ids that are allowed to use the key.

.TP 2m
\fB\-\-allowed\-ips\fR=[\fIALLOWED_IPS\fR,...]

A list of the caller IP addresses that are allowed to make API calls with this
key.

.TP 2m
\fB\-\-allowed\-referrers\fR=[\fIALLOWED_REFERRERS\fR,...]

A list of regular expressions for the referrer URLs that are allowed to make API
calls with this key.


.RE
.RE
.sp

.SH "GCLOUD WIDE FLAGS"

These flags are available to all commands: \-\-access\-token\-file, \-\-account,
\-\-billing\-project, \-\-configuration, \-\-flags\-file, \-\-flatten,
\-\-format, \-\-help, \-\-impersonate\-service\-account, \-\-log\-http,
\-\-project, \-\-quiet, \-\-trace\-token, \-\-user\-output\-enabled,
\-\-verbosity.

Run \fB$ gcloud help\fR for details.



.SH "NOTES"

These variants are also available:

.RS 2m
$ gcloud alpha services api\-keys create
.RE

.RS 2m
$ gcloud beta services api\-keys create
.RE