# PATCH /api/v1/businesses/{business_id}/line-entries/recategorize

> Recategorize line entries

- **Tag:** businesses
- **Operation ID:** `recategorize_line_entries_api_v1_businesses__business_id__line_entries_recategorize_patch`

## Description

Move line entries to a different ledger. Used for journal-entry lines that have no bank transaction.

## Authentication

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

## Parameters

- `business_id` (path, string, required)

## Request body

Schema: `RecategorizeLineEntriesRequest`

- `line_entry_ids` (array · string · required) — IDs of the line entries to recategorize.
- `ledger_id` (string · required) — Target ledger to move the line entries into.

## Responses

### 200 — Successful Response

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 404 — Not Found - Resource does not exist

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X PATCH 'https://api.ondayzero.com/api/v1/businesses/{business_id}/line-entries/recategorize' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "line_entry_ids": [],
  "ledger_id": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/businesses/{business_id}/line-entries/recategorize', {
  method: 'PATCH',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "line_entry_ids": [],
  "ledger_id": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "line_entry_ids": [],
  "ledger_id": "string"
}

response = httpx.patch("https://api.ondayzero.com/api/v1/businesses/{business_id}/line-entries/recategorize", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/businesses/recategorize-line-entries
- OpenAPI slice: https://www.ondayzero.com/docs/reference/businesses/recategorize-line-entries/openapi.json
- Other endpoints in **businesses**: https://www.ondayzero.com/docs/reference/businesses
