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

# Accept Changes

> Accept every tracked change in a DOCX and get a clean copy.

> [!NOTE]
>
> **Preview.** This endpoint is available to organisations in the Wordsmith MCP pilot. Other organisations receive `403 mcp_not_enabled`. See the [preview overview](/preview).

Accepts every tracked change in a DOCX, as Word's "Accept All Changes" does, and returns a clean copy. Insertions and moves are kept, deletions are dropped, and pending formatting changes are applied. Optionally it also removes editing restrictions. The original file is not changed.

A file with no tracked changes still succeeds. The output is then a copy, and `summary.changes_accepted` is `0`.

The action runs as an operation of type `document_action`: the response comes back straight away, and the work runs in the background. Wait for it with `wait`, a `callback_url`, or [Get Operation](/api-reference/operations/get-operation). The new files land in your private space. The input files are not changed. Document actions use no credits.

## Authentication

Send an API key, or an OAuth access token with both the `files:write` and `files:read` scopes. `files:write` lets the action create its output; `files:read` lets it read the inputs. A token without either gets `403` with `"error": "insufficient_scope"`.

## Path parameters

**file\_id** `string (uuid)` *required*

The file to clean. Must be a DOCX.

## Headers

**Idempotency-Key** `string`

A unique key for this request, such as a UUID, up to 255 characters. A repeat with the same key within 30 days returns `200` with the same operation and does the work once. A repeat with a different body returns `409 idempotency_key_reused`.

## Body parameters

The body is optional: send `{}` or nothing for the defaults.

**remove\_protection** `boolean` (default: false)

Also remove editing restrictions, such as "tracked changes only" or "read only". This does not remove a password that encrypts the file.

**wait** `integer` (default: 0)

Seconds to wait for the action to finish before responding, from `0` to `20`. Most documents finish inside `20`.

**callback\_url** `string`

A public HTTPS URL that receives a signed `operation.succeeded`, `operation.failed` or `operation.cancelled` event when the action finishes. API keys only: an OAuth caller waits or polls instead.

## Response

Returns `202` with an operation of type `document_action`. Its `resource` is the input file. A repeat with the same `Idempotency-Key` returns `200` with the same operation.

When `status` is `succeeded`, `result` is `{ "action": "accept_changes", "file_ids", "summary" }`. `file_ids` holds one id: the clean DOCX. `summary` is `{ "changes_accepted", "protection_removed" }`: how many tracked changes were accepted, and whether editing restrictions were removed.

When `status` is `failed`, `error.code` says why:

| `error.code` | When |
| - | - |
| `resource_not_found` | An input was deleted, or your access to it removed, before the work ran. |
| `invalid_document` | An input could not be read: it is damaged, password-protected or not a valid DOCX or PDF. Retrying does not help. |
| `action_failed` | The action failed for another reason. `error.retryable` is `true`: try again. |

**id** `string (uuid)`

The operation's id.

**type** `string`

`document_action`.

**status** `string`

`queued` until a worker starts the action, then `running`, `succeeded`, `failed` or `cancelled`.

**progress** `object | null`

`{ "stage", "completed", "total" }`. `null` until the work starts.

**resource** `object`

`{ "type": "file", "id" }`: the input file.

**result** `object | null`

Set when `status` is `succeeded`.

**error** `object | null`

`{ "code", "message", "retryable" }`, set when `status` is `failed`.

**poll\_after\_seconds** `integer | null`

When to ask again. `null` once the operation has finished.

**created\_at** `string`

ISO 8601 UTC.

**updated\_at** `string`

ISO 8601 UTC.

**completed\_at** `string | null`

ISO 8601 UTC, once the operation has finished.

```bash cURL theme={null}
curl -X POST "https://api.wordsmith.ai/api/v1/files/9a1d7e44-2b6c-4f08-8d3a-71c5e0b9f2a6/accept-changes" \
  -H "Authorization: Bearer sk-ws-api1-your_api_key_here" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: f9c2b7e4-8a1d-4d65-b0e3-4e7a1c9f2d58" \
  -d '{ "remove_protection": true, "wait": 20 }'
```

```json Running theme={null}
{
  "id": "e7055d36-f793-4e3b-a1b3-0ce8e1523879",
  "type": "document_action",
  "status": "running",
  "progress": {
    "stage": "accept_changes",
    "completed": 0,
    "total": 1
  },
  "resource": {
    "type": "file",
    "id": "9a1d7e44-2b6c-4f08-8d3a-71c5e0b9f2a6"
  },
  "result": null,
  "error": null,
  "poll_after_seconds": 5,
  "created_at": "2026-10-13T11:00:00Z",
  "updated_at": "2026-10-13T11:00:01Z",
  "completed_at": null
}
```

```json Succeeded theme={null}
{
  "id": "e7055d36-f793-4e3b-a1b3-0ce8e1523879",
  "type": "document_action",
  "status": "succeeded",
  "progress": {
    "stage": "accept_changes",
    "completed": 1,
    "total": 1
  },
  "resource": {
    "type": "file",
    "id": "9a1d7e44-2b6c-4f08-8d3a-71c5e0b9f2a6"
  },
  "result": {
    "action": "accept_changes",
    "file_ids": [
      "db977dbd-b383-4255-9d2b-c9eef59d469b"
    ],
    "summary": {
      "changes_accepted": 27,
      "protection_removed": true
    }
  },
  "error": null,
  "poll_after_seconds": null,
  "created_at": "2026-10-13T11:00:00Z",
  "updated_at": "2026-10-13T11:00:08Z",
  "completed_at": "2026-10-13T11:00:08Z"
}
```

## Errors

| Status | `error_code` | When |
| - | - | - |
| 400 | `invalid_request_body` | The body is not valid JSON, has an unknown field, or `remove_protection` is not a boolean. |
| 400 | `unsupported_file_type` | The file is not a DOCX. |
| 400 | `invalid_wait` | `wait` is not from `0` to `20`. |
| 400 | `invalid_callback_url` | `callback_url` is not a public HTTPS URL. |
| 400 | `callback_signing_unavailable` | The API key has no webhook secret to sign the callback with. Create a new API key, or long-poll the operation instead. |
| 400 | `bad_request` | `callback_url` was sent with an OAuth token. |
| 403 | `insufficient_scope` | The OAuth token lacks `files:write` or `files:read`. |
| 403 | `forbidden` | Your user may not upload files, so the output has nowhere to go. |
| 404 | `resource_not_found` | The file does not exist, or you cannot read it. |
| 409 | `scan_in_progress` | The file's malware scan has not finished. Retry in a few seconds. |
| 409 | `idempotency_key_reused` | The `Idempotency-Key` was used within 30 days with a different request. |


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