Create a depreciation policy
Operation ID: createDepreciationPolicy
Group: Accounting › Asset Management › Depreciation Policies
Open in the interactive reference
POST /depreciation-policies
Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.
Creates a depreciation policy, the same as saving a new policy on the depreciation policies page in Lensing. The policy is created active.
A policy belongs to one accounting book (bookId) and covers the fixed asset types its rules name, for the legal entities in entityIds. Send at least one rule, and at most one rule per fixed asset type. For each fixed asset type, legal entity and book, only one active policy can exist: a rule whose type another active policy of the same book already covers for one of your legal entities fails with DUPLICATE_FIXED_ASSET_ENTITY.
depreciationConvention is required for the 'StraightLine' and 'Degressive' methods, and must be left out for 'Immediate' and 'Bypassed'. A rule with the 'custom' term takes no usefulLife, and cannot be combined with the 'MidYear' or 'SixMonthRule' convention.
Creating a policy recalculates nothing. It applies to fixed assets registered or scheduled after it exists.
An empty description is treated as absent. Every reference is an id (a UUID). The response contains only the policy's id; read the policy with GET depreciation-policies/:id. 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. |
Request body
Required, application/json: createDepreciationPolicyInput.
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | yes | The name of the depreciation policy. Unique within the tenant; a name another policy has fails with DUPLICATE_POLICY_NAME. Not blank. Example: "Office Equipment — 5 Year Straight Line". |
description |
string | no | A description of the depreciation policy. An empty string is treated as absent. Example: "Standard straight-line write-down for office equipment over five years.". |
depreciationMethod |
string | yes | The method used to spread depreciation over an asset's useful life. Fixed assets of the policy's types take this method when they are set up. One of: "StraightLine", "Degressive", "Immediate", "Bypassed". Example: "StraightLine". |
depreciationConvention |
string | no | How the method treats time. Required for 'StraightLine' (any value) and 'Degressive' (only 'FullMonth'); leave it out for 'Immediate' and 'Bypassed', which take none. One of: "FullMonth", "MidMonth", "MidYear", "SixMonthRule", "ProrateFirstLast", "ActualDays". Example: "FullMonth". |
depreciationInterval |
string | yes | The length of each depreciation period. One of: "Monthly", "Quarterly", "Yearly". Example: "Monthly". |
bookId |
string | yes | The accounting book the depreciation policy applies to. See id on GET accounting/books/:id. Example: "b7c19e04-3f52-4a86-9d13-5e8f2a6c0b47". |
assetAccountId |
string | yes | The balance sheet account that holds the cost of fixed assets under this policy. See id on GET accounting/accounts/:id. Example: "3a5f81c6-9d24-4b70-8e15-6c2b7f094d38". |
accumulatedDepreciationAccountId |
string | yes | The accumulated depreciation account, a contra-asset account. Recording depreciation credits this account. See id on GET accounting/accounts/:id. Example: "9e14d7b2-6c83-4f51-a027-8d3b5e199c61". |
depreciationExpenseAccountId |
string | yes | The depreciation expense account. Recording depreciation debits this account. See id on GET accounting/accounts/:id. Example: "5c2b8a41-7e96-4d03-b158-2f7a9c4e60d5". |
gainAccountId |
string | yes | The account for gains when an asset under this policy is sold for more than its net book value. On most books it is the same account as lossAccountId. See id on GET accounting/accounts/:id. Example: "8f0b3d27-4a19-4c62-9e73-1b5d8a2f7c04". |
lossAccountId |
string | yes | The account for losses when an asset under this policy is disposed of. See id on GET accounting/accounts/:id. Example: "2d7e9a15-8b34-4f07-a5c1-6e0f3b9d472a". |
entityIds |
array<string> | no | The legal entities the depreciation policy is set up for, each at most once. See id on GET base/entities. Defaults to none. Example: ["e3a9c2d1-4b5f-4d6e-8a7b-9c0d1e2f3a4b"]. |
rules |
array<object> | yes | The depreciation rules: at least one, and at most one per fixed asset type. Example: [{"fixedAssetTypeId":"7b2f9d13-4c68-4e51-a0d7-6f39c58e2b4a","usefulLife":5,"usefulLifeDurationType":"year","minimumAmount":"500","currency":"USD","belowThresholdDepreciationMethod":"expense"}]. |
rules[].fixedAssetTypeId |
string | yes | The fixed asset type the rule applies to. |
rules[].code |
string | no | A free-text code for the rule. An empty string is treated as absent. |
rules[].usefulLife |
number | no | The useful life of fixed assets of the type, 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'. |
rules[].usefulLifeDurationType |
string | yes | The unit of usefulLife. With 'custom', each fixed asset sets its own depreciation end date; it cannot be combined with the 'MidYear' or 'SixMonthRule' convention. One of: "year", "month", "custom". |
rules[].minimumAmount |
decimal | yes | The capitalization threshold, in the rule's currency (see currency). Not negative. |
rules[].currency |
string | yes | The ISO 4217 code of the currency minimumAmount is in. Must be a currency the tenant defines. |
rules[].belowThresholdDepreciationMethod |
string | yes | How a fixed asset below the capitalization threshold is treated: 'capitalizeAndDepreciateUsefulLife' (depreciated over the useful life like any other), 'capitalizeAndDepreciateImmediately' (depreciated in full in the first period), 'expense' (not depreciated). One of: "capitalizeAndDepreciateUsefulLife", "capitalizeAndDepreciateImmediately", "expense". |
rules[].available |
boolean | no | Whether the rule can be used for new fixed assets. Defaults to true. |
{
"name": "Office Equipment — 5 Year Straight Line",
"depreciationMethod": "StraightLine",
"depreciationInterval": "Monthly",
"bookId": "b7c19e04-3f52-4a86-9d13-5e8f2a6c0b47",
"assetAccountId": "3a5f81c6-9d24-4b70-8e15-6c2b7f094d38",
"accumulatedDepreciationAccountId": "9e14d7b2-6c83-4f51-a027-8d3b5e199c61",
"depreciationExpenseAccountId": "5c2b8a41-7e96-4d03-b158-2f7a9c4e60d5",
"gainAccountId": "8f0b3d27-4a19-4c62-9e73-1b5d8a2f7c04",
"lossAccountId": "2d7e9a15-8b34-4f07-a5c1-6e0f3b9d472a",
"rules": [
{
"fixedAssetTypeId": "7b2f9d13-4c68-4e51-a0d7-6f39c58e2b4a",
"usefulLife": 5,
"usefulLifeDurationType": "year",
"minimumAmount": "500",
"currency": "USD",
"belowThresholdDepreciationMethod": "expense"
}
]
}
Response
200 Success
Under data (createDepreciationPolicyOutput):
| Field | Type | Required | Description |
|---|---|---|---|
id |
string | yes | The unique identifier for the created depreciation policy. Example: "b1d4c8f2-5a37-4e91-8c62-9f0a3d7e14b5". |
{
"data": {
"id": "b1d4c8f2-5a37-4e91-8c62-9f0a3d7e14b5"
},
"diagnostics": [
{
"code": "<code>",
"message": "<message>",
"severity": "error",
"path": [
"<path>"
],
"details": "<details>"
}
]
}
Response headers
Idempotency-Replayed— Present andtrueonly 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 asfalse.
Errors
| Code | Status |
|---|---|
BOOK_NOT_FOUND |
400 |
ACCOUNT_NOT_FOUND |
400 |
ENTITY_NOT_FOUND |
400 |
FIXED_ASSET_TYPE_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 |
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: BOOK_NOT_FOUND, ACCOUNT_NOT_FOUND, ENTITY_NOT_FOUND, FIXED_ASSET_TYPE_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, MISSING_DEPRECIATION_POLICY_USEFUL_LIFE, DUPLICATE_FIXED_ASSET_ENTITY401— The request carries no valid access token.403— Not authorized404— Not found409— 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 noRetry-Afterheader.500— Internal server error