invoices
Creates, updates, deletes, gets or lists an invoices
resource.
Overview
Name | invoices |
Type | Resource |
Id | digitalocean.billing.invoices |
Fields
The following fields are returned by SELECT
queries:
- invoices_get_by_uuid
- invoices_list
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.
Name | Datatype | Description |
---|---|---|
resource_id | string | ID of the resource billing in the invoice item if available. (example: 2353624) |
project_name | string | Name of the DigitalOcean Project this resource belongs to. (example: web) |
amount | string | Billed amount of this invoice item. Billed in USD. (example: 12.34) |
description | string | Description of the invoice item. (example: a56e086a317d8410c8b4cfd1f4dc9f82) |
duration | string | Duration of time this invoice item was used and subsequently billed. (example: 744) |
duration_unit | string | Unit of time for duration. (example: Hours) |
end_time | string | Time the invoice item stopped being billed for usage. (example: 2020-02-01T00:00:00Z) |
group_description | string | Description of the invoice item when it is a grouped set of usage, such as DOKS or databases. (example: my-doks-cluster) |
product | string | Name of the product being billed in the invoice item. (example: Kubernetes Clusters) |
resource_uuid | string | UUID of the resource billing in the invoice item if available. (example: 711157cb-37c8-4817-b371-44fa3504a39c) |
start_time | string | Time the invoice item began to be billed for usage. (example: 2020-01-01T00:00:00Z) |
The response will be a JSON object contains that contains a list of invoices under the invoices
key, and the invoice preview under the invoice_preview
key.
Each element contains the invoice summary attributes.
Name | Datatype | Description |
---|---|---|
invoice_preview | object | The invoice preview. |
invoices | array | |
links | object | |
meta | object | Information about the response itself. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
invoices_get_by_uuid | select | invoice_uuid | per_page , page | To retrieve the invoice items for an invoice, send a GET request to /v2/customers/my/invoices/$INVOICE_UUID . |
invoices_list | select | per_page , page | To retrieve a list of all invoices, send a GET request to /v2/customers/my/invoices . | |
invoices_get_csv_by_uuid | exec | invoice_uuid | To retrieve a CSV for an invoice, send a GET request to /v2/customers/my/invoices/$INVOICE_UUID/csv . | |
invoices_get_pdf_by_uuid | exec | invoice_uuid | To 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.
Name | Datatype | Description |
---|---|---|
invoice_uuid | string | UUID of the invoice (example: 22737513-0ea7-4206-8ceb-98a575af7681) |
page | integer | Which 'page' of paginated results to return. (example: 1) |
per_page | integer | Number of items returned per page (example: 2) |
SELECT
examples
- invoices_get_by_uuid
- invoices_list
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 }}';
To retrieve a list of all invoices, send a GET request to /v2/customers/my/invoices
.
SELECT
invoice_preview,
invoices,
links,
meta
FROM digitalocean.billing.invoices
WHERE per_page = '{{ per_page }}'
AND page = '{{ page }}';
Lifecycle Methods
- invoices_get_csv_by_uuid
- invoices_get_pdf_by_uuid
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;
To retrieve a PDF for an invoice, send a GET request to /v2/customers/my/invoices/$INVOICE_UUID/pdf
.
EXEC digitalocean.billing.invoices.invoices_get_pdf_by_uuid
@invoice_uuid='{{ invoice_uuid }}' --required;