---
title: "🛡️ Control the current indexing run."
method: PATCH
path: "/api/v1/index/state"
tags: ["Indexing"]
---

# 🛡️ Control the current indexing run.

`PATCH /api/v1/index/state`

Update the state of the currently running indexing operation. This endpoint
is dedicated to controlling the indexing service from the frontend, and
cannot update completed runs.

This endpoint is designed to accept actions. Instead of sending the desired
state, send an action and let the indexing service handle the change
internally. So, you send "stop", and internally the service will terminate
the run and change the state to `idle`.

Accepted actions are:

- `pause` - Pauses the run after the current file has completed indexing.
The internal state will change to `paused`.
- `resume` - Resumes a run and continues with the next file. Triggering
resume on a run that isn't paused will have no effect. The internal
state will change to `indexing`.
- `stop` - Stops a run after the current file has completed indexing. The
internal state will change to `idle`, and a new run can be started.
<!-- Leave this line empty -->
<br /><hr /><h3>🛡️ Requires Capabilities: <code>Indexing.Operate</code></h3>

## Request body

- StateChangeActionDto
  - `action` object, required

## Response `200`

## Other responses

- `401` — Possible reasons: The authorization token is invalid.
- `403` — Possible reasons: The user does not have sufficent capabilities.
- `409` — Returns a 409 if the action is not compatible with the current indexing state. For example, sending `stop` while the server is `idle`. <!-- Leave this line empty -->

---

[API](https://skmtc.net/cardinalapps/apis/cardinal-media-server-api.md) · [All operations](https://skmtc.net/cardinalapps/apis/cardinal-media-server-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cardinalapps/cardinal-media-server-api/revisions/0c30e5146acd/schema)
