---
title: "Database-wide search and replace"
method: POST
path: "/api/v1/maintenance/_searchAndReplace"
tags: ["Maintenance"]
---

# Database-wide search and replace

`POST /api/v1/maintenance/_searchAndReplace`

Performs a find/replace across text content in contentlets, containers, templates, fields, and links. Only affects working/live versions. This is a dangerous, irreversible operation. Returns 200 with hasErrors=true if some tables failed — check the response body.

## Request body

- SearchAndReplaceForm — Database-wide search and replace parameters
  - `searchString` string, required — Text to search for across all content tables. Must not be empty.
  - `replaceString` string, required — Replacement text. Can be empty to delete all occurrences of searchString.

## Response `200`

Search and replace completed

- ResponseEntitySearchAndReplaceResultView
  - `errors` ErrorEntity[]
    - `errorCode` string
    - `message` string
    - `fieldName` string
  - `entity` SearchAndReplaceResultView
    - `success` boolean, required — Whether the operation completed without errors
    - `hasErrors` boolean, required — Whether any table updates encountered errors. When true, some tables may not have been updated.
  - `messages` MessageEntity[]
    - `message` string
  - `i18nMessagesMap` object
  - `permissions` string[]
  - `pagination` Pagination
    - `currentPage` integer
    - `perPage` integer
    - `totalEntries` integer

## Other responses

- `400` — Bad request - searchString is empty or missing
- `401` — Unauthorized - authentication required
- `403` — Forbidden - CMS Administrator role required

---

[API](https://skmtc.dev/jostens/apis/dotcms-rest-api.md) · [All operations](https://skmtc.dev/jostens/apis/dotcms-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/jostens/dotcms-rest-api/revisions/a088fe9f515c/schema)
