subscriptions

List all charges for a subscription

Changed on

This endpoint retrieves all effective charges for a specific subscription. If the subscription has plan overrides with charge overrides, the overridden charges are returned.

get/subscriptions/{external_id}/charges

Request

Query parameters

pageinteger
Example:1

Page number. Defaults to 1. A value that is not a positive integer, such as 0, returns the first page.

per_pageinteger
Example:20

Number of records per page. Defaults to 100. The maximum is 200, unless another maximum is configured for your organization. A value above the maximum returns a 422 error with value_is_out_of_range on per_page. A value that is not a positive integer, such as 0, returns the default number of records.

subscription_status'pending' | 'active' | 'terminated' | 'canceled' | 'incomplete'
Example:active

Filter by subscription status. When provided, the subscription is looked up with this status instead of the default active status. Possible values are pending, active, terminated, canceled, or incomplete.

Response

List of charges

Example response

{
  "charges": [
    {
      "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
      "lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
      "code": "api_requests_charge",
      "billable_metric_code": "requests",
      "invoice_display_name": "Setup",
      "created_at": "2022-09-14T16:35:31Z",
      "pay_in_advance": true,
      "invoiceable": true,
      "regroup_paid_fees": "invoice",
      "min_amount_cents": 1200,
      "properties": {
        "grouped_by": [
          "agent_name"
        ],
        "pricing_group_keys": [
          "agent_name"
        ],
        "graduated_ranges": [
          {
            "to_value": 10,
            "flat_amount": "10",
            "per_unit_amount": "0.5"
          }
        ],
        "graduated_percentage_ranges": [
          {
            "to_value": 10,
            "rate": "1",
            "flat_amount": "10"
          }
        ],
        "amount": "30",
        "free_units": 100,
        "package_size": 1000,
        "rate": "1",
        "fixed_amount": "0.5",
        "free_units_per_events": 5,
        "free_units_per_total_aggregation": "500",
        "per_transaction_max_amount": "3.75",
        "per_transaction_min_amount": "1.75",
        "volume_ranges": [
          {
            "to_value": 10,
            "flat_amount": "10",
            "per_unit_amount": "0.5"
          }
        ],
        "presentation_group_keys": [
          {
            "value": "region",
            "options": {
              "display_in_invoice": true
            }
          }
        ]
      },
      "filters": [
        {
          "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
          "charge_code": "api_requests_charge",
          "invoice_display_name": "AWS",
          "properties": {
            "grouped_by": [
              "agent_name"
            ],
            "pricing_group_keys": [
              "agent_name"
            ],
            "graduated_ranges": [
              {
                "to_value": 10,
                "flat_amount": "10",
                "per_unit_amount": "0.5"
              }
            ],
            "graduated_percentage_ranges": [
              {
                "to_value": 10,
                "rate": "1",
                "flat_amount": "10"
              }
            ],
            "amount": "30",
            "free_units": 100,
            "package_size": 1000,
            "rate": "1",
            "fixed_amount": "0.5",
            "free_units_per_events": 5,
            "free_units_per_total_aggregation": "500",
            "per_transaction_max_amount": "3.75",
            "per_transaction_min_amount": "1.75",
            "volume_ranges": [
              {
                "to_value": 10,
                "flat_amount": "10",
                "per_unit_amount": "0.5"
              }
            ]
          },
          "values": {
            "region": [
              "us-east-1"
            ]
          }
        }
      ],
      "taxes": [
        {
          "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
          "name": "TVA",
          "code": "french_standard_vat",
          "description": "French standard VAT",
          "rate": 20,
          "applied_to_organization": true,
          "applied_to_billing_entities_codes": [
            "acme_corp",
            "foo_bar"
          ],
          "created_at": "2023-07-06T14:35:58Z"
        }
      ],
      "applied_pricing_unit": {
        "code": "unit_code",
        "conversion_rate": "0.5"
      },
      "lago_parent_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
    }
  ],
  "meta": {
    "current_page": 2,
    "next_page": 3,
    "prev_page": 1,
    "total_pages": 4,
    "total_count": 70
  }
}

Changes

    • info

      added the new enum value incomplete to the query request parameter subscription_status

    • info

      added the optional property //// to the response with the status

    • info

      added the optional property //// to the response with the status

    • info

      added the optional property //// to the response with the status

    • info

      the response property //// became required for the status