Purpose

The assets route contains all endpoints related to the management of assets.

get all

This endpoint is used to retrieve all assets.

Request:
GET /api/v1/assets/all

Response:

[
    {
        "id": "43e14483-6c56-4e56-a6f9-17917ac5f4c4",
        "user_id": "6b875d6c-7d4e-4ae3-931f-270604df1d7f",
        "name": "SuperStock inc.",
        "description": "A description describing this asset",
        "currency_id": "ffc53ce5-0bd2-4464-94b3-9866e506fd91",
        "value_per_unit": {
            "major": 10,
            "minor": 50,
            "minor_in_major": 100,
            "symbol": "€",
            "is_negative": false
        },
        "amount": 1.2345,
        "tag_ids": ["baf5ba00-440c-4d8a-a614-be2cbf4c2beb", "61d6ffc7-9d41-4d4d-ac0b-1c4fb92606eb"],
        "total_cost_of_ownership": {
            "total": {
                "major": 10,
                "minor": 50,
                "minor_in_major": 100,
                "symbol": "€",
                "is_negative": false
            },
            "monthly": {
                "major": 10,
                "minor": 50,
                "minor_in_major": 100,
                "symbol": "€",
                "is_negative": false
            },
            "yearly": {
                "major": 10,
                "minor": 50,
                "minor_in_major": 100,
                "symbol": "€",
                "is_negative": false
            }
        }
    }
]
PropertyDescriptionTypeFilterableSortable
idthe id of the assetUUIDv4YesYes
user_idthe id of the user owning this assetUUIDv4NoNo
namethe name of the assetstringYesYes
descriptionthe description of the assetstring?YesYes
currency_idthe id of the currency this asset is usingUUIDv4NoNo
value_per_unitthe value of a single unit of this assetMoney?YesYes
amountthe total amount of items belonging to this assetnumber?YesYes
tag_idsthe ids of tags this transaction belongs toUUIDv4[]YesNo
total_cost_of_ownershipthe total cost of ownership on a total, monthly and yearly basisObject?NoNo

get by id

This endpoint is used to retrieve a single asset by its id. You need to specify the id of the asset you want to retrieve in the request path.

Request:
GET /api/v1/assets/{assets_id}

Response:

{
    "id": "43e14483-6c56-4e56-a6f9-17917ac5f4c4",
    "user_id": "6b875d6c-7d4e-4ae3-931f-270604df1d7f",
    "name": "SuperStock inc.",
    "description": "A description describing this asset",
    "currency_id": "ffc53ce5-0bd2-4464-94b3-9866e506fd91",
    "value_per_unit": {
        "major": 10,
        "minor": 50,
        "minor_in_major": 100,
        "symbol": "€",
        "is_negative": false
    },
    "amount": 1.2345,
    "tag_ids": ["baf5ba00-440c-4d8a-a614-be2cbf4c2beb", "61d6ffc7-9d41-4d4d-ac0b-1c4fb92606eb"],
    "total_cost_of_ownership": {
        "total": {
            "major": 10,
            "minor": 50,
            "minor_in_major": 100,
            "symbol": "€",
            "is_negative": false
        },
        "monthly": {
            "major": 10,
            "minor": 50,
            "minor_in_major": 100,
            "symbol": "€",
            "is_negative": false
        },
        "yearly": {
            "major": 10,
            "minor": 50,
            "minor_in_major": 100,
            "symbol": "€",
            "is_negative": false
        }
    }
}
PropertyDescriptionType
idthe id of the assetUUIDv4
user_idthe id of the user owning this assetUUIDv4
namethe name of the assetstring
descriptionthe description of the assetstring?
currency_idthe id of the currency this asset is usingUUIDv4
value_per_unitthe value of a single unit of this assetMoney?
amountthe total amount of items belonging to this assetnumber?
tag_idsthe ids of tags this transaction belongs toUUIDv4[]
total_cost_of_ownershipthe total cost of ownership on a total, monthly and yearly basisObject?

create asset

This endpoint is used to create new assets.

Request:
POST /api/v1/assets

{
    "name": "SuperStock inc.",
    "description": "A description describing this asset",
    "currency_id": "ffc53ce5-0bd2-4464-94b3-9866e506fd91",
    "tag_ids": ["baf5ba00-440c-4d8a-a614-be2cbf4c2beb", "61d6ffc7-9d41-4d4d-ac0b-1c4fb92606eb"],
}
PropertyDescriptionType
namethe name of the assetstring
descriptionthe description of the assetstring?
currency_idthe id of the currency this asset is usingUUIDv4
tag_idsthe ids of tags this transaction belongs toUUIDv4[]

Response:

{
    "id": "43e14483-6c56-4e56-a6f9-17917ac5f4c4"
}

modify asset

This endpoint is used to modify existing assets. You need to specify the id of the asset you want to modify in the request path.

