Retrieve billing information with Viam's billing client API

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

The billing client API supports the following methods:

Method NameDescription
GetCurrentMonthUsageAccess data usage information for the current month for a given organization.
GetOrgBillingInformationAccess billing information (payment method, billing tier, etc.) for a given org.
GetInvoicesSummaryAccess total outstanding balance plus invoice summaries for a given org.
GetInvoicePdfAccess invoice PDF data and optionally save it to a provided file path.

API

GetCurrentMonthUsage

Access data usage information for the current month for a given organization. You can also find your usage data on the Payment and billing page.

Parameters:

  • org_id (str) (required): the ID of the organization to request usage data for.
  • timeout (float) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.

Returns:

Example:

usage = await billing_client.get_current_month_usage("<ORG-ID>")

For more information, see the Python SDK Docs.

Parameters:

  • orgId (string) (required): The organization ID.

Returns:

  • (Promise)

Example:

const usage = await billing.getCurrentMonthUsage('<organization-id>');

For more information, see the TypeScript 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:

  • org_id (str) (required): the ID of the org to request data for.
  • timeout (float) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.

Returns:

Example:

information = await billing_client.get_org_billing_information("<ORG-ID>")

For more information, see the Python SDK Docs.

Parameters:

  • orgId (string) (required): The organization ID.

Returns:

Example:

const billingInfo = await billing.getOrgBillingInformation(
  '<organization-id>'
);

For more information, see the TypeScript SDK Docs.

GetInvoicesSummary

Access total outstanding balance plus invoice summaries for a given org.

Parameters:

  • org_id (str) (required): the ID of the org to request data for.
  • timeout (float) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.

Returns:

Example:

summary = await billing_client.get_invoices_summary("<ORG-ID>")

For more information, see the Python SDK Docs.

Parameters:

  • orgId (string) (required): The organization ID.

Returns:

Example:

const invoicesSummary = await billing.getInvoicesSummary(
  '<organization-id>'
);

For more information, see the TypeScript SDK Docs.

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:

  • invoice_id (str) (required): the ID of the invoice being requested.
  • org_id (str) (required): the ID of the org to request data from.
  • dest (str) (required): the filepath to save the invoice to.
  • timeout (float) (optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.

Returns:

  • None.

Example:

await billing_client.get_invoice_pdf("<INVOICE-ID>", "<ORG-ID>", "invoice.pdf")

For more information, see the Python SDK Docs.

Parameters:

  • id (string) (required): The invoice ID.
  • orgId (string) (required): The organization ID.

Returns:

  • (Promise)

Example:

const invoicePdf = await billing.getInvoicePdf(
  '<invoice-id>',
  '<organization-id>'
);

For more information, see the TypeScript SDK Docs.