# Copy database into another of a web hosting package

> Copy all data of one database into another of the same package, in the background.

- Effect: Destructive - Removes something for good. Agents ask first.
- Idempotent: no
- Stability: beta
- MCP tool: `manitu_webhosting_web_database_copy` on https://mcp.manitu.de/mcp
- REST: `POST https://api.manitu.de/v1/webhosting/web/database/copy`
- Needs: `service_webhosting`
- Page: /reference/webhosting/web/database/copy/

**Removes something for good. Agents name what will be lost and wait for an explicit yes; a program should ask the same.**

## MCP tool

`manitu_webhosting_web_database_copy`

### Description for the model

Copies all data of a database (database_id) into another database (target_database_id) of the same web hosting package of the manitu customer account this connection works in, both from manitu_webhosting_web_database_list - e.g. a live shop into a test copy. It runs in the background: ask manitu_workflow_get with the workflow_token until status is done or error. Tables of the target with the same name are replaced; target_clear_first true empties the target first. dump_first (default true) writes both databases into files in the web directory of the package before. Both must be on the same kind of server, and manitu must know both passwords (password_not_stored otherwise). Refused with a conflict when the package cannot be changed now (not_configurable). Ask the customer for an explicit yes first, naming which database is overwritten.

### Arguments

- `site_id` (integer | string, required) - The site_id from manitu_webhosting_list - never guess one. (pattern `"^[1-9][0-9]*$"`; minimum `1`)
- `database_id` (integer | string, required) - The database_id from manitu_webhosting_web_database_list - never guess one. (pattern `"^[1-9][0-9]*$"`; minimum `1`)
- `target_database_id` (integer | string, required) - The database_id from manitu_webhosting_web_database_list - never guess one. (pattern `"^[1-9][0-9]*$"`; minimum `1`)
- `charset` (string) - The character set of the data: utf-8, or latin1 for an old database. Default: utf-8. (one of `"utf-8"`, `"latin1"`)
- `target_clear_first` (boolean) - Empty the target first - all its tables go. Default: false.
- `dump_first` (boolean) - Dump both databases into files in the web directory of the package before. Default: true.

### Example

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "manitu_webhosting_web_database_copy",
    "arguments": {
      "site_id": 12345,
      "database_id": 12345,
      "target_database_id": 12345
    }
  }
}
```

## REST

`POST https://api.manitu.de/v1/webhosting/web/database/copy`

### Authentication

One of `X-API-Key`, `Authorization: Bearer …` - never more than one in a request.

### Request body

JSON; unknown fields are refused.

- `site_id` (integer | string, required) - The site_id from manitu_webhosting_list - never guess one. (pattern `"^[1-9][0-9]*$"`; minimum `1`)
- `database_id` (integer | string, required) - The database_id from manitu_webhosting_web_database_list - never guess one. (pattern `"^[1-9][0-9]*$"`; minimum `1`)
- `target_database_id` (integer | string, required) - The database_id from manitu_webhosting_web_database_list - never guess one. (pattern `"^[1-9][0-9]*$"`; minimum `1`)
- `charset` (string) - The character set of the data: utf-8, or latin1 for an old database. Default: utf-8. (one of `"utf-8"`, `"latin1"`)
- `target_clear_first` (boolean) - Empty the target first - all its tables go. Default: false.
- `dump_first` (boolean) - Dump both databases into files in the web directory of the package before. Default: true.

### Response

In `data`; the rest of the body as on every call.

- `workflow` (string | null, required) - What is being done, e.g. power_reboot or ngcobalt_site_web_database_copy. (one of `"create"`, `"destroy"`, `"power_start"`, `"power_stop"`, `"power_reboot"`, `"reinstall"`, `"ptr_set"`, `"vnc_enable"`, `"vnc_disable"`, `"rescuesystem_enable"`, `"rescuesystem_disable"`, `"snapshot_create"`, `"snapshot_delete"`, `"snapshot_delete_all"`, `"snapshot_revert"`, `"telemetry_await"`, `"iso_eject"`, `"none"`, `"account_contract_termination_finish"`, `"ngcobalt_site_web_application_installation_set"`, `"ngcobalt_site_web_application_installation_update"`, `"ngcobalt_site_web_permission_set"`, `"ngcobalt_site_web_database_copy"`, `"network_librenms_discover"`, `null`)
- `workflow_id` (string | null, required) - The id of this run, as vserver/workflow/list names it; null for a workflow not kept as tasks.
- `status` (string, required) - pending: waiting to start; running: started, not finished (can take a while); done: finished, everything went through; error: finished, but it or part of it failed. (one of `"pending"`, `"running"`, `"done"`, `"error"`)
- `created_at` (string | null, required) - When it was asked for. (format `date-time`)
- `started_at` (string | null, required) - When it started; null while pending, and for a workflow that does not record it. (format `date-time`)
- `ended_at` (string | null, required) - When it finished; null until then. (format `date-time`)
- `updated_at` (string | null, required) - When it last changed. (format `date-time`)
- `workflow_token` (string | null, required) - Pass it to manitu_workflow_get to see how far the workflow is - as it is, never built or changed. A secret of this workflow: do not show it to anyone. null if there is none.

### Statuses

- `200` Success.
- `400` The request does not match the declared input schema.
- `401` No credential was presented, or it was not recognised.
- `403` The credential is not permitted to use this operation.
- `500` The server failed. Nothing about the request was wrong. Whether a change took effect is not known - check before trying it again.
- `503` The channel this operation forwards through is unavailable.

### Example

```sh
curl -X POST 'https://api.manitu.de/v1/webhosting/web/database/copy' \
  -H 'X-API-Key: $API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"site_id":12345,"database_id":12345,"target_database_id":12345}'
```

## Example result

```json
{
  "workflow": "create",
  "workflow_id": "string",
  "status": "pending",
  "created_at": "2026-10-23T12:00:00+02:00",
  "started_at": "2026-10-23T12:00:00+02:00",
  "ended_at": "2026-10-23T12:00:00+02:00",
  "updated_at": "2026-10-23T12:00:00+02:00",
  "workflow_token": "eyJwYWdlIjoyfQ"
}
```
