# Create secret in project

`POST /v1/projects/{project}/secrets`, operation `secrets.CreateSecretInProject`

Creates a secret.

An organization's secret is shared with the projects its availability names, which have it at once.

## Parameters

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

## Request body

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `alias` | `string` | No | What people and software call the secret, such as stripe/secret_key; unique in its organization or project. Lowercase letters, digits and _, in segments separated by /, starting with a letter, at most 128. Required. |
| `availability` | `Availability` | No | For an organization's secret: the projects to share it with, which have it at once, but those with a secret of their own under its alias. None, unless set. Setting it also takes secrets.secrets.setAvailability. |
| `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. |

## Responses

### 201

Created

| 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.