Method: projects.locations.keys.create

Creates a new API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

HTTP request


The URL uses gRPC Transcoding syntax.

Path parameters



Required. The project in which the API key is created.

Authorization requires the following IAM permission on the specified resource parent:

  • apikeys.keys.create

Query parameters



User specified key id (optional). If specified, it will become the final component of the key resource name.

The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?.

The id must NOT be a UUID-like string.

Request body

The request body contains an instance of Key.

Response body

If successful, the response body contains a newly created instance of Operation.

Authorization Scopes

Requires the following OAuth scope:


For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • apikeys.keys.create

For more information, see the IAM documentation.