Skip to main content

invoices

Creates, updates, deletes, gets or lists an invoices resource.

Overview

Nameinvoices
TypeResource
Iddigitalocean.billing.invoices

Fields

The following fields are returned by SELECT queries:

The response will be a JSON object with a key called invoice_items. This will be set to an array of invoice item objects. All resources will be shown on invoices, regardless of permissions.

NameDatatypeDescription
resource_idstringID of the resource billing in the invoice item if available. (example: 2353624)
project_namestringName of the DigitalOcean Project this resource belongs to. (example: web)
amountstringBilled amount of this invoice item. Billed in USD. (example: 12.34)
descriptionstringDescription of the invoice item. (example: a56e086a317d8410c8b4cfd1f4dc9f82)
durationstringDuration of time this invoice item was used and subsequently billed. (example: 744)
duration_unitstringUnit of time for duration. (example: Hours)
end_timestringTime the invoice item stopped being billed for usage. (example: 2020-02-01T00:00:00Z)
group_descriptionstringDescription of the invoice item when it is a grouped set of usage, such as DOKS or databases. (example: my-doks-cluster)
productstringName of the product being billed in the invoice item. (example: Kubernetes Clusters)
resource_uuidstringUUID of the resource billing in the invoice item if available. (example: 711157cb-37c8-4817-b371-44fa3504a39c)
start_timestringTime the invoice item began to be billed for usage. (example: 2020-01-01T00:00:00Z)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
invoices_get_by_uuidselectinvoice_uuidper_page, pageTo retrieve the invoice items for an invoice, send a GET request to /v2/customers/my/invoices/$INVOICE_UUID.
invoices_listselectper_page, pageTo retrieve a list of all invoices, send a GET request to /v2/customers/my/invoices.
invoices_get_csv_by_uuidexecinvoice_uuidTo retrieve a CSV for an invoice, send a GET request to /v2/customers/my/invoices/$INVOICE_UUID/csv.
invoices_get_pdf_by_uuidexecinvoice_uuidTo retrieve a PDF for an invoice, send a GET request to /v2/customers/my/invoices/$INVOICE_UUID/pdf.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
invoice_uuidstringUUID of the invoice (example: 22737513-0ea7-4206-8ceb-98a575af7681)
pageintegerWhich 'page' of paginated results to return. (example: 1)
per_pageintegerNumber of items returned per page (example: 2)

SELECT examples

To retrieve the invoice items for an invoice, send a GET request to /v2/customers/my/invoices/$INVOICE_UUID.

SELECT
resource_id,
project_name,
amount,
description,
duration,
duration_unit,
end_time,
group_description,
product,
resource_uuid,
start_time
FROM digitalocean.billing.invoices
WHERE invoice_uuid = '{{ invoice_uuid }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}';

Lifecycle Methods

To retrieve a CSV for an invoice, send a GET request to /v2/customers/my/invoices/$INVOICE_UUID/csv.

EXEC digitalocean.billing.invoices.invoices_get_csv_by_uuid 
@invoice_uuid='{{ invoice_uuid }}' --required;