---
title: "Restore a library from trash"
method: POST
path: "/api/libraries/{library_id}/restore"
tags: ["libraries"]
---

# Restore a library from trash

`POST /api/libraries/{library_id}/restore`

Restores a previously-trashed library so it reappears in default list/search results. Works as long as the library row still exists — once `get_library` returns 404 the row is gone and restore is no longer possible. If the background drain has already started purging assets, restore succeeds but recovers only the assets the drain hasn't gotten to yet.

Pairs with `trash_library`. To restore individual trashed assets within an untrashed library, use `restore_assets` instead.

## Path parameters

- `library_id` string, required — Library ID (with `lib_` prefix) of the trashed library to restore.

## Response `200`

Successful Response

- LibraryResponse — Represents a user's photo library.
  - `id` string, required — Unique library identifier with 'lib_' prefix
  - `name` string, required — Display name of the library
  - `description` string, nullable — Optional description text for the library
  - `user_id` string, required — ID of the user who owns this library
  - `asset_count` integer, required — Total number of assets in this library
  - `storage_used_bytes` integer, required — Bytes of assets currently stored in this library
  - `storage_limit_bytes` integer, nullable — Maximum bytes this library may store, or null if no per-library limit applies
  - `created_at` string, date-time, required — When this library was created
  - `updated_at` string, date-time, required — When this library was last updated

## Other responses

- `401` — Missing, invalid, or expired credentials.
- `403` — The credentials are valid but not authorized for this operation — for example an API key whose action or library scope excludes it, or a credential type this operation does not accept.
- `404` — Not found
- `422` — Validation Error
- `429` — Rate limit exceeded. Retry after the interval in the `Retry-After` header.

## Changes

- **2026-08-08** `815e0302a988` — 1 breaking, 1 info
  - response property `detail` list-of-types was widened by adding types `string` to media type `application/json` of response `422`
  - the response property `detail` became required for the status `422`
- **2026-08-05** `c3e15c78f2da` — 4 info
  - added the media type `application/json` for the response with the status `404`
  - added the non-success response with the status `401`
  - added the non-success response with the status `403`
  - added the non-success response with the status `429`
- **2026-06-02** `4d4c5e5b7ab8` — 2 info
  - added the optional property `storage_limit_bytes` to the response with the `200` status
  - added the required property `storage_used_bytes` to the response with the `200` status
- **2026-05-18** `fbb16c77784c` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/gumnut-ai/apis/gumnut-api/changes/api/libraries/:library_id/restore/post.md)

---

[API](https://skmtc.dev/gumnut-ai/apis/gumnut-api.md) · [All operations](https://skmtc.dev/gumnut-ai/apis/gumnut-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/gumnut-ai/gumnut-api/revisions/2c3aca3a6e6d/schema)
