Cost API

Finout Cost API enables you to query and analyze costs using user-defined Finout Views. You can easily get a list of your views and retrieve the costs for a specified view. You can query the costs for any date range of up to 90 days specified in UTC timestamps. The results are returned in JSON format for easy processing.

Note: Only cost data is returned when querying a view via the Cost API.

GET/Views

Description

Gets a list of all your account views. For more information on views, see Finout Views.

Prerequisites

  • Generate a Client ID and Secret Key from Finout to add in Headers.

  • You must create a view in the MegaBill before querying the GET view. There is currently no 'Create View' API option.

Request https://app.finout.io/v1/view

Response

{
    "data": [
        {
            "name": "Cost Ratio - Weightings by Group Name",
            "id": "25568bb9-7d9b-4b72-9361-07abcb4e5f29"
        },
        {
            "name": "Shared Services - Support, Marketplace, Security",
            "id": "08252cda-3f70-4779-822c-cf4bdf65cc28"
        },

        {
            "name": "K8s by App_Component",
            "id": "f76be053-1138-431f-a6e1-9f6d1852398b"
        }
    ],
    "requestId": "05ac7c0f-2e85-4af0-8ef7-3ace11e420d7"
}

Returns a JSON object with the following properties:

  • name: The names of your account's views.

  • id: The unique identifier of your account's views.

POST /Query by view

Description

Return all costs for a specified view and date range for up to 90 days. For more information on views, see Finout Views.

Prerequisites

  • Generate a Client ID and Secret Key from Finout to add in Headers.

  • You must first GET the view you want to query

  • Add the GET view ID to the body of the POST query. Example: ​{

    "viewId": "6244e453-e8b8-4f1f-9a96-4ba1ae5d48f7"

    }

  • You must either specify dates or delete them completely. The query won't work when blank dates are still present. Example: ​{

"viewId": "6244e453-e8b8-4f1f-9a96-4ba1ae5d48f7",

"date": {

"unixTimeMillSecondsStart": 1719824738,

"unixTimeMillSecondsEnd": 1719911138

},

"costType": "netAmortizedCost"

}

Request

https://app.finout.io/v1/cost/query-by-view

{
    "viewId": "9c0344f2-94d6-4b9a-b1d5-e57353c117ee",
    "date": {
        "unixTimeMillSecondsStart": 1719824738,
        "unixTimeMillSecondsEnd": 1719911138
    },
    "costType": "netAmortizedCost"
}

Body of Request

Parameter
Type
Description

viewId

string

Name of the user

date

number

Age of the user

unixTimeMillSecondsStart

Numeric

Start Date represented in Unix Epoch time

unixTimeMillSecondsEnd

Numeric

End Date represented in Unix Epoch time

costType

String

Response

{
    "data": [
        {
            "name": "Total",
            "data": [
                {
                    "time": 1641600000,
                    "cost": 0
                }
            ]
        }
    ],
    "request": {
        "viewId": "9c0344f2-94d6-4b9a-b1d5-e57353c117ee",
        "date": {
            "unixTimeMillSecondsStart": 1719824738,
            "unixTimeMillSecondsEnd": 1719911138
        },
        "costType": "netAmortizedCost"
    },
    "requestId": "629f36f0-191b-4c36-b8dd-13fd8ad7f37d"
}

Last updated

Still need help? Please feel free to reach out to our team at support@finout.io.