> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autocalls.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Roll back data migration

> Undo one item of a migration

This endpoint undoes one row of [List data migration history](https://docs.autocalls.ai/api-reference/white-label/list-data-migration-history.md): one copied assistant, knowledgebase, tool, widget, dashboard, automation flow or voice, or one shared or moved phone number. It is the **Rollback** button of the Migration History table of the Data Migration page of your administration panel. A rollback cannot be undone.

Each row is undone on its own. Rolling back an assistant does not roll back its knowledgebase, tools, automation flows or copied voice: they have their own rows, which [Get data migration](https://docs.autocalls.ai/api-reference/white-label/get-data-migration.md) lists in the assistant's `log_ids`. Before you roll back a row, `can_rollback` and `rollback_effect` in the history say whether it is possible and what it will do.

> [!NOTE]
>
> This endpoint is available to the **account owner** (with an active plan) and to team members with **Platform Admin**. Other users receive a 403 Forbidden error. Rows of the owner's own account can be rolled back only by the owner and by team members with **Allow impersonate owner**. A row of another platform returns 404.

### What a rollback does

| Type | What it does | What stays | Refused when |
| - | - | - | - |
| **Assistant** | Deletes the copied assistant, the way the Assistants page does, with its calls, greeting audio, and tool and language links | Its knowledgebase, tools, automation flows and copied voice (their own rows) | A campaign uses the copy |
| **Knowledgebase** | Unlinks the copied knowledgebase from every assistant, then deletes it with its documents | | |
| **Tool** | Detaches the copied tool from every assistant and deletes it | Its copied automation flow (its own row) | |
| **Widget** | Deletes the copied widget | Dashboards that show it keep an empty tile | |
| **Dashboard** | Deletes the copied dashboard and the widgets copied with it | | |
| **Automate Flow** | Deletes the copied automation flow and clears the webhook or tool endpoint that used it | Other assistants or tools of the same migration may still point at it | |
| **Phone (Grant)** | Ends the destination user's access to the number, unassigns it from the destination user's assistants and campaigns, and removes the destination user's WhatsApp sender on that number | The number, with the source user | The access has already ended |
| **Phone (Transfer)** | Gives the number back to the source user, and unassigns it from the destination user's assistants and campaigns | The source user's assistants stay unassigned | The number changed owner since, was migrated again, or has a WhatsApp sender |
| **Voice** | Moves every assistant and call that uses the copied voice to the default voice of the assistant's language, then deletes the copy | | A language of those assistants has no default voice. The history does not check this in advance: the rollback finds it |

Every type is also refused:

* **When the row is not `completed`**: it was already rolled back. The message is `Can only rollback completed migrations.`
* **While a migration of your platform is queued or running**, whether it was started from the API, the AI connector or the Data Migration page. The message is `A migration is running on your platform. Try again when it finishes.` Meanwhile the history shows its `completed` rows with `can_rollback` set to `false` and this text. [List data migrations](https://docs.autocalls.ai/api-reference/white-label/list-data-migrations.md) shows when no migration is `queued` or `running` any more.
* **While another rollback of your platform is running at the same moment**, from any administrator or channel. The message is `Another rollback is in progress. Try again in a moment.` Send the request again a moment later.

Refusals return 422, and nothing changes.

### Path Parameters

**id** `integer` *required*

The ID of the history row, from [List data migration history](https://docs.autocalls.ai/api-reference/white-label/list-data-migration-history.md) or the `log_ids` of [Get data migration](https://docs.autocalls.ai/api-reference/white-label/get-data-migration.md).

The request has no body.

### Response

**message** `string`

`Migration rolled back.`

**data** `object`

The row, as in [List data migration history](https://docs.autocalls.ai/api-reference/white-label/list-data-migration-history.md), with the status `rolled_back`, `can_rollback` set to `false` and `rollback_blocked_reason` set to `Can only rollback completed migrations.`, as the history shows it from now on

```json 200 Rolled Back theme={null}
{
  "message": "Migration rolled back.",
  "data": {
    "id": 816,
    "run_id": 55,
    "type": "Phone (Grant)",
    "source_user": { "id": 12, "name": "Jane Cooper" },
    "destination_user": { "id": 34, "name": "John Smith" },
    "source_entity_id": 7,
    "destination_entity_id": 44,
    "slug": null,
    "flow_id": null,
    "destination_flow_id": null,
    "status": "rolled_back",
    "created_at": "2026-11-03T10:15:20+00:00",
    "can_rollback": false,
    "rollback_blocked_reason": "Can only rollback completed migrations.",
    "rollback_effect": "Ends the destination user's access to the number, unassigns it from the destination user's assistants and campaigns, and removes the destination user's WhatsApp sender on that number."
  }
}
```

```json 401 Unauthenticated theme={null}
{
  "message": "Unauthenticated."
}
```

```json 403 Not Administrator theme={null}
{
  "message": "You are not an administrator."
}
```

```json 403 No Data Migration Access theme={null}
{
  "message": "You do not have access to data migration."
}
```

```json 404 Migration Not Found theme={null}
{
  "message": "Migration not found."
}
```

```json 422 Already Rolled Back theme={null}
{
  "message": "Can only rollback completed migrations."
}
```

```json 422 Used by a Campaign theme={null}
{
  "message": "Cannot rollback: This assistant is attached to campaign(s): campaign #212. Please remove the assistant from these campaigns first, then try again."
}
```

```json 422 Number Changed Owner theme={null}
{
  "message": "This number changed owner after the migration, so it cannot be rolled back."
}
```

```json 422 No Default Voice theme={null}
{
  "message": "No default voice is available for Romanian. Choose another voice on these assistants first."
}
```

```json 422 Owner's Account theme={null}
{
  "message": "Only the platform owner, or an admin allowed to open the owner's account, can roll back the owner's migrations."
}
```

```json 422 Migration Running theme={null}
{
  "message": "A migration is running on your platform. Try again when it finishes."
}
```

```json 422 Rollback in Progress theme={null}
{
  "message": "Another rollback is in progress. Try again in a moment."
}
```

```json 422 Could Not Roll Back theme={null}
{
  "message": "Could not rollback migration. Please try again or contact support."
}
```

```json 429 Too Many Requests theme={null}
{
  "message": "Too Many Attempts."
}
```

```json 429 Platform Limit theme={null}
{
  "message": "Too many data migration requests on your platform. Try again in 42 seconds."
}
```

### Rate limit

The data migration endpoints count toward the limit of 60 requests per minute for each account that the administration endpoints share. Rolling back also has its own limit: 20 per minute for each account, and 20 per minute for your whole platform, counted together for the API, the AI connector and the Data Migration page. Above a limit it returns `429`, and the `Retry-After` response header tells you how many seconds to wait.

### Example

```bash theme={null}
curl -X POST https://app.autocalls.ai/api/white-label/data-migration/history/816/rollback \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.