The Projects.hmacKeys resource represents an HMAC key within Cloud Storage. The resource
consists of a secret and HMAC key metadata. HMAC keys can be used as credentials for
service accounts. For more information, see
[HMAC Keys](https://docs.cloud.google.com/storage/docs/authentication/hmackeys.md.txt).

Note that the Projects.hmacKeys resource is **only** returned when you use
`hmacKey.create`. Other methods, such as `hmacKey.get`, return the
metadata portion of the HMAC key resource.

For a list of [methods](https://docs.cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys.md.txt#methods) for this resource, see the end of this page.

## Resource representations

<br />

```json
{
  "kind": "storage#hmacKey",
  "metadata": {
    "kind": "storage#hmacKeyMetadata",
    "id": string,
    "selfLink": string,
    "accessId": string,
    "projectId": string,
    "serviceAccountEmail": string,
    "state": string,
    "timeCreated": "datetime",
    "updated": "datetime",
    "etag": string
  },
  "secret": string
}
```

| Property name | Value | Description | Notes |
|---|---|---|---|
| `kind` | `string` | The kind of item this is. For HMAC keys, this is always `"storage#hmacKey"`. |   |
| `metadata` | `object` | HMAC key metadata. |   |
| `metadata.accessId` | `string` | The access ID of the HMAC Key. |   |
| `metadata.etag` | `string` | HTTP 1.1 [Entity tag](https://datatracker.ietf.org/doc/html/rfc7232#section-2.3) for the HMAC key. |   |
| `metadata.id` | `string` | The ID of the HMAC key, including the Project ID and the Access ID. |   |
| `metadata.kind` | `string` | The kind of item this is. For HMAC key metadata, this is always `"storage#hmacKeyMetadata"`. |   |
| `metadata.projectId` | `string` | The Project ID of the project that owns the service account to which the key authenticates. |   |
| `metadata.selfLink` | `string` | The link to this resource. |   |
| `metadata.serviceAccountEmail` | `string` | The email address of the key's associated service account. |   |
| `metadata.state` | `string` | The state of the key. Can be one of ACTIVE, INACTIVE, or DELETED. | writable |
| `metadata.timeCreated` | `datetime`^1^ | The creation time of the HMAC key in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) format. |   |
| `metadata.updated` | `datetime`^1^ | The last modification time of the HMAC key metadata in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) format. |   |
| `secret` | `string` | HMAC secret key material. |   |

^1^ This property is a string formatted as the specified value type.

## Methods

Available methods for Projects.hmacKeys resources are as follows:

[create](https://docs.cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/create.md.txt)
:   Creates a new HMAC key for the specified service account.

[delete](https://docs.cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/delete.md.txt)
:   Deletes an HMAC key.

[get](https://docs.cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/get.md.txt)
:   Retrieves an HMAC key's metadata.

[list](https://docs.cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/list.md.txt)
:   Retrieves a list of HMAC keys matching the criteria.

[update](https://docs.cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys/update.md.txt)
:   Updates the state of an HMAC key.

For information about status and error codes returned by these APIs, see the
[reference page](https://docs.cloud.google.com/storage/docs/json_api/v1/status-codes.md.txt).