> ## 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.projects.createToken()

> Issue a project-scoped token.

Send a permission preset or explicit permissions to create a token limited to this project and any listed `projectIds`. Send the returned token in the `X-Scoped-Token` header. Tokens last at most six hours and cannot issue other tokens.

## Signature

Method signature on `client.projects`:

```ts theme={null}
createToken(args: {
  projectId: string;
  preset: "write" | "read" | "deploy" | "labeling-read" | "labeling-write" | "labeling-deploy";
  projectIds?: string[];
  expiresInSeconds?: number;
} | {
  projectId: string;
  permissions: string[];
  projectIds?: string[];
  expiresInSeconds?: number;
}): Promise<ScopedToken>;
```

## Parameters

Pass one of the argument shapes shown in the signature.

**projectId** `string` *required*

Project ID with prefix `pp.`.

**preset** `"write" | "read" | "deploy" | "labeling-read" | "labeling-write" | "labeling-deploy"`

A named permission set: `read` (Read everything), `write` (Read and write, no spending), `deploy` (Read, write and launch runs that spend money), `labeling-read` (Data labeling: read), `labeling-write` (Data labeling: read and write, no spending), `labeling-deploy` (Data labeling: read, write and launch pipelines).

**projectIds** `string[]`

Further projects the token may act in; the project in the path is always included. All projects must belong to the same team.

**expiresInSeconds** `number`

Token lifetime in seconds, from 60 to 21600; defaults to 21600.

**permissions** `string[]`

Explicit `resource:operation` permissions.

## Returns

`Promise<ScopedToken>`

**id** `string` *required*

Public handle of the token; use it to revoke without holding the secret.

**token** `string` *required*

The access token. Returned only when created; save it before closing the response.

**expiresAt** `string` *required*

When the token stops working.

## Errors

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

| Status | Description |
| - | - |
| 403 | Your team does not allow one of the requested permissions |
| 404 | Project not found |
| 429 | Rate limit exceeded, or you already hold 1000 live tokens for one of the projects; revoke unused tokens first |

HTTP endpoint: [`POST /projects/{projectId}/tokens`](https://docs.platform.toloka.ai/docs/api-reference/projects/create-project-token).

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

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

const token = await client.projects.createToken({
  projectId: "pp.019a0000-0000-7000-8000-000000000001",
  preset: "read"
});
console.log(token);
```

```json createToken() theme={null}
{
  "id": "pst.019a0000-0000-7000-8000-000000000001",
  "token": "<string>",
  "expiresAt": "2026-01-01T00:00:00Z"
}
```


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