Skip to main content

Subscription MRR

Category: Finance & Commerce

Get this pack →

This page is generated from the Air Pipe marketplace. Browse it live to install into your organization.

Overview

Summarise subscriptions — monthly recurring revenue (sum of amounts) and count grouped by status — and compute days-since a signup date. Demonstrates the aggregate transform and the ->days_since date derive.

Endpoints

  • POST subscriptions/summary — sum amounts + count grouped by status
  • POST subscriptions/age — days since a created date

Required variables

  • None

Configuration

subscription_mrr.yml

name: SubscriptionMrr
description: >
Summarise subscriptions — total monthly recurring revenue (sum of amounts) and
a count, grouped by status — and compute the age in days of a signup date.
Demonstrates the aggregate transform and the ->days_since date derive.

docs: true

# Required managed variables: none.

interfaces:
subscriptions/summary:
output: http
method: POST
summary: Sum subscription amounts (MRR) and count, grouped by status
actions:
- name: ReadBody
input: a|body|
assert:
error_message: "subscriptions array is required"
http_code_on_error: 400
tests:
- value: subscriptions
is_not_empty: true
- name: Summary
run_when_succeeded: [ReadBody]
input: a|body|
post_transforms:
- aggregate: { over: subscriptions, sum: [amount], count: true, group_by: [status] }
subscriptions/age:
output: http
method: POST
summary: Days since a subscription's created date (->days_since)
actions:
- name: R
json_output: |-
{ "age_days": a|body::created_at->days_since| }