> ## 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.files.finalizeUpload()

> Finalize a project file upload.

After uploading bytes to `uploadUrl`, call this endpoint to verify the file. Returns updated file metadata. A missing file or size above 100 MiB returns 400; a failed upload or a file that changes during verification returns 409.

## Signature

Method signature on `client.files`:

```ts theme={null}
finalizeUpload(args: {
  projectId: string;
  fileId: string;
}): Promise<ProjectFile>;
```

## Parameters

**projectId** `string` *required*

Project ID with prefix `pp.`.

**fileId** `string` *required*

ID of the project file, with prefix `ppf.`.

## Returns

`Promise<ProjectFile>`

A file stored in a project.

**id** `ProjectFileId` *required*

ID of the project file, with prefix `ppf.`.

**projectId** `ProjectId` *required*

Project ID with prefix `pp.`.

**filename** `string` *required*

Name of the project file.

**status** `"pending" | "uploaded" | "failed"` *required*

File state: `pending` before finalization, `uploaded` after successful finalization, or `failed` if the upload failed.

**declaredSizeBytes** `number` *required*

Declared maximum size of the file, in bytes.

**uploadedSizeBytes** `number | null` *required*

Finalized file size in bytes, or null before successful finalization.

**createdAt** `string` *required*

Time the file upload was started, as an ISO 8601 timestamp.

**uploadedAt** `string | null` *required*

Time the upload was finalized, as an ISO 8601 timestamp, or null before successful finalization.

**url** `string` *required*

The file download endpoint. API keys and signed-in users receive a 302 redirect to the download link. Project-scoped tokens receive JSON with a `url` field.

## Errors

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

| Status | Description |
| - | - |
| 400 | Uploaded file is missing or too large |
| 404 | Project or file not found |
| 429 | Rate limit exceeded |

HTTP endpoint: [`POST /projects/{projectId}/files/{fileId}/finalize`](https://docs.platform.toloka.ai/docs/api-reference/files/finalize-project-file-upload).

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

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

const file = await client.files.finalizeUpload({
  projectId: "pp.019a0000-0000-7000-8000-000000000001",
  fileId: "ppf.019a0000-0000-7000-8000-000000000001"
});
console.log(file);
```

```json finalizeUpload() theme={null}
{
  "id": "ppf.019a0000-0000-7000-8000-000000000001",
  "projectId": "pp.019a0000-0000-7000-8000-000000000001",
  "filename": "<string>",
  "status": "pending",
  "declaredSizeBytes": 0,
  "uploadedSizeBytes": null,
  "createdAt": "2026-01-01T00:00:00Z",
  "uploadedAt": null,
  "url": "<string>"
}
```


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