How can I pull historical invoice or payment information all at once?
I want to download the details of several invoices at one time, but I don't see a way to do this in the Cloud Manager. Is there any way I could, for instance, generate a list of all my invoices or payments for all of 2020 to pass along to my accountant?
2 Replies
While this feature is not something currently avaialable in the Cloud Manager, you can actually export and parse this data using the Linode-CLI.
The link above will walk you through the setup and configuration of the Linode-CLI if you aren’t already using it, but to get started you will wanted to install it using the following:
pip3 install linode-cli —upgrade
You will need to create a Personal Access Token to complete the setup, which can be generated from within your Cloud Manager - here.
To display a list of all invoices on your account, you can run the following command:
linode-cli account invoices-list
This will then generate an output similar to:
┌──────────┬─────────────────────┬───────────────────┬──────────┬─────┬───────┐
│ id │ date │ label │ subtotal │ tax │ total │
├──────────┼─────────────────────┼───────────────────┼──────────┼─────┼───────┤
│ 12345678 │ 2020-09-01T04:16:19 │ Invoice #12345678 │ 20.0 │ 0.0 │ 20.0 │
│ 12345679 │ 2020-10-01T04:36:21 │ Invoice #12345679 │ 20.0 │ 0.0 │ 20.0 │
│ 12345680 │ 2020-11-01T04:14:43 │ Invoice #12345680 │ 20.0 │ 0.0 │ 20.0 │
│ 12345681 │ 2020-12-01T05:24:45 │ Invoice #12345682 │ 40.0 │ 0.0 │ 40.0 │
│ 12345683 │ 2021-01-01T05:19:12 │ Invoice #12345683 │ 40.0 │ 0.0 │ 40.0 │
│ 12345684 │ 2021-02-01T05:18:57 │ Invoice #12345684 │ 40.0 │ 0.0 │ 40.0 │
│ 12345685 │ 2021-03-01T05:16:05 │ Invoice #12345685 │ 40.0 │ 0.0 │ 40.0 │
└──────────┴─────────────────────┴───────────────────┴──────────┴─────┴───────┘
Let’s say you only wanted invoices from the year 2020. You could use grep
to filter your results:
linode-cli account invoices-list | grep '2020'
For this example, the above command would produce the following output:
┌──────────┬─────────────────────┬───────────────────┬──────────┬─────┬───────┐
│ id │ date │ label │ subtotal │ tax │ total │
├──────────┼─────────────────────┼───────────────────┼──────────┼─────┼───────┤
│ 12345678 │ 2020-09-01T04:16:19 │ Invoice #12345678 │ 20.0 │ 0.0 │ 20.0 │
│ 12345679 │ 2020-10-01T04:36:21 │ Invoice #12345679 │ 20.0 │ 0.0 │ 20.0 │
│ 12345680 │ 2020-11-01T04:14:43 │ Invoice #12345680 │ 20.0 │ 0.0 │ 20.0 │
│ 12345681 │ 2020-12-01T05:24:45 │ Invoice #12345682 │ 40.0 │ 0.0 │ 40.0 │
└──────────┴─────────────────────┴───────────────────┴──────────┴─────┴───────┘
You could also use other sorting options such as AWK, or even export to specific file formats such as CSV or JSON. A full overview of Linode-CLI and API account commands can be viewed by navigating the menu on the left side of the page here.