---
title: "Release a stale lock"
method: POST
path: "/api/recovery/locks/release"
tags: ["Recovery"]
---

# Release a stale lock

`POST /api/recovery/locks/release`

## Request

- Base URL: `https://localhost:1852`
- URL: `https://localhost:1852/api/recovery/locks/release`
- Auth: HTTP bearer

Releases a lock whose owner ended `completion_unknown`, after review. A live lock
is never released here; its owner releases it by finishing, and a request against
a live lock answers `409` with `LOCK_HELD`. A repository lock requires permission
to change system settings; a storage lock requires the same access a restore does,
and the storage's volume need not exist any more. At startup, once no helper of the
previous process remains, Sencho releases the repository lock of an interrupted provisioning,
and, when restic's own locks are cleared, of interrupted captures, checks and restores
itself; every storage lock waits for this call.
Only a Full Admin API token may call it; any other scope is refused with `403 SCOPE_DENIED`.

## Headers

- `x-node-id` integer

## Request body

- object
  - `scope` 'storage' | 'repository', required
  - `resourceKey` string, required: The storage key for `storage`, or the repository id for `repository`.

## Response `200`

The lock row that was released.

- object
  - `released` object, required
    - `scope` 'storage' | 'repository', required
    - `resourceKey` string, required
    - `ownerOperationId` string, required
    - `processEpoch` string, required
    - `acquiredAt` integer, required
    - `staleSince` integer, nullable, required

## Other responses

- `400`: The request is not valid for this storage.
- `401`: Authentication required. Provide a valid Bearer token.
- `403`: The caller lacks the access this recovery action needs. An API token whose scope does not allow the call is refused before the route runs, with `code: SCOPE_DENIED` and no `errorClass`.
- `409`: A live lock is held, an interrupted operation left a stale lock, the storage identity is unknown, a check found a mismatch, an operation was interrupted, or a remote node needs an update.
- `500`: The recovery operation failed.

## Changes

- **2026-11-02** `1f7572eb735f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/studio-saelix/apis/sencho-api/changes/api/recovery/locks/release/post.md)

---

[API](https://skmtc.dev/studio-saelix/apis/sencho-api.md) - [All operations](https://skmtc.dev/studio-saelix/apis/sencho-api/llms.txt) - [OpenAPI document](https://skmtc.dev/studio-saelix/apis/sencho-api/revisions/1f7572eb735f?raw)
