# Update a depreciation policy

Operation ID: `updateDepreciationPolicy`

Group: Accounting › Asset Management › Depreciation Policies

[Open in the interactive reference](https://docs.api.lensing.ai/lensing/v1/endpoints/updateDepreciationPolicy)

`PATCH /depreciation-policies/{id}`

Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.

Updates a depreciation policy, the same as editing it on the depreciation policies page in Lensing. Send only the fields you want to change: a field you leave out keeps its value.

To start from GET depreciation-policies/:id, leave out what the server owns — `depreciationPolicyNumber`, `active` and `lastModifiedDate` — and send the rules through the operations below, not as `rules`. The `id` goes in the path.

`entityIds` is written as a whole set: leave it out to keep the legal entities, send it to replace them (a stored legal entity you do not send is removed), or send an empty array to clear them.

The rules are changed through three operations, each naming a rule by its `fixedAssetTypeId`: `createRules` adds a rule for a type the policy has no rule for, `updateRules` changes a stored rule (a field you leave out keeps its value), and `deleteRules` removes rules. A type can appear in one operation only. A policy must keep at least one rule (MISSING_DEPRECIATION_RULES), and a rule that fixed assets use cannot be removed (USED_FIXED_ASSET_TYPE); an updated rule stays linked to the fixed assets scheduled under it.

Editing a policy does not recalculate anything. Fixed assets already scheduled under the policy keep their depreciation schedules; the changes apply to fixed assets registered or scheduled afterwards. The policy's status (active or inactive) does not change. An inactive policy is not checked against the active policies for DUPLICATE_FIXED_ASSET_ENTITY; that check applies when it is activated.

When you change `depreciationMethod` to 'Immediate' or 'Bypassed' and leave out `depreciationConvention`, the convention is cleared, since those methods take none. For any other method, send the convention it takes if the stored one does not fit, or the request fails with DEPRECIATION_CONVENTION_REQUIRED or UNSUPPORTED_DEPRECIATION_CONVENTION. Send an empty `description` to clear it.

Every reference is an id (a UUID). Every error is returned with HTTP status 400. Branch on the code.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | string · v1 | yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version `v1`. |
| `Idempotency-Key` | header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with `400 IDEMPOTENCY_NOT_SUPPORTED` rather than silently ignored. |
| `id` | path | string | yes | The unique identifier of the depreciation policy to update. Example: `"b1d4c8f2-5a37-4e91-8c62-9f0a3d7e14b5"`. |

## Request body

Required, `application/json`: updateDepreciationPolicyInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no | The name of the depreciation policy. Unique within the tenant. Not blank. Omit to leave unchanged. Example: `"Office Equipment — 4 Year Straight Line"`. |
| `description` | string | no | A description of the depreciation policy. Omit to leave unchanged; send an empty string to clear it. |
| `depreciationMethod` | string | no | The depreciation method. Omit to leave unchanged. Fixed assets already set up keep their method. One of: `"StraightLine"`, `"Degressive"`, `"Immediate"`, `"Bypassed"`. |
| `depreciationConvention` | string | no | How the method treats time. 'StraightLine' accepts all of them, 'Degressive' only 'FullMonth', and 'Immediate' and 'Bypassed' none. Omit to leave unchanged; it is cleared when depreciationMethod changes to 'Immediate' or 'Bypassed'. One of: `"FullMonth"`, `"MidMonth"`, `"MidYear"`, `"SixMonthRule"`, `"ProrateFirstLast"`, `"ActualDays"`. |
| `depreciationInterval` | string | no | The length of each depreciation period. Omit to leave unchanged. One of: `"Monthly"`, `"Quarterly"`, `"Yearly"`. |
| `bookId` | string | no | The accounting book the depreciation policy applies to. See id on GET accounting/books/:id. Omit to leave unchanged. |
| `assetAccountId` | string | no | The balance sheet account that holds the cost of fixed assets under this policy. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
| `accumulatedDepreciationAccountId` | string | no | The accumulated depreciation account. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
| `depreciationExpenseAccountId` | string | no | The depreciation expense account. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
| `gainAccountId` | string | no | The account for gains on disposal. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
| `lossAccountId` | string | no | The account for losses on disposal. See id on GET accounting/accounts/:id. Omit to leave unchanged. |
| `entityIds` | array<string> | no | The legal entities the depreciation policy is set up for, as a whole set: each at most once, and a stored legal entity you leave out is removed. See id on GET base/entities. Omit to leave unchanged; send an empty array to clear them. |
| `createRules` | array<object> | no | Rules to add, one per fixed asset type the policy has no rule for yet (a type it has one for fails with DUPLICATE_FIXED_ASSET_TYPE_IDS). Example: `[{"fixedAssetTypeId":"5e1c7a92-3d48-4b06-8f21-9a6d0c3e7b15","usefulLife":3,"usefulLifeDurationType":"year","minimumAmount":"250","currency":"USD","belowThresholdDepreciationMethod":"expense"}]`. |
| `createRules[].fixedAssetTypeId` | string | yes | The fixed asset type to add a rule for. The policy must not have a rule for it yet. |
| `createRules[].code` | string | no | A free-text code for the rule. An empty string is treated as absent. |
| `createRules[].usefulLife` | number | no | The useful life, a whole number of at least 1, counted in `usefulLifeDurationType` units. Required for 'year' and 'month' (MISSING_DEPRECIATION_POLICY_USEFUL_LIFE); refused with FIELD_NOT_APPLICABLE for 'custom'. |
| `createRules[].usefulLifeDurationType` | string | yes | The unit of `usefulLife`. One of: `"year"`, `"month"`, `"custom"`. |
| `createRules[].minimumAmount` | decimal | yes | The capitalization threshold, in the rule's currency (see `currency`). Not negative. |
| `createRules[].currency` | string | yes | The ISO 4217 code of the currency `minimumAmount` is in. Must be a currency the tenant defines. |
| `createRules[].belowThresholdDepreciationMethod` | string | yes | How a fixed asset below the capitalization threshold is treated. One of: `"capitalizeAndDepreciateUsefulLife"`, `"capitalizeAndDepreciateImmediately"`, `"expense"`. |
| `createRules[].available` | boolean | no | Whether the rule can be used for new fixed assets. Defaults to true. |
| `updateRules` | array<object> | no | Rules to change, each matched by fixedAssetTypeId to a stored rule (DEPRECIATION_RULE_NOT_FOUND if the policy has none for it). A field you leave out keeps its value. Example: `[{"fixedAssetTypeId":"7b2f9d13-4c68-4e51-a0d7-6f39c58e2b4a","usefulLife":4}]`. |
| `updateRules[].fixedAssetTypeId` | string | yes | The fixed asset type of the stored rule to change. |
| `updateRules[].code` | string | no | A free-text code for the rule. Omit to leave unchanged; send an empty string to clear it. |
| `updateRules[].usefulLife` | number | no | The useful life, a whole number of at least 1, counted in `usefulLifeDurationType` units. Omit to leave unchanged. It cannot be cleared on a 'year' or 'month' rule (MISSING_DEPRECIATION_POLICY_USEFUL_LIFE); changing the term to 'custom' clears it, and sending one for a 'custom' rule fails with FIELD_NOT_APPLICABLE. |
| `updateRules[].usefulLifeDurationType` | string | no | The unit of `usefulLife`. Omit to leave unchanged. One of: `"year"`, `"month"`, `"custom"`. |
| `updateRules[].minimumAmount` | decimal | no | The capitalization threshold, in the rule's currency (see `currency`). Not negative. Omit to leave unchanged. |
| `updateRules[].currency` | string | no | The ISO 4217 code of the currency `minimumAmount` is in. Must be a currency the tenant defines. Omit to leave unchanged. |
| `updateRules[].belowThresholdDepreciationMethod` | string | no | How a fixed asset below the capitalization threshold is treated. Omit to leave unchanged. One of: `"capitalizeAndDepreciateUsefulLife"`, `"capitalizeAndDepreciateImmediately"`, `"expense"`. |
| `updateRules[].available` | boolean | no | Whether the rule can be used for new fixed assets. Omit to leave unchanged. |
| `deleteRules` | array<string> | no | The fixedAssetTypeIds of the rules to remove (DEPRECIATION_RULE_NOT_FOUND if the policy has none for one). A rule fixed assets use cannot be removed (USED_FIXED_ASSET_TYPE). Example: `["0f4b8d26-7a19-4c53-b2e8-1d6a9f3c5e70"]`. |

```json
{}
```

## Response

`200` Success

```json
{
  "data": {},
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## Response headers

- `Idempotency-Replayed` — Present and `true` only when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent as `false`.

## Errors

| Code | Status |
| --- | --- |
| `NOT_FOUND` | 400 |
| `BOOK_NOT_FOUND` | 400 |
| `ACCOUNT_NOT_FOUND` | 400 |
| `ENTITY_NOT_FOUND` | 400 |
| `FIXED_ASSET_TYPE_NOT_FOUND` | 400 |
| `DEPRECIATION_RULE_NOT_FOUND` | 400 |
| `INVALID_FIELD_VALUE` | 400 |
| `FIELD_NOT_APPLICABLE` | 400 |
| `MISSING_DEPRECIATION_RULES` | 400 |
| `DEPRECIATION_CONVENTION_REQUIRED` | 400 |
| `UNSUPPORTED_DEPRECIATION_CONVENTION` | 400 |
| `CUSTOM_TERM_FISCAL_YEAR_CONVENTION` | 400 |
| `DUPLICATE_POLICY_NAME` | 400 |
| `DUPLICATE_FIXED_ASSET_TYPE_IDS` | 400 |
| `USED_FIXED_ASSET_TYPE` | 400 |
| `MISSING_DEPRECIATION_POLICY_USEFUL_LIFE` | 400 |
| `DUPLICATE_FIXED_ASSET_ENTITY` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: NOT_FOUND, BOOK_NOT_FOUND, ACCOUNT_NOT_FOUND, ENTITY_NOT_FOUND, FIXED_ASSET_TYPE_NOT_FOUND, DEPRECIATION_RULE_NOT_FOUND, INVALID_FIELD_VALUE, FIELD_NOT_APPLICABLE, MISSING_DEPRECIATION_RULES, DEPRECIATION_CONVENTION_REQUIRED, UNSUPPORTED_DEPRECIATION_CONVENTION, CUSTOM_TERM_FISCAL_YEAR_CONVENTION, DUPLICATE_POLICY_NAME, DUPLICATE_FIXED_ASSET_TYPE_IDS, USED_FIXED_ASSET_TYPE, MISSING_DEPRECIATION_POLICY_USEFUL_LIFE, DUPLICATE_FIXED_ASSET_ENTITY
- `401` — The request carries no valid access token.
- `403` — Not authorized
- `404` — Not found
- `409` — The Idempotency-Key is still being processed by another request.
- `422` — The Idempotency-Key was already used with a different request payload.
- `429` — Too many requests from this client address. The response has no body and no `Retry-After` header.
- `500` — Internal server error
