---
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`

## Request

- Base URL: `https://docs.anzworldline-solutions.com.au`
- URL: `https://docs.anzworldline-solutions.com.au/api/v1/maintenance/_searchAndReplace`
- Auth: none declared
- TypeScript: <https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/docs/api/v1/maintenance/_searchAndReplace/post.ts> (a function with typed inputs; its response is checked against the schema)

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

## Changes

- **2026-10-30** `4fd8e917d458`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/changes/api/v1/maintenance/_searchAndReplace/post.md)

---

[API](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api.md) - [All operations](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/anzworldline-solutions/apis/dotcms-rest-api/revisions/4fd8e917d458?raw)
