Billwerk icon

Billwerk

Automate your subscription business with billwerk

Actions27

Metered Usage → Get All

AI-generated

Overview

The Billwerk node for n8n enables automation of subscription business processes using the Billwerk API.
For the resource Metered Usage with the operation Get All, this node retrieves a list of metered usage records associated with a specific contract. This is useful for scenarios such as:

  • Fetching all usage events for a customer’s contract to generate reports or invoices.
  • Auditing usage data within a specified date range.
  • Paginating through large sets of usage records.

Practical Example:
A SaaS company wants to retrieve all metered usage entries for a particular contract in order to calculate overage charges for a billing period.


Properties

Name Type Meaning
Contract ID String The unique identifier of the contract whose metered usages are to be retrieved. (Required)
From String Pagination: ID of the first usage record to return. Used to fetch subsequent pages.
Take Number Pagination: Maximum number of items to return (up to 500). Defaults to 20.
Date From DateTime Optional: Only include usages created on or after this timestamp.
Date To DateTime Optional: Only include usages created on or before this timestamp.

Output

The output is an array of JSON objects, each representing a metered usage record.
While the exact structure depends on the Billwerk API, typical fields may include:

[
  {
    "id": "string",
    "contractId": "string",
    "usageType": "string",
    "quantity": number,
    "createdAt": "datetime",
    // ...other relevant fields
  }
]

If an error occurs and "Continue On Fail" is enabled, the output will include an object like:

{
  "error": "Error message"
}

Dependencies

  • External Service: Requires access to the Billwerk API.
  • Credentials: You must configure the billwerkApi credential in n8n.
  • Environment: No special environment variables required beyond standard n8n setup.

Troubleshooting

Common Issues:

  • Missing or Invalid Contract ID:
    If the "Contract ID" is missing or incorrect, the node will fail to retrieve any data.
  • API Authentication Errors:
    If credentials are not set up correctly, you may receive authentication errors from the Billwerk API.
  • Pagination Limits:
    Setting "Take" above 500 may result in errors or truncated results.

Error Messages:

  • "error": "Error message"
    This appears in the output if "Continue On Fail" is enabled. Check the error message for details such as invalid parameters or network issues.

How to Resolve:

  • Double-check that the "Contract ID" is correct and exists in your Billwerk account.
  • Ensure your Billwerk API credentials are valid and have sufficient permissions.
  • Adjust pagination parameters ("From", "Take") as needed.

Links and References

Discussion