auto_write
finance

Register, change, dispose of or void a fixed asset, or propose a year's depreciation of one.

Changed on

action picks the act. save: a new asset (no asset_id) or a change to one not yet booked, with description, invested_on, cost, life_years, fiscal_rate and the three account codes; a booked asset is refused. dispose: records the disposal on disposed_on for proceeds and books nothing. void: a wrongly registered asset, with a reason; a booked asset is refused. propose_depreciation: a proposal (nothing booked) of fiscal_year's depreciation of asset_id, at the amount Magistry's engine computes from the stored asset — a caller never states it — at the end of that fiscal year; a year whose period is closed answers 409 period_closed. The result's id is the asset (save, dispose, void) or the proposal (propose_depreciation). A write: needs finance:write and an app Magistry has reviewed for finance, the book capability on the entity (Postgres asks the granting person's role and the app's grant), the platform switch api_finance_manage (until it is on this answers 403 finance_feature_off and writes nothing) and the annual accounts switch, which the database asserts (403 finance_feature_off, feature annual_accounts). Deciding a depreciation proposal (posting, withdrawing or reversing it) is a person's act in Books → Annual → Assets and is not offered. Costs 3 rate credits. Requires an Idempotency-Key header (or idempotency_key, 8 to 255 characters, the same one if both are sent): without one this answers 400 idempotency_required and writes nothing. A retry with the same key and the same arguments answers the first result without writing again; the same key with other arguments is 409 idempotency_conflict, while the first request is still running 409 idempotency_in_flight, and once a first request that never finished is past its window 409 idempotency_outcome_unknown (read the books, then a new key).

post/api/v1/finance/annual/fixed-assets

Request

  • Base URL
    https://app.magistry.io
  • Auth
    • HTTP bearer
    • or OAuth 2
      Authorization codehttps://app.magistry.io/api/oauth/authorize
      Token URLhttps://app.magistry.io/api/oauth/token
      Scopesfinance:write

Headers

Idempotency-Key, string

Required, here or as idempotency_key in the body. A unique string you choose for this request; send the SAME key when retrying and the first answer is returned instead of writing twice (idempotent-replayed: true). The same key with other arguments is 409 idempotency_conflict. If the header and idempotency_key are both sent they must be equal.

Request body

object required
entity_id, string uuid required

The entity, one of those this app was granted (GET /api/v1/finance/entities lists them).

action, 'save' | 'dispose' | 'void' | 'propose_depreciation' required

The act.

asset_id, string uuid

The asset. Required for dispose, void and propose_depreciation; omitted on save to register a new one.

description, string

save: what the asset is.

category, 'tangible' | 'intangible' | 'goodwill'

save: the kind of asset (default tangible).

invested_on, string date

save: the day it was acquired.

cost, string

save: the acquisition cost. A decimal string in the entity's currency, at most two decimals.

residual, string

save: the residual value at the end of its life (default 0). A decimal string in the entity's currency, at most two decimals.

life_years, integer

save: the commercial useful life in years.

fiscal_rate, string

save: the fiscal depreciation rate per year as a fraction, e.g. 0.2.

kia_claimed, boolean

save: whether the small-scale investment allowance (KIA) is claimed on it.

kia_excluded, boolean

save: whether the asset is excluded from the KIA.

asset_account_code, string

save: the balance-sheet account the asset sits on. An account code of this entity's chart (GET /api/v1/finance/accounts).

accumulated_account_code, string

save: the accumulated depreciation account. An account code of this entity's chart (GET /api/v1/finance/accounts).

expense_account_code, string

save: the depreciation expense account. An account code of this entity's chart (GET /api/v1/finance/accounts).

disposed_on, string date

dispose: the day of disposal.

proceeds, string

dispose: what the disposal brought in (0 when nothing). A decimal string in the entity's currency, at most two decimals.

reason, string

void: why the asset was registered wrongly.

fiscal_year, integer

propose_depreciation: the fiscal year.

idempotency_key, string required

Same as the Idempotency-Key header; give one of the two.

Response

Result

object required
ok, boolean required
result, unknown required

Changes

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    • warning

      added the new method_not_allowed enum value to the error response property for the response status

    11 more changes in this revision