---
title: "PATCH metadata state for a file, (i.e. when an upload has completed)"
method: PATCH
path: "/files/{path}"
tags: ["Patch metadata state"]
---

# PATCH metadata state for a file, (i.e. when an upload has completed)

`PATCH /files/{path}`

## Request

- Base URL: `http://localhost:26900`
- URL: `http://localhost:26900/files/{path}`
- Auth: API key in header `Authorization`

## Path parameters

- `path` string, required

## Request body

- PatchFileRequest: PATCH payload for file metadata updates. Use state for lifecycle changes, or collection_id/bundle_id for ID updates.
  - `state` string: New state for the file: UPLOADED, PUBLISHED or MOVED
  - `collection_id` string: Set the collection ID when linking a file to a collection
  - `bundle_id` string: Set the bundle ID when linking a file to a bundle
  - `etag` string: The etag for the file

## Response `200`

OK

## Other responses

- `400`: Request could not be processed
- `401`: Authentication information is missing or invalid.
- `403`: Authorization Failed - Check logs
- `404`: The requested resource does not exist.
- `409`: Request could not be processed
- `500`: Failed to process the request due to an internal error

---

[API](https://skmtc.dev/office-of-national-statistics/apis/files-api.md) - [All operations](https://skmtc.dev/office-of-national-statistics/apis/files-api/llms.txt) - [OpenAPI document](https://skmtc.dev/office-of-national-statistics/apis/files-api/revisions/b34c9662a495?raw)
