Invoices API
DoiT Invoices provides you instant visibility into your Google Cloud, Google Workspace, AWS, Office 365 and other invoices without having to scan through separate cloud vendor billing portals.
The Invoices API helps you programmatically obtain your DoiT invoices for supported assets such as Google Cloud projects, Amazon Web Services accounts, Microsoft Azure subscriptions and more.
Required PermissionsInvoice Viewer (part of
AdminandFinance Userpre-built roles)
Invoices API has the following methods:
invoices.list
The invoices.list method returns a list of all invoices available for your billing profile, as described at the Help Center.
You can filter the results using the following parameters:
| Parameter | Description |
|---|---|
minCreationTime | stringMin value for an invoice's creation time, in milliseconds since the POSIX epoch. If set, only invoices created after or at this timestamp are returned. |
maxCreationTime | stringMax value for an invoice's creation time, in milliseconds since the POSIX epoch. If set, only invoices created before or at this timestamp are returned. |
filter |
|
Example
YOUR_API_KEYReplace "YOUR_API_KEY" with your actual API key as explained at Get Started
Sample invoices.list request using both minCreationTime and filter parameters:
curl --location --request \
GET 'https://api.doit.com/billing/v1/invoices?minCreationTime=1596243660&filter=platform:amazon-web-services|platform:google-cloud' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--data-raw ''Sample invoices.list response:
{
"pageToken": "ZG9pdGRlLURFMTAwMDc4LUlOMjM0MDAxMDYz",
"rowCount": 50,
"invoices": [
{
"id": "IN204004836",
"invoiceDate": 1598832000000,
"platform": "amazon-web-services",
"dueDate": 1601424000000,
"status": "PAST DUE",
"totalAmount": 68991.75,
"balanceAmount": 80720.35,
"currency": "USD",
"url": "https://console.doit.com/customers/{CUSTOMER_ID}/invoices/{BILLING_PROFILE_KEY}/IN204004836"
},
{
"id": "IN204004665",
"invoiceDate": 1598832000000,
"platform": "google-cloud",
"dueDate": 1601424000000,
"status": "PAST DUE",
"totalAmount": 6804.56,
"balanceAmount": 7961.34,
"currency": "USD",
"url": "https://console.doit.com/customers/{CUSTOMER_ID}/invoices/{BILLING_PROFILE_KEY}/IN204004665"
},
]
}invoices.get
Get the full details of an individual invoice using the invoice number.
Example
Sample invoices.get request
curl --location --request GET 'https://api.doit.com/billing/v1/invoices/IN204004836' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--data-raw ''Sample invoices.get response:
{
"id": "IN204004836",
"invoiceDate": 1598832000000,
"platform": "amazon-web-services",
"dueDate": 1601424000000,
"status": "PAST DUE",
"totalAmount": 10464.36,
"balanceAmount": 80720.35,
"currency": "USD",
"url": "https://console.doit.com/customers/{CUSTOMER_ID}/invoices/{BILLING_PROFILE_KEY}/IN204004836",
"lineItems": [
{
"type": "amazon-web-services",
"description": "Amazon Web Services",
"price": 5825.16,
"qty": 1,
"currency": "USD",
"details": "Cover 1 month"
},
{
"type": "amazon-web-services",
"description": "Amazon Web Services",
"price": 4639.2,
"qty": 1,
"currency": "USD",
"details": "Cover 1 month"
}
]
}Response Body
If successful, the response body contains an instance of Invoice
{
"id": string,
"invoiceDate": number,
"platform": string,
"dueDate": number,
"status": string,
"totalAmount": float,
"balanceAmount": float,
"currency": string,
"url": string,
"lineItems": [ object (lineItem) ]
}Every invoice will include at least one or more lineItems:
{
"type": string,
"description": string,
"price": float,
"qty": number,
"currency": string
}Response Body Fields
| Field | Description |
|---|---|
id | stringUnique invoice identifier (often referred to as invoice number) |
invoiceDate | numberOutput only. The time when this invoice was issued, in milliseconds since the epoch.` |
dueDate | numberThe last day to pay the invoice, in milliseconds since the epoch |
status | stringCan be one of the following - OPEN, PAST DUE, or PAID |
totalAmount | floatTotal invoiced and payable amount |
balanceAmount | floatThe open balance for this invoice. For example, if the invoice total is 1,000 USD and only 850 USD was paid, the balanceAmount would be 150 USD. |
currency | stringThe currency used for the selected invoice. The currency is set on the billing profile level. More about billing profiles |
url | stringThe URL of the invoice details page in the DoiT console. You can download the PDF invoice from the invoice details page. |
platform | stringThe invoice's cloud platform |
lineItems | ArraylineItems.type lineItems.description lineItems.price lineItems.qty lineItems.currency lineItems.details |