# REST Resource: projects.secrets

- [Resource: Secret](https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret)
  - [JSON representation](https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret.SCHEMA_REPRESENTATION)
- [Replication](https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Replication)
  - [JSON representation](https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Replication.SCHEMA_REPRESENTATION)
- [Automatic](https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Automatic)
- [UserManaged](https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#UserManaged)
  - [JSON representation](https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#UserManaged.SCHEMA_REPRESENTATION)
- [Replica](https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Replica)
  - [JSON representation](https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Replica.SCHEMA_REPRESENTATION)
- [Methods](https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#METHODS_SUMMARY)

## Resource: Secret

A `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret` is a logical secret whose value and versions can be accessed.

A `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret` is made up of zero or more `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets.versions#SecretVersion` that represent the secret data.

| JSON representation |
|---|
| ``` { "name": string, "replication": { object (`https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Replication`) }, "createTime": string, "labels": { string: string, ... } } ``` |

| Fields ||
|---|---|
| `name` | `string` Output only. The resource name of the `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret` in the format `projects/*/secrets/*`. |
| `replication` | ``object (`https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Replication`)`` Required. Immutable. The replication policy of the secret data attached to the `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret`. The replication policy cannot be changed after the Secret has been created. |
| `createTime` | ``string (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp` format)`` Output only. The time at which the `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret` was created. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: `"2014-10-02T15:01:23Z"` and `"2014-10-02T15:01:23.045123456Z"`. |
| `labels` | `map (key: string, value: string)` The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}` Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}` No more than 64 labels can be assigned to a given resource. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |

## Replication

A policy that defines the replication configuration of data.

| JSON representation |
|---|
| ``` { // Union field `replication` can be only one of the following: "automatic": { object (`https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Automatic`) }, "userManaged": { object (`https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#UserManaged`) } // End of list of possible types for union field `replication`. } ``` |

| Fields ||
|---|---|
| Union field `replication`. The replication policy for this secret. `replication` can be only one of the following: ||
| `automatic` | ``object (`https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Automatic`)`` The `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret` will automatically be replicated without any restrictions. |
| `userManaged` | ``object (`https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#UserManaged`)`` The `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret` will only be replicated into the locations specified. |

## Automatic

A replication policy that replicates the `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret` payload without any restrictions.

## UserManaged

A replication policy that replicates the `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret` payload into the locations specified in \[Secret.replication.user_managed.replicas\]\[\]

| JSON representation |
|---|
| ``` { "replicas": [ { object (`https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Replica`) } ] } ``` |

| Fields ||
|---|---|
| `replicas[]` | ``object (`https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Replica`)`` Required. The list of Replicas for this `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret`. Cannot be empty. |

## Replica

Represents a Replica for this `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret`.

| JSON representation |
|---|
| ``` { "location": string } ``` |

| Fields ||
|---|---|
| `location` | `string` The canonical IDs of the location to replicate data. For example: `"us-east1"`. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets/addVersion` | Creates a new `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets.versions#SecretVersion` containing secret data and attaches it to an existing `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret`. |
| ### `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets/create` | Creates a new `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret` containing no `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets.versions#SecretVersion`. |
| ### `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets/delete` | Deletes a `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret`. |
| ### `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets/get` | Gets metadata for a given `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret`. |
| ### `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets/getIamPolicy` | Gets the access control policy for a secret. |
| ### `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets/list` | Lists `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret`. |
| ### `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets/patch` | Updates metadata of an existing `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets#Secret`. |
| ### `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets/setIamPolicy` | Sets the access control policy on the specified secret. |
| ### `https://docs.cloud.google.com/secret-manager/docs/reference/rest/v1beta1/projects.secrets/testIamPermissions` | Returns permissions that a caller has for the specified secret. |