---
title: "Archive a search"
method: PATCH
path: "/search/{searchId}/archive"
tags: ["Semantic Search"]
---

# Archive a search

`PATCH /search/{searchId}/archive`

Archive a specific search result. Archived searches are hidden
from the default search history view but remain retrievable via
the archive-aware listing endpoints.

## Path parameters

- `searchId` string, objectId, required

## Response `200`

Search archived successfully

- object
  - `id` string, objectId, required — Unique identifier of the archived search.
  - `status` 'archived', required — Resulting status of the search after the operation.
  - `archivedBy` string, objectId, required — User ID of the user who archived the search.
  - `archivedAt` string, date-time, required — Timestamp when the search was archived.
  - `meta` object, required
    - `requestId` string — Server-assigned request identifier for tracing. Omitted when not available.
    - `timestamp` string, date-time, required — Server timestamp when the response was produced.
    - `duration` integer, required — Time taken to process the request, in milliseconds.

## Other responses

- `400` — Invalid request. Possible causes: - `searchId` failed Zod validation (not a valid ObjectId). - The target search is already archived.
- `401` — Missing or invalid bearer token.
- `403` — Bearer token lacks the `semantic:write` scope.
- `404` — Search not found, or not owned by the caller's org.
- `500` — Persistence layer failed to update the search document.

---

[API](https://skmtc.net/pipeshub-ai/apis/pipeshub-api.md) · [All operations](https://skmtc.net/pipeshub-ai/apis/pipeshub-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pipeshub-ai/pipeshub-api/versions/abd27cfefc73/schema)
