From c3d84091f9a2bf4c93e14533e24cd575187df223 Mon Sep 17 00:00:00 2001 From: Mike Hirt Date: Fri, 15 May 2026 14:39:35 +0000 Subject: [PATCH] feat(ISSUE-1861): document billable_metric.{created,updated,deleted} webhooks Add OpenAPI definitions for the three new billable-metric webhook events, mirroring the plan_{created,updated,deleted} pattern and reusing the existing BillableMetricObject schema. Bundled openapi.yaml regenerated via 'npm run build'; 'npm test' is clean (only pre-existing warnings). Spec: https://www.notion.so/getlago/Spec-Improvement-Billable-Metric-Webhooks-35fef63110d28091b16ed2787ab3a067 Linear: https://linear.app/getlago/issue/ISSUE-1861 --- openapi.yaml | 117 ++++++++++++++++++++++ src/openapi.yaml | 6 ++ src/webhooks/billable_metric_created.yaml | 38 +++++++ src/webhooks/billable_metric_deleted.yaml | 38 +++++++ src/webhooks/billable_metric_updated.yaml | 38 +++++++ 5 files changed, 237 insertions(+) create mode 100644 src/webhooks/billable_metric_created.yaml create mode 100644 src/webhooks/billable_metric_deleted.yaml create mode 100644 src/webhooks/billable_metric_updated.yaml diff --git a/openapi.yaml b/openapi.yaml index 795cf2e..c1f9f4c 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -6792,6 +6792,123 @@ webhooks: responses: '200': description: Return a 200 status to indicate that the data was received successfully + billable_metric_created: + post: + operationId: billableMetricCreated + summary: A new billable metric has been created + description: A new billable metric has been created + parameters: + - $ref: '#/components/parameters/webhook_signature' + - $ref: '#/components/parameters/webhook_signature_algorithm' + - $ref: '#/components/parameters/webhook_unique_key' + requestBody: + description: Details of the new billable metric + content: + application/json: + schema: + type: object + required: + - webhook_type + - object_type + - organization_id + - billable_metric + properties: + webhook_type: + type: string + enum: + - billable_metric.created + object_type: + type: string + enum: + - billable_metric + organization_id: + type: string + format: uuid + description: Unique identifier of the organization, created by Lago. + example: 1a901a90-1a90-1a90-1a90-1a901a901a90 + billable_metric: + $ref: '#/components/schemas/BillableMetricObject' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + billable_metric_updated: + post: + operationId: billableMetricUpdated + summary: A billable metric has been updated + description: A billable metric has been updated + parameters: + - $ref: '#/components/parameters/webhook_signature' + - $ref: '#/components/parameters/webhook_signature_algorithm' + - $ref: '#/components/parameters/webhook_unique_key' + requestBody: + description: Details of the billable metric + content: + application/json: + schema: + type: object + required: + - webhook_type + - object_type + - organization_id + - billable_metric + properties: + webhook_type: + type: string + enum: + - billable_metric.updated + object_type: + type: string + enum: + - billable_metric + organization_id: + type: string + format: uuid + description: Unique identifier of the organization, created by Lago. + example: 1a901a90-1a90-1a90-1a90-1a901a901a90 + billable_metric: + $ref: '#/components/schemas/BillableMetricObject' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + billable_metric_deleted: + post: + operationId: billableMetricDeleted + summary: A billable metric has been deleted + description: A billable metric has been deleted + parameters: + - $ref: '#/components/parameters/webhook_signature' + - $ref: '#/components/parameters/webhook_signature_algorithm' + - $ref: '#/components/parameters/webhook_unique_key' + requestBody: + description: Details of the billable metric + content: + application/json: + schema: + type: object + required: + - webhook_type + - object_type + - organization_id + - billable_metric + properties: + webhook_type: + type: string + enum: + - billable_metric.deleted + object_type: + type: string + enum: + - billable_metric + organization_id: + type: string + format: uuid + description: Unique identifier of the organization, created by Lago. + example: 1a901a90-1a90-1a90-1a90-1a901a901a90 + billable_metric: + $ref: '#/components/schemas/BillableMetricObject' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully customer_created: post: operationId: customerCreated diff --git a/src/openapi.yaml b/src/openapi.yaml index b2d7a9b..6111c2f 100644 --- a/src/openapi.yaml +++ b/src/openapi.yaml @@ -389,6 +389,12 @@ paths: webhooks: alert_triggered: $ref: "./webhooks/alert_triggered.yaml" + billable_metric_created: + $ref: "./webhooks/billable_metric_created.yaml" + billable_metric_updated: + $ref: "./webhooks/billable_metric_updated.yaml" + billable_metric_deleted: + $ref: "./webhooks/billable_metric_deleted.yaml" customer_created: $ref: "./webhooks/customer_created.yaml" customer_updated: diff --git a/src/webhooks/billable_metric_created.yaml b/src/webhooks/billable_metric_created.yaml new file mode 100644 index 0000000..513ffdd --- /dev/null +++ b/src/webhooks/billable_metric_created.yaml @@ -0,0 +1,38 @@ +post: + operationId: billableMetricCreated + summary: A new billable metric has been created + description: A new billable metric has been created + parameters: + - $ref: "../parameters/webhook_signature.yaml" + - $ref: "../parameters/webhook_signature_algorithm.yaml" + - $ref: "../parameters/webhook_unique_key.yaml" + requestBody: + description: Details of the new billable metric + content: + application/json: + schema: + type: object + required: + - webhook_type + - object_type + - organization_id + - billable_metric + properties: + webhook_type: + type: string + enum: + - billable_metric.created + object_type: + type: string + enum: + - billable_metric + organization_id: + type: string + format: "uuid" + description: Unique identifier of the organization, created by Lago. + example: "1a901a90-1a90-1a90-1a90-1a901a901a90" + billable_metric: + $ref: "../schemas/BillableMetricObject.yaml" + responses: + "200": + description: Return a 200 status to indicate that the data was received successfully diff --git a/src/webhooks/billable_metric_deleted.yaml b/src/webhooks/billable_metric_deleted.yaml new file mode 100644 index 0000000..48da13d --- /dev/null +++ b/src/webhooks/billable_metric_deleted.yaml @@ -0,0 +1,38 @@ +post: + operationId: billableMetricDeleted + summary: A billable metric has been deleted + description: A billable metric has been deleted + parameters: + - $ref: "../parameters/webhook_signature.yaml" + - $ref: "../parameters/webhook_signature_algorithm.yaml" + - $ref: "../parameters/webhook_unique_key.yaml" + requestBody: + description: Details of the billable metric + content: + application/json: + schema: + type: object + required: + - webhook_type + - object_type + - organization_id + - billable_metric + properties: + webhook_type: + type: string + enum: + - billable_metric.deleted + object_type: + type: string + enum: + - billable_metric + organization_id: + type: string + format: "uuid" + description: Unique identifier of the organization, created by Lago. + example: "1a901a90-1a90-1a90-1a90-1a901a901a90" + billable_metric: + $ref: "../schemas/BillableMetricObject.yaml" + responses: + "200": + description: Return a 200 status to indicate that the data was received successfully diff --git a/src/webhooks/billable_metric_updated.yaml b/src/webhooks/billable_metric_updated.yaml new file mode 100644 index 0000000..e07b1b8 --- /dev/null +++ b/src/webhooks/billable_metric_updated.yaml @@ -0,0 +1,38 @@ +post: + operationId: billableMetricUpdated + summary: A billable metric has been updated + description: A billable metric has been updated + parameters: + - $ref: "../parameters/webhook_signature.yaml" + - $ref: "../parameters/webhook_signature_algorithm.yaml" + - $ref: "../parameters/webhook_unique_key.yaml" + requestBody: + description: Details of the billable metric + content: + application/json: + schema: + type: object + required: + - webhook_type + - object_type + - organization_id + - billable_metric + properties: + webhook_type: + type: string + enum: + - billable_metric.updated + object_type: + type: string + enum: + - billable_metric + organization_id: + type: string + format: "uuid" + description: Unique identifier of the organization, created by Lago. + example: "1a901a90-1a90-1a90-1a90-1a901a901a90" + billable_metric: + $ref: "../schemas/BillableMetricObject.yaml" + responses: + "200": + description: Return a 200 status to indicate that the data was received successfully