# Update secret in project

`PATCH /v1/projects/{project}/secrets/{secret}`, operation `secrets.UpdateSecretInProject`

Changes a secret's alias or description, or the projects an organization's secret is shared with.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `project` | path | Yes | `string` | The project's ID. |
| `secret` | path | Yes | `string` | The secret's ID. |

## Request body

Content-Type: `application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `alias` | `string` | No | What people and software call the secret; unique in its organization or project. |
| `availability` | `Availability` | No | For an organization's secret: the projects it's shared with. Changing it also takes secrets.secrets.setAvailability. Projects it's newly shared with have it at once, but those with a secret of their own under its alias, which have it once theirs is deleted or renamed. Those it's no longer shared with lose it at once, and their agents lose their grants and bindings of it; sharing it again gives them a new one. |
| `availability.allProjects` | `boolean` | Yes | Every project, including those created later. |
| `availability.projects` | `string[]` | Yes | Projects, projects/{project_id}, when not all of them; at most 500. Past that, make the resource available to every project. |
| `description` | `string` | No | What the secret is for. A shared secret's is its source's, which it may only be sent back as. |
| `etag` | `string` | No | The etag of the secret as read. With one, the update fails with aborted if the secret changed since. |

## Responses

### 200

OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `alias` | `string` | Yes | What people and software call the secret, such as stripe/secret_key; unique in its organization or project. |
| `availability` | `Availability` | Yes | For an organization's secret: the projects it's shared with, which have it at once, as a secret of their own that reads its versions; stopping sharing it with a project deletes it from the project, and from its agents. A project's secret is shared with none. |
| `availability.allProjects` | `boolean` | Yes | Every project, including those created later. |
| `availability.projects` | `string[]` | Yes | Projects, projects/{project_id}, when not all of them; at most 500. Past that, make the resource available to every project. |
| `createTime` | `string (date-time)` | Yes | When the secret was created. |
| `description` | `string` | Yes | What the secret is for. A secret its organization shares with the project shows its source's. |
| `etag` | `string` | Yes | Changes with each update. Send it back when updating the secret; the update fails with aborted if the secret changed in between. |
| `latestVersion` | `integer (int32)` | Yes | The number of the newest enabled version, which latest names; 0 when no version is enabled. A secret its organization shares with the project shows its source's. |
| `name` | `string` | Yes | Resource name, organizations/{organization_id}/secrets/{secret_id} or projects/{project_id}/secrets/{secret_id}. |
| `source` | `string` | Yes | For a project's secret that its organization shares with it, the organization's secret, organizations/{organization_id}/secrets/{secret_id}, whose versions it reads; empty for any other secret. Set by kosem as the organization shares the secret, and never changed. |
| `updateTime` | `string (date-time)` | Yes | When the secret, or its versions, last changed. |

### default

Error

Base URL: `https://api.kosem.ai`. See [API conventions](https://docs.kosem.ai/reference/api-conventions.md) for authentication, pagination and errors, and [https://docs.kosem.ai/openapi.yaml](https://docs.kosem.ai/openapi.yaml) for the full OpenAPI document.