Request:
POST /api/v1/assets/{asset_id}

{
    "name": "SuperStock inc.",
    "description": "A description describing this asset",
    "currency_id": "ffc53ce5-0bd2-4464-94b3-9866e506fd91",
    "tag_ids": ["baf5ba00-440c-4d8a-a614-be2cbf4c2beb", "61d6ffc7-9d41-4d4d-ac0b-1c4fb92606eb"],
}
PropertyDescriptionType
namethe name of the assetstring
descriptionthe description of the assetstring?
currency_idthe id of the currency this asset is usingUUIDv4
tag_idsthe ids of tags this transaction belongs toUUIDv4[]

delete asset

This endpoint is used to delete an existing asset. You need to specify the id of the asset you want to delete in the request path.

Request:
DELETE /api/v1/assets/{asset_id}

get valuation history

This endpoint is used to retrieve the valuation history of a given asset. You need to specify the id of the asset you want to get the valuation history of in the request path.

Request:
GET /api/v1/assets/{asset_id}/valuation_history

Response:

[
    {
        "value_per_unit": {
            "major": 10,
            "minor": 50,
            "minor_in_major": 100,
            "symbol": "€",
            "is_negative": false
        },
        "amount": 1.2345,
        "timestamp": "2023-01-01T10:10:00Z",
        "asset_id": "43e14483-6c56-4e56-a6f9-17917ac5f4c4"
    }
]
PropertyDescriptionType
value_per_unitthe value of a single unit of this assetMoney
amountthe total amount of items belonging to this assetnumber
timestampthe time of the valuationtimestamp
asset_idthe id of the asset this valuation belongs toUUIDv4

replace valuation history

This endpoint is used to replace the entire valuation history of an asset. Used to fix errors in past valuations. You need to specify the id of the asset you want to replace the valuation history of in the request path.
This endpoint does not create transactions for valuations!

Request:
POST /api/v1/assets/{asset_id}/valuation_history

[
    {
        "value_per_unit": {
            "major": 10,
            "minor": 50,
            "minor_in_major": 100,
            "symbol": "€",
            "is_negative": false
        },
        "amount": 1.2345,
        "amount_change": null,
        "timestamp": "2023-01-01T10:10:00Z",
        "cost": {
            "major": 1,
            "minor": 0,
            "minor_in_major": 100,
            "symbol": "€",
            "is_negative": false
        },
        "total_value": {
            "major": 9,
            "minor": 50,
            "minor_in_major": 100,
            "symbol": "€",
            "is_negative": false
        },
        "account_id": "525c32a8-c200-4c5d-a3c7-ef8936cc1c84"
    }
]
PropertyDescriptionType
value_per_unitthe value of a single unit of this assetMoney
amountthe total amount of items belonging to this assetnumber?
amount_changedifference to the previous valuenumber?
timestampthe time of the valuationtimestamp
costadditional costs incurred, doesnt go into valuation calculation, but gets added to the transactionMoney?
total_valueoverwrite the amount * value_per_unit calculation resultMoney?
account_idthe id of the account to use for the transaction that gets created for this valuationUUIDv4

post valuation

This endpoint is used to add a new valuation for a given asset. You need to specify the id of the asset you want to add the valuation to in the request path.
A Transaction gets created automatically for the newly added valuation, if the account_id is set in the request body.

Request:
POST /api/v1/assets/{asset_id}/valuations

{
    "value_per_unit": {
        "major": 10,
        "minor": 50,
        "minor_in_major": 100,
        "symbol": "€",
        "is_negative": false
    },
    "amount": 1.2345,
    "amount_change": null,
    "timestamp": "2023-01-01T10:10:00Z",
    "cost": {
        "major": 1,
        "minor": 0,
        "minor_in_major": 100,
        "symbol": "€",
        "is_negative": false
    },
    "total_value": {
        "major": 9,
        "minor": 50,
        "minor_in_major": 100,
        "symbol": "€",
        "is_negative": false
    },
    "account_id": "525c32a8-c200-4c5d-a3c7-ef8936cc1c84",
    "recipient_id": "e3001fbc-1e28-44ad-94f6-9900be5dbc52"
}
PropertyDescriptionType
value_per_unitthe value of a single unit of this assetMoney
amountthe total amount of items belonging to this assetnumber?
amount_changedifference to the previous valuenumber?
timestampthe time of the valuationtimestamp
costadditional costs incurred, doesnt go into valuation calculation, but gets added to the transactionMoney?
total_valueoverwrite the amount * value_per_unit calculation resultMoney?
account_idthe id of the account to use for the transaction that gets created for this valuation, if none, then no transaction gets createdUUIDv4?
recipient_idthe id of the recipient to use for the transaction that gets created for this valuation, if none, then arbitrary recipient get chosenUUIDv4?