Update a fixed asset type

Operation ID: updateFixedAssetType

Group: Accounting › Asset Management › Fixed Asset Types

Open in the interactive reference

PATCH /fixed-asset-types/{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 fixed asset type, the same as editing it on the Fixed Asset Type page in Lensing. Send only the fields you want to change; a field you leave out keeps its value. Every input has the name and type GET fixed-asset-types/:id returns, so you can send back what you read.

bookIds is the whole set. When you send it, the type ends up in exactly those books: a book you leave out is removed, a new one is added. Leave bookIds out to keep the books as they are. A book you add must be a full book, not an adjustment book, or the request fails with BOOK_NOT_FULL. An empty array fails with AT_LEAST_ONE_BOOK_REQUIRED, and so does leaving bookIds out for a type that is in no book today (only types that predate the rule can be): send it its books.

Removing a book changes depreciation policies, so it must be confirmed. A depreciation policy of a removed book may have a rule for this type. Saving the removal changes that policy: a rule that fixed assets use is marked unavailable (the assets keep it, but no new asset can use the type in that book), an unused rule is deleted, and a policy left without an available rule is deactivated, or deleted when it has no rule left at all. Without confirmBookRemoval: true, such a request fails with BOOK_REMOVAL_AFFECTS_DEPRECIATION_POLICIES before anything is written; its depreciationPolicyIds names the policies and bookIds the removed books they are in. Send the request again with confirmBookRemoval: true to save it. Removing a book no policy covers needs no confirmation. Adding a book back makes its unavailable rules available again and reactivates their policies.

Send groupId as an empty string to make the type ungrouped. defaultUsefulLife is in months; it can be changed but not cleared.

Every error code below is returned with HTTP status 400; branch on the code. Only the fields below are accepted: a body with any other field, active included, is refused with HTTP 400 'Invalid input' before any code is raised, so that response carries no code; its diagnostics name the unexpected property.

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 Platform id (a UUID) of the fixed asset type to update; bound from the :id path segment.

Request body

Required, application/json: updateFixedAssetTypeInput.

Field Type Required Description
name string no Display name of the fixed asset type. Omit to leave unchanged. Leading and trailing spaces are removed; must not be blank. Not required to be unique. Example: "Heavy machinery".
groupId string no Platform id (a UUID) of the FixedAssetTypeGroup the type belongs to — the groupId GET fixed-asset-types/:id returns. Omit to leave unchanged; send an empty string to make the type ungrouped.
defaultUsefulLife number no Default useful life, in months, that a depreciation policy rule for this type is pre-filled with. A whole number from 1 to 2147483647. Omit to leave unchanged. It cannot be cleared here, only changed. Fixed assets already created keep the useful life they have. Example: 84.
bookIds array<string> no Platform ids (UUIDs) of the accounting books the type is in — the whole set, not the change. See id on GET accounting/books/:id. At least one; a book you add must be a full book (not an adjustment book). Omit to leave the books unchanged; a type that is in no book (possible only for types that predate this rule) must be sent bookIds, or the request fails with AT_LEAST_ONE_BOOK_REQUIRED. Removing a book a depreciation policy covers for this type needs confirmBookRemoval.
confirmBookRemoval boolean no Set to true to accept the depreciation policy changes that removing a book causes; see BOOK_REMOVAL_AFFECTS_DEPRECIATION_POLICIES. Only together with bookIds. Omit or send false to have such a request refused instead.
{}

Response

200 Success

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

Response headers

Errors

Code Status
NOT_FOUND 400
GROUP_NOT_FOUND 400
BOOK_NOT_FOUND 400
BOOK_NOT_FULL 400
AT_LEAST_ONE_BOOK_REQUIRED 400
INVALID_FIELD_VALUE 400
FIELD_REQUIRED 400
FIELD_NOT_APPLICABLE 400
BOOK_REMOVAL_AFFECTS_DEPRECIATION_POLICIES 400
IDEMPOTENCY_KEY_CONFLICT 409
IDEMPOTENCY_PAYLOAD_MISMATCH 422

Statuses