> ## Documentation Index
> Fetch the complete documentation index at: https://docs.platform.toloka.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# client.secrets.set()

> Set a project secret.

Send `value` to create or replace the named secret. Returns its name and timestamps without the secret value.

## Signature

Method signature on `client.secrets`:

```ts theme={null}
set(args: {
  projectId: string;
  name: string;
  value: string;
}): Promise<ProjectSecret>;
```

## Parameters

**projectId** `string` *required*

Project ID with prefix `pp.`.

**name** `string` *required*

The name of a project secret.

**value** `string` *required*

Secret value to store; the API does not return this value.

## Returns

`Promise<ProjectSecret>`

Metadata for a project secret. Secret values are never returned.

**name** `ProjectSecretName` *required*

The name of a project secret.

**createdAt** `string` *required*

Time the secret was created, as an ISO 8601 timestamp.

**updatedAt** `string` *required*

Time the secret was last updated, as an ISO 8601 timestamp.

## Errors

HTTP errors throw [`PotatoApiError`](https://docs.platform.toloka.ai/docs/sdk/errors). The endpoint documents these error responses:

| Status | Description |
| - | - |
| 404 | Project not found |
| 429 | Rate limit exceeded |

HTTP endpoint: [`PUT /projects/{projectId}/secrets/{name}`](https://docs.platform.toloka.ai/docs/api-reference/secrets/set-project-secret).

```ts set() theme={null}
import { createClient } from "@toloka-platform/sdk";

const client = createClient({
  baseUrl: "https://platform.toloka.ai",
  apiKey: process.env.TOLOKA_API_KEY!,
});

const secret = await client.secrets.set({
  projectId: "pp.019a0000-0000-7000-8000-000000000001",
  name: "example",
  value: "your-secret-value"
});
console.log(secret);
```

```json set() theme={null}
{
  "name": "example",
  "createdAt": "2026-01-01T00:00:00Z",
  "updatedAt": "2026-01-01T00:00:00Z"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.