# POST /api/v1/counterparty-naming/reset

> Reset a counterparty group to its detected names

- **Tag:** counterparty-naming
- **Operation ID:** `reset_counterparty`

## Description

Recomputes the deterministic detected name (known merchant patterns, then descriptor cleanup) from each transaction's description, clears the registry link and any alias for the group. No AI is involved. Send ``dry_run`` to list the rows that would change with a ``plan_hash``; send that ``plan_hash`` on the apply and it is refused (VALIDATION_640) if the rows moved.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Request body

Schema: `ResetCounterpartyRequest`

- `counterparty_name` (string · required)
- `registry_id` (string)
- `dry_run` (boolean) — List the rows that would change and a ``plan_hash``; change nothing.
- `plan_hash` (string) — The ``plan_hash`` a dry run returned. If the rows moved since, the reset is refused (VALIDATION_640) and you preview again.

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_ResetCounterpartyResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (ResetCounterpartyResponse)

### 401 — Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 403 — Forbidden - Insufficient permissions

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 422 — Validation Error

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/counterparty-naming/reset' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "counterparty_name": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/counterparty-naming/reset', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "counterparty_name": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {'counterparty_name': 'string'}

response = httpx.post("https://api.ondayzero.com/api/v1/counterparty-naming/reset", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/counterparty-naming/reset-counterparty
- OpenAPI slice: https://www.ondayzero.com/docs/reference/counterparty-naming/reset-counterparty/openapi.json
- Other endpoints in **counterparty-naming**: https://www.ondayzero.com/docs/reference/counterparty-naming (markdown bundle: https://www.ondayzero.com/docs/reference/counterparty-naming.md, OpenAPI: https://www.ondayzero.com/docs/reference/counterparty-naming/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
