---
title: "Revert a data import"
method: POST
path: "/data-import/{id}/revert"
tags: ["Data Import"]
---

# Revert a data import

`POST /data-import/{id}/revert`

## Request

- Base URL: `https://api.surense.com/api/v1`
- URL: `https://api.surense.com/api/v1/data-import/{id}/revert`
- Auth: OAuth 2
  - Client credentials
  - Token URL: `https://api.surense.com/oauth/token` scopes: `data_import:import`

Requests the cancellation of a finished import: publishes a data-import-reverted event, which downstream consumers process asynchronously to undo the import (the record's `revertedAt` / `revertedBy` reflect a completed revert). Returns **202 Accepted** with no body.

**Authorization:** requires the `data_import:import` scope **and** the caller must be an agency owner or an agency admin. The record must belong to the caller's tenant.

**Errors:** 400 if the record does not exist, was already reverted, or is not finished yet (status other than `PROCESSED` / `FAILED`); 403 if the provider does not allow cancellation (`cancelAllowed: false`) or the caller lacks the scope/role.

## Path parameters

- `id` string, uuid, required

## Response `202`

The revert was requested and will be processed asynchronously

## Other responses

- `400`: Unknown record, already reverted, or import still in progress
- `403`: Missing scope, caller is not an agency owner/admin, or the provider does not allow cancellation

---

[API](https://skmtc.dev/surense/apis/data-import-api.md) - [All operations](https://skmtc.dev/surense/apis/data-import-api/llms.txt) - [OpenAPI document](https://skmtc.dev/surense/apis/data-import-api/revisions/cf169afb2d5b?raw)
