Retrieve billing information with Viam's billing client API | APIs

Retrieve billing information with Viam's billing client API

The billing client allows you to retrieve billing information from Viam.

The billing API supports the following methods:

Method Name Description
GetCurrentMonthUsage Access data usage information for the current billing period for a given organization.
GetOrgBillingInformation Access billing information (payment method, billing tier, etc.) for a given org.
GetInvoicesSummary Access total outstanding balance plus invoice summaries for a given organization.
GetInvoicePDF Access invoice PDF data and optionally save it to a provided file path.
CreateInvoiceAndChargeImmediately Create a flat fee invoice and charge the organization immediately. The caller must be an owner of the organization being charged. This function blocks until payment is confirmed, but will time out after 2 minutes if there is no confirmation.
ChargeOrganization Charge an organization for usage.

Establish a connection

To use the billing client API, you need to instantiate a ViamClient and then instantiate a BillingClient.

You need an API key and API key ID with Org owner permissions to use the billing client API. To get an API key (and corresponding ID), use the web UI to the Viam CLI.


Copy


Copy


Copy

Once you have instantiated a BillingClient, you can run API methods against the BillingClient object (named billing_client in the examples).

API

GetCurrentMonthUsage

Access data usage information for the current billing period for a given organization. This method only returns usage for organizations with monthly billing at the end of the month ("in_arrears": true). You can also find your usage data on the Payment and billing page.

Parameters:

Returns:

Example:


Copy

For more information, see the Python SDK Docs.

GetOrgBillingInformation

Access billing information (payment method, billing tier, etc.) for a given org. You can also find this information on the Payment and billing page.

Parameters:

Returns:

GetInvoicesSummary

Access total outstanding balance plus invoice summaries for a given organization. This includes both monthly and annual invoices depending on the organization’s billing configuration.

Parameters:

Returns:

GetInvoicePDF

Access invoice PDF data and optionally save it to a provided file path. You can also find your invoices on the Payment and billing page.

Parameters:

Returns:

CreateInvoiceAndChargeImmediately

Create a flat fee invoice and charge the organization immediately. The caller must be an owner of the organization being charged. This function blocks until payment is confirmed, but will time out after 2 minutes if there is no confirmation.

Parameters:

Returns:

ChargeOrganization

Charge an organization for usage.

Parameters:

Returns: