# PUT /api/v1/journal-entries/{journal_entry_id}

> Update journal entry

- **Tag:** journal-entries
- **Operation ID:** `update_journal_entry`

## Description

Update an existing journal entry's description, date, or line entries.

## Authentication

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

## Parameters

- `journal_entry_id` (path, string, required)

## Request body

Schema: `JournalEntryUpdateRequest`

- `description` (string) — Updated description for the journal entry.
- `date` (string) — Updated date in ISO 8601 format (e.g., '2024-01-15').
- `line_entry_changes` (object) — Object containing arrays of line entry changes. Supports 'create' (new entries), 'update' (modify existing by ID), and 'delete' (remove by ID) operations.
- `invoice_id` (string) — Send null to unlink this entry from its invoice. Links are created by the invoice lifecycle and cannot be repointed here.
- `inventory_order_id` (string) — Send null to unlink this entry from its inventory order.
- `credit_memo_id` (string) — Send null to unlink this entry from its credit memo.
- `vendor_credit_id` (string) — Send null to unlink this entry from its vendor credit.
- `production_run_id` (string) — Send null to unlink this entry from its production run.

## Example request

```json
{
  "date": "2024-01-16",
  "description": "Updated: Record sale to customer - Invoice #1234 (corrected)",
  "line_entry_changes": {
    "create": [
      {
        "amount": 5000,
        "debit_credit": "debit",
        "description": "Shipping charges",
        "ledger_id": "019ab37c-f6c4-7d5a-a7f2-8d4c5e0f1a3c"
      },
      {
        "amount": 5000,
        "debit_credit": "credit",
        "description": "Shipping revenue",
        "ledger_id": "019ab37c-d4a2-7b38-85f0-6b2a3c8e9f1a"
      }
    ],
    "delete": [
      "019ab37c-b2c3-7d4e-f5a6-7b8c9d0e1f2a"
    ],
    "update": [
      {
        "description": "Updated line entry description",
        "id": "019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f"
      }
    ]
  }
}
```

## Responses

### 200 — Successful Response

Schema: `SuccessEnvelope_JournalEntryResponse_`

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

### 400 — Bad Request - Invalid input

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.

### 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.

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

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 PUT 'https://api.ondayzero.com/api/v1/journal-entries/{journal_entry_id}' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "date": "2024-01-16",
  "description": "Updated: Record sale to customer - Invoice #1234 (corrected)",
  "line_entry_changes": {
    "create": [
      {
        "amount": 5000,
        "debit_credit": "debit",
        "description": "Shipping charges",
        "ledger_id": "019ab37c-f6c4-7d5a-a7f2-8d4c5e0f1a3c"
      },
      {
        "amount": 5000,
        "debit_credit": "credit",
        "description": "Shipping revenue",
        "ledger_id": "019ab37c-d4a2-7b38-85f0-6b2a3c8e9f1a"
      }
    ],
    "delete": [
      "019ab37c-b2c3-7d4e-f5a6-7b8c9d0e1f2a"
    ],
    "update": [
      {
        "description": "Updated line entry description",
        "id": "019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f"
      }
    ]
  }
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/journal-entries/{journal_entry_id}', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "date": "2024-01-16",
  "description": "Updated: Record sale to customer - Invoice #1234 (corrected)",
  "line_entry_changes": {
    "create": [
      {
        "amount": 5000,
        "debit_credit": "debit",
        "description": "Shipping charges",
        "ledger_id": "019ab37c-f6c4-7d5a-a7f2-8d4c5e0f1a3c"
      },
      {
        "amount": 5000,
        "debit_credit": "credit",
        "description": "Shipping revenue",
        "ledger_id": "019ab37c-d4a2-7b38-85f0-6b2a3c8e9f1a"
      }
    ],
    "delete": [
      "019ab37c-b2c3-7d4e-f5a6-7b8c9d0e1f2a"
    ],
    "update": [
      {
        "description": "Updated line entry description",
        "id": "019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f"
      }
    ]
  }
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {'date': '2024-01-16',
 'description': 'Updated: Record sale to customer - Invoice #1234 '
                '(corrected)',
 'line_entry_changes': {'create': [{'amount': 5000,
                                    'debit_credit': 'debit',
                                    'description': 'Shipping charges',
                                    'ledger_id': '019ab37c-f6c4-7d5a-a7f2-8d4c5e0f1a3c'},
                                   {'amount': 5000,
                                    'debit_credit': 'credit',
                                    'description': 'Shipping revenue',
                                    'ledger_id': '019ab37c-d4a2-7b38-85f0-6b2a3c8e9f1a'}],
                        'delete': ['019ab37c-b2c3-7d4e-f5a6-7b8c9d0e1f2a'],
                        'update': [{'description': 'Updated line entry '
                                                   'description',
                                    'id': '019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f'}]}}

response = httpx.put("https://api.ondayzero.com/api/v1/journal-entries/{journal_entry_id}", headers=headers, json=payload)
data = response.json()
```

## See also

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