lago-javascript-client 1.28.1 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -341,7 +341,7 @@ export interface TaxObject {
341
341
  */
342
342
  rate: number;
343
343
  /**
344
- * This field is deprecated and will be removed in a future version. When set to true, it applies the tax to the organization's default billing entity. To apply or remove a tax from any billing entity (including the default one), please use the `PUT /billing_entity/:code` endpoint instead.
344
+ * This field is deprecated and will be removed in a future version. When set to true, it applies the tax to the organization's default billing entity. To apply or remove a tax from any billing entity (including the default one), please use the `PUT /billing_entities/:code` endpoint instead.
345
345
  * @deprecated
346
346
  * @example true
347
347
  */
@@ -353,8 +353,60 @@ export interface TaxObject {
353
353
  */
354
354
  created_at: string;
355
355
  }
356
+ export interface InvoiceCustomSectionObject {
357
+ /**
358
+ * Unique identifier for the invoice custom section in the Lago application, generated by Lago to ensure record uniqueness within the system.
359
+ * @format uuid
360
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
361
+ */
362
+ lago_id: string;
363
+ /**
364
+ * Name of the invoice custom section.
365
+ * @example "EU Bank Details"
366
+ */
367
+ name: string;
368
+ /**
369
+ * Unique code identifying the invoice custom section for the API request.
370
+ * @example "eu_bank_details"
371
+ */
372
+ code: string;
373
+ /**
374
+ * Internal description of the invoice custom section.
375
+ * @example "This section contains the bank details for EU customers."
376
+ */
377
+ description?: string;
378
+ /**
379
+ * The value shown on the invoice PDF.
380
+ * @example "Bank Name: Lago Bank, IBAN: FR7630004000031234567890143"
381
+ */
382
+ details?: string;
383
+ /**
384
+ * The name of the invoice custom section displayed on the invoice.
385
+ * @example "Bank Details:"
386
+ */
387
+ display_name?: string;
388
+ /**
389
+ * This field is deprecated and will be removed in a future version. When set to true, it applies the invoice custom section to the organization's default billing entity. To apply or remove an invoice custom section from any billing entity (including the default one), please use the `PUT /billing_entities/:code` endpoint instead.
390
+ * @deprecated
391
+ * @example true
392
+ */
393
+ applied_to_organization?: boolean;
394
+ /**
395
+ * Unique identifier for the organization associated with the invoice custom section.
396
+ * @format uuid
397
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
398
+ */
399
+ organization_id?: string;
400
+ /**
401
+ * Creation date of the tax.
402
+ * @format date-time
403
+ * @example "2023-07-06T14:35:58Z"
404
+ */
405
+ created_at?: string;
406
+ }
356
407
  export type BillingEntityObjectExtended = BillingEntityObject & {
357
408
  taxes?: TaxObject[];
409
+ selected_invoice_custom_sections?: InvoiceCustomSectionObject[];
358
410
  };
359
411
  export interface ApiErrorNotFound {
360
412
  /**
@@ -488,52 +540,85 @@ export interface BillingEntityUpdateInput {
488
540
  * @example "data:image/png;base64,..."
489
541
  */
490
542
  logo?: string | null;
543
+ /**
544
+ * The codes of the invoice custom section that should be associated with this billing entity
545
+ * @example ["custom_section_1","custom_section_2"]
546
+ */
547
+ invoice_custom_section_codes?: string[];
491
548
  }
492
- export interface AddOnObject {
549
+ export interface ActivityLogObject {
493
550
  /**
494
- * Unique identifier of the add-on, created by Lago.
551
+ * Unique identifier assigned to the activity log within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the activity log record within the Lago system
495
552
  * @format uuid
496
553
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
497
554
  */
498
- lago_id: string;
555
+ activity_id: string;
499
556
  /**
500
- * The name of the add-on.
501
- * @example "Setup Fee"
557
+ * The email of the user who performed the activity
558
+ * @format email
559
+ * @example "dinesh@piedpiper.test"
502
560
  */
503
- name: string;
561
+ user_email?: string | null;
504
562
  /**
505
- * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
506
- * @example "Setup Fee (SF1)"
563
+ * This field stores the actitivy action that was performed to the activity_object.
564
+ * @example "billing_metric.created"
507
565
  */
508
- invoice_display_name?: string;
566
+ activity_type: string;
509
567
  /**
510
- * Unique code used to identify the add-on.
511
- * @example "setup_fee"
568
+ * This field represents the source of the activity log, the interaction source that triggered the action.
569
+ * @example "api"
512
570
  */
513
- code: string;
571
+ activity_source: "api" | "front" | "system";
514
572
  /**
515
- * The cost of the add-on in cents, excluding any applicable taxes, that is billed to a customer. By creating a one-off invoice, you will be able to override this value.
516
- * @example 50000
573
+ * This field represents the final state of the object that the action was applied.
574
+ * @format object
575
+ * @example {"lago_id":"dad68bc7-c01a-4ad8-a87b-13e78693a5bc","plan_id":"b9155544-e261-4e92-b54e-f65d7609294c"}
517
576
  */
518
- amount_cents: number;
577
+ activity_object?: object | null;
519
578
  /**
520
- * The currency of the add-on.
521
- * @example "USD"
579
+ * @format object
580
+ * @example {"plan_id":[null,"b9155544-e261-4e92-b54e-f65d7609294c"]}
522
581
  */
523
- amount_currency: Currency;
582
+ activity_object_changes?: object | null;
524
583
  /**
525
- * The description of the add-on.
526
- * @example "Implementation fee for new customers."
584
+ * The customer external unique identifier (provided by your own application)
585
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
527
586
  */
528
- description?: string | null;
587
+ external_customer_id?: string | null;
529
588
  /**
530
- * The date and time when the add-on was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the add-on was initially created.
589
+ * Unique identifier assigned to the subscription in your application.
590
+ * @example "external_id"
591
+ */
592
+ external_subscription_id?: string | null;
593
+ /**
594
+ * The resource id of the object that the action was applied.
595
+ * @format uuid
596
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
597
+ */
598
+ resource_id: string;
599
+ /**
600
+ * The resource type of the resource_id record.
601
+ * @example "BillableMetric"
602
+ */
603
+ resource_type: string;
604
+ /**
605
+ * Unique identifier for the organization associated with the activity log.
606
+ * @format uuid
607
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
608
+ */
609
+ organization_id: string;
610
+ /**
611
+ * The logged date of the activity, presented in the ISO 8601 datetime format, specifically in Coordinated Universal Time (UTC). It provides the precise timestamp of when the event's record was created within the Lago application
612
+ * @format date-time
613
+ * @example "2025-03-31T12:31:44Z"
614
+ */
615
+ logged_at: string;
616
+ /**
617
+ * The creation date of the activity record in the Lago application, presented in the ISO 8601 datetime format, specifically in Coordinated Universal Time (UTC). It provides the precise timestamp of when the event's record was created within the Lago application
531
618
  * @format date-time
532
619
  * @example "2022-04-29T08:59:51Z"
533
620
  */
534
621
  created_at: string;
535
- /** All taxes applied to the add-on. */
536
- taxes?: TaxObject[];
537
622
  }
538
623
  export interface PaginationMeta {
539
624
  /**
@@ -562,6 +647,59 @@ export interface PaginationMeta {
562
647
  */
563
648
  total_count: number;
564
649
  }
650
+ export interface ActivityLogsPaginated {
651
+ activity_logs: ActivityLogObject[];
652
+ meta: PaginationMeta;
653
+ }
654
+ export interface ActivityLog {
655
+ activity_log: ActivityLogObject;
656
+ }
657
+ export interface AddOnObject {
658
+ /**
659
+ * Unique identifier of the add-on, created by Lago.
660
+ * @format uuid
661
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
662
+ */
663
+ lago_id: string;
664
+ /**
665
+ * The name of the add-on.
666
+ * @example "Setup Fee"
667
+ */
668
+ name: string;
669
+ /**
670
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
671
+ * @example "Setup Fee (SF1)"
672
+ */
673
+ invoice_display_name?: string;
674
+ /**
675
+ * Unique code used to identify the add-on.
676
+ * @example "setup_fee"
677
+ */
678
+ code: string;
679
+ /**
680
+ * The cost of the add-on in cents, excluding any applicable taxes, that is billed to a customer. By creating a one-off invoice, you will be able to override this value.
681
+ * @example 50000
682
+ */
683
+ amount_cents: number;
684
+ /**
685
+ * The currency of the add-on.
686
+ * @example "USD"
687
+ */
688
+ amount_currency: Currency;
689
+ /**
690
+ * The description of the add-on.
691
+ * @example "Implementation fee for new customers."
692
+ */
693
+ description?: string | null;
694
+ /**
695
+ * The date and time when the add-on was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the add-on was initially created.
696
+ * @format date-time
697
+ * @example "2022-04-29T08:59:51Z"
698
+ */
699
+ created_at: string;
700
+ /** All taxes applied to the add-on. */
701
+ taxes?: TaxObject[];
702
+ }
565
703
  export interface AddOnsPaginated {
566
704
  add_ons: AddOnObject[];
567
705
  meta: PaginationMeta;
@@ -612,6 +750,73 @@ export interface AddOn {
612
750
  export interface AddOnUpdateInput {
613
751
  add_on: AddOnBaseInput;
614
752
  }
753
+ export interface ApiLogObject {
754
+ /**
755
+ * Lago API version used in the request.
756
+ * @example "v1"
757
+ */
758
+ api_version: string;
759
+ /**
760
+ * The client used to make the request to the API.
761
+ * @example "Lago Ruby v1.26.0"
762
+ */
763
+ client: string;
764
+ /**
765
+ * This field represents the HTTP method of the request.
766
+ * @example "post"
767
+ */
768
+ http_method: "post" | "put" | "delete";
769
+ /**
770
+ * This field represents the HTTP status of the requests.
771
+ * @example 200
772
+ */
773
+ http_status: number;
774
+ /**
775
+ * The logged date of the api log, presented in the ISO 8601 datetime format, specifically in Coordinated Universal Time (UTC). It provides the precise timestamp of when the event's record was created within the Lago application
776
+ * @format date-time
777
+ * @example "2025-03-31T12:31:44Z"
778
+ */
779
+ logged_at: string;
780
+ /**
781
+ * @format object
782
+ * @example "{ "billable_metric": { "name": "Storage", "code": "storage" } }"
783
+ */
784
+ request_body: string;
785
+ /**
786
+ * This field represents the API origin of the requested URL
787
+ * @example "https://app.lago.dev/"
788
+ */
789
+ request_origin: string;
790
+ /**
791
+ * This field represents the API path of the requested URL
792
+ * @example "/billable_metrics"
793
+ */
794
+ request_path: string;
795
+ /**
796
+ * The creation date of the api log record in the Lago application, presented in the ISO 8601 datetime format, specifically in Coordinated Universal Time (UTC). It provides the precise timestamp of when the event's record was created within the Lago application
797
+ * @format date-time
798
+ * @example "2022-04-29T08:59:51Z"
799
+ */
800
+ created_at: string;
801
+ /**
802
+ * Unique identifier for the api log.
803
+ * @format uuid
804
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
805
+ */
806
+ request_id: string;
807
+ /**
808
+ * @format object
809
+ * @example "{ "lago_id": "b9155544-e261-4e92-b54e-f65d7609294c", ... }"
810
+ */
811
+ request_response?: string;
812
+ }
813
+ export interface ApiLogsPaginated {
814
+ api_logs: ApiLogObject[];
815
+ meta: PaginationMeta;
816
+ }
817
+ export interface ApiLog {
818
+ api_log: ApiLogObject;
819
+ }
615
820
  export interface GrossRevenueObject {
616
821
  /**
617
822
  * Identifies the month to analyze revenue.
@@ -1987,8 +2192,9 @@ export interface CreditNoteObject {
1987
2192
  */
1988
2193
  self_billed?: boolean;
1989
2194
  }
1990
- export interface CreditNotes {
2195
+ export interface CreditNotesPaginated {
1991
2196
  credit_notes: CreditNoteObject[];
2197
+ meta: PaginationMeta;
1992
2198
  }
1993
2199
  export interface CreditNoteCreateInput {
1994
2200
  credit_note: {
@@ -2511,56 +2717,6 @@ export interface IntegrationCustomer {
2511
2717
  export type CustomerObject = CustomerBaseObject & {
2512
2718
  integration_customers?: IntegrationCustomer[];
2513
2719
  };
2514
- export interface InvoiceCustomSectionObject {
2515
- /**
2516
- * Unique identifier for the invoice custom section in the Lago application, generated by Lago to ensure record uniqueness within the system.
2517
- * @format uuid
2518
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2519
- */
2520
- lago_id: string;
2521
- /**
2522
- * Name of the invoice custom section.
2523
- * @example "EU Bank Details"
2524
- */
2525
- name: string;
2526
- /**
2527
- * Unique code identifying the invoice custom section for the API request.
2528
- * @example "eu_bank_details"
2529
- */
2530
- code: string;
2531
- /**
2532
- * Internal description of the invoice custom section.
2533
- * @example "This section contains the bank details for EU customers."
2534
- */
2535
- description?: string;
2536
- /**
2537
- * The value shown on the invoice PDF.
2538
- * @example "Bank Name: Lago Bank, IBAN: FR7630004000031234567890143"
2539
- */
2540
- details?: string;
2541
- /**
2542
- * The name of the invoice custom section displayed on the invoice.
2543
- * @example "Bank Details:"
2544
- */
2545
- display_name?: string;
2546
- /**
2547
- * Set to true if the invoice custom section is a default for the organization.
2548
- * @example true
2549
- */
2550
- applied_to_organization?: boolean;
2551
- /**
2552
- * Unique identifier for the organization associated with the invoice custom section.
2553
- * @format uuid
2554
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2555
- */
2556
- organization_id?: string;
2557
- /**
2558
- * Creation date of the tax.
2559
- * @format date-time
2560
- * @example "2023-07-06T14:35:58Z"
2561
- */
2562
- created_at?: string;
2563
- }
2564
2720
  export type CustomerObjectExtended = CustomerObject & {
2565
2721
  metadata?: CustomerMetadata[];
2566
2722
  /** List of customer taxes */
@@ -3424,7 +3580,7 @@ export interface AppliedUsageThresholdObject {
3424
3580
  export type InvoiceObject = InvoiceBaseObject & {
3425
3581
  /** The customer on which the invoice applies. It refers to the customer account or entity associated with the invoice. */
3426
3582
  customer?: CustomerObject;
3427
- billing_period?: BillingPeriodObject[];
3583
+ billing_periods?: BillingPeriodObject[];
3428
3584
  metadata?: InvoiceMetadataObject[];
3429
3585
  applied_taxes?: InvoiceAppliedTaxObject[];
3430
3586
  applied_usage_thresholds?: any[] | null;
@@ -3829,6 +3985,26 @@ export interface InvoicePreviewInput {
3829
3985
  */
3830
3986
  billing_entity_code?: string;
3831
3987
  }
3988
+ /** Parameters available when voiding an invoice that optionally generate credit notes. */
3989
+ export interface InvoiceVoidInput {
3990
+ /**
3991
+ * Set to `true` to force voiding the invoice and generate a credit note.
3992
+ * @example true
3993
+ */
3994
+ generate_credit_note?: boolean;
3995
+ /**
3996
+ * Portion of the invoice amount (in cents) to be refunded to the customer in the generated credit note.
3997
+ * @min 0
3998
+ * @example 2000
3999
+ */
4000
+ refund_amount?: number;
4001
+ /**
4002
+ * Portion of the invoice amount (in cents) to be credited to the customer's balance in the generated credit note.
4003
+ * @min 0
4004
+ * @example 1150
4005
+ */
4006
+ credit_amount?: number;
4007
+ }
3832
4008
  /** The custom billing settings for your organization. */
3833
4009
  export interface OrganizationBillingConfiguration {
3834
4010
  /**
@@ -4345,6 +4521,18 @@ export interface MinimumCommitmentObject {
4345
4521
  taxes?: TaxObject[];
4346
4522
  }
4347
4523
  export interface ChargeProperties {
4524
+ /**
4525
+ * The list of event properties that are used to group the events on the invoice for a `standard` charge model.
4526
+ * **DEPRECATED** Replaced by `pricing_group_keys`.
4527
+ * @deprecated
4528
+ * @example ["agent_name"]
4529
+ */
4530
+ grouped_by?: string[];
4531
+ /**
4532
+ * The list of event properties that are used to group the events on the invoice.
4533
+ * @example ["agent_name"]
4534
+ */
4535
+ pricing_group_keys?: string[];
4348
4536
  /** Graduated ranges, sorted from bottom to top tiers, used for a `graduated` charge model. */
4349
4537
  graduated_ranges?: {
4350
4538
  /**
@@ -4451,11 +4639,6 @@ export interface ChargeProperties {
4451
4639
  * @example "1.75"
4452
4640
  */
4453
4641
  per_transaction_min_amount?: string | null;
4454
- /**
4455
- * The list of event properties that are used to group the events on the invoice for a `standard` charge model.
4456
- * @example ["agent_name"]
4457
- */
4458
- grouped_by?: string[];
4459
4642
  /** Volume ranges, sorted from bottom to top tiers, used for a `volume` charge model. */
4460
4643
  volume_ranges?: {
4461
4644
  /**
@@ -4471,13 +4654,13 @@ export interface ChargeProperties {
4471
4654
  */
4472
4655
  to_value: number | null;
4473
4656
  /**
4474
- * The unit price, excluding tax, for a specific tier of a `volume` charge model. It is expressed as a decimal value.
4657
+ * The flat amount for a whole tier, excluding tax, for a `volume` charge model. It is expressed as a decimal value.
4475
4658
  * @pattern ^[0-9]+.?[0-9]*$
4476
4659
  * @example "10"
4477
4660
  */
4478
4661
  flat_amount: string;
4479
4662
  /**
4480
- * The flat amount for a whole tier, excluding tax, for a `volume` charge model. It is expressed as a decimal value.
4663
+ * The unit price, excluding tax, for a specific tier of a `volume` charge model. It is expressed as a decimal value.
4481
4664
  * @pattern ^[0-9]+.?[0-9]*$
4482
4665
  * @example "0.5"
4483
4666
  */
@@ -5206,6 +5389,137 @@ export interface LifetimeUsageInput {
5206
5389
  external_historical_usage_amount_cents: number;
5207
5390
  };
5208
5391
  }
5392
+ export interface AlertThresholdBaseObject {
5393
+ /**
5394
+ * Unique identifier of the usage threshold created by Lago.
5395
+ * @example "warn"
5396
+ */
5397
+ code?: string | null;
5398
+ /**
5399
+ * This field when set to `true` indicates that the alert will be retrigger when this threshold is reached after the last non-recurring threshold. Only one recurring threshold per alert allowed.
5400
+ * @default false
5401
+ * @example false
5402
+ */
5403
+ recurring?: boolean;
5404
+ }
5405
+ export type AlertThresholdObject = AlertThresholdBaseObject & {
5406
+ /**
5407
+ * A value that should trigger this alert, formatted as a BigDecimal.
5408
+ * @pattern ^[0-9]+.?[0-9]*$
5409
+ * @example "99.0"
5410
+ */
5411
+ value: string;
5412
+ };
5413
+ export interface AlertObject {
5414
+ /**
5415
+ * Unique identifier of the alert, created by Lago.
5416
+ * @format uuid
5417
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
5418
+ */
5419
+ lago_id: string;
5420
+ /**
5421
+ * Unique identifier of the organization, created by Lago.
5422
+ * @format uuid
5423
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
5424
+ */
5425
+ lago_organization_id: string;
5426
+ /**
5427
+ * The subscription external unique identifier (provided by your own application).
5428
+ * @example "sub_1234567890"
5429
+ */
5430
+ subscription_external_id: string;
5431
+ /**
5432
+ * The customer external unique identifier (provided by your own application).
5433
+ * @example "cus_0987654321"
5434
+ */
5435
+ customer_external_id: string;
5436
+ /** The billable metric associated with the alert. Only for alerts based on a billable metric. */
5437
+ billable_metric: BillableMetricObject;
5438
+ /**
5439
+ * The type of alert.
5440
+ * @example "billable_metric_current_usage_amount"
5441
+ */
5442
+ alert_type: "current_usage_amount" | "billable_metric_current_usage_amount" | "billable_metric_current_usage_units" | "lifetime_usage_amount";
5443
+ /**
5444
+ * Unique code used to identify the alert.
5445
+ * @example "storage_threshold_alert"
5446
+ */
5447
+ code: string;
5448
+ /**
5449
+ * The name of the alert.
5450
+ * @example "Storage Usage Alert"
5451
+ */
5452
+ name: string | null;
5453
+ /**
5454
+ * When the system checked if this alert should be triggered, this value was retrieved and checked against the thresholds.
5455
+ * @example 1000
5456
+ */
5457
+ previous_value: number;
5458
+ /**
5459
+ * The date and time in UTC (ISO 8601) when the system checked if this alert should be triggered. Null until it's processed for the first time.
5460
+ * @format date-time
5461
+ * @example "2025-05-19T10:04:21Z"
5462
+ */
5463
+ last_processed_at: string | null;
5464
+ /** Array of thresholds associated with the alert. */
5465
+ thresholds: AlertThresholdObject[];
5466
+ /**
5467
+ * The date and time in UTC (ISO 8601) when the alert was created.
5468
+ * @format date-time
5469
+ * @example "2025-03-20T10:00:00Z"
5470
+ */
5471
+ created_at: string;
5472
+ }
5473
+ export interface Alerts {
5474
+ alerts: AlertObject[];
5475
+ meta?: PaginationMeta;
5476
+ }
5477
+ export type AlertThresholdInput = AlertThresholdBaseObject & {
5478
+ /**
5479
+ * A value that should trigger this alert. This can be an integer or a string formatted as a BigDecimal.
5480
+ * @example 99
5481
+ */
5482
+ value: number | string;
5483
+ };
5484
+ export interface AlertBaseInput {
5485
+ /**
5486
+ * Unique code used to identify the alert.
5487
+ * @example "storage_threshold_alert"
5488
+ */
5489
+ code?: string;
5490
+ /**
5491
+ * The code of the billable metric associated with the alert. Only for alerts based on a billable metric.
5492
+ * @example "storage_usage"
5493
+ */
5494
+ billable_metric_code?: string | null;
5495
+ /**
5496
+ * The name of the alert.
5497
+ * @example "Storage Usage Alert"
5498
+ */
5499
+ name?: string | null;
5500
+ /** Array of thresholds associated with the alert. */
5501
+ thresholds?: AlertThresholdInput[];
5502
+ }
5503
+ export interface AlertCreateInput {
5504
+ alert: AlertBaseInput & {
5505
+ /**
5506
+ * The type of alert.
5507
+ * @example "billable_metric_current_usage_amount"
5508
+ */
5509
+ alert_type: "current_usage_amount" | "billable_metric_current_usage_amount" | "billable_metric_current_usage_units" | "lifetime_usage_amount";
5510
+ /**
5511
+ * Unique code used to identify the alert.
5512
+ * @example "storage_threshold_alert"
5513
+ */
5514
+ code: string;
5515
+ };
5516
+ }
5517
+ export interface Alert {
5518
+ alert: AlertObject;
5519
+ }
5520
+ export interface AlertUpdateInput {
5521
+ alert: AlertBaseInput;
5522
+ }
5209
5523
  export interface TaxesPaginated {
5210
5524
  taxes: TaxObject[];
5211
5525
  meta: PaginationMeta;
@@ -5233,7 +5547,7 @@ export interface TaxBaseInput {
5233
5547
  */
5234
5548
  description?: string | null;
5235
5549
  /**
5236
- * This field is deprecated and will be removed in a future version. When set to true, it applies the tax to the organization's default billing entity. To apply or remove a tax from any billing entity (including the default one), please use the `PUT /billing_entity/:code` endpoint instead.
5550
+ * This field is deprecated and will be removed in a future version. When set to true, it applies the tax to the organization's default billing entity. To apply or remove a tax from any billing entity (including the default one), please use the `PUT /billing_entities/:code` endpoint instead.
5237
5551
  * @deprecated
5238
5552
  * @example true
5239
5553
  */
@@ -5425,6 +5739,14 @@ export interface WalletObject {
5425
5739
  * @example false
5426
5740
  */
5427
5741
  invoice_requires_successful_payment?: boolean;
5742
+ /** Set wallet limitations to fee types. */
5743
+ applies_to?: {
5744
+ /**
5745
+ * An array of fee types to which the wallet is applicable. By specifying the fee types in this field, you can restrict the wallet's usage to specific fee types only.
5746
+ * @example ["charge"]
5747
+ */
5748
+ fee_types?: any[] | null;
5749
+ };
5428
5750
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
5429
5751
  recurring_transaction_rules?: WalletRecurringTransactionRule[];
5430
5752
  /**
@@ -5510,6 +5832,14 @@ export interface WalletCreateInput {
5510
5832
  /** The corresponding value for the key. */
5511
5833
  value?: string;
5512
5834
  }[];
5835
+ /** Set wallet limitations to fee types. */
5836
+ applies_to?: {
5837
+ /**
5838
+ * An array of fee types to which the wallet is applicable. By specifying the fee types in this field, you can restrict the wallet's usage to specific fee types only.
5839
+ * @example ["charge"]
5840
+ */
5841
+ fee_types?: any[] | null;
5842
+ };
5513
5843
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
5514
5844
  recurring_transaction_rules?: {
5515
5845
  /**
@@ -5677,6 +6007,14 @@ export interface WalletUpdateInput {
5677
6007
  value?: string;
5678
6008
  }[];
5679
6009
  }[];
6010
+ /** Set wallet limitations to fee types. */
6011
+ applies_to?: {
6012
+ /**
6013
+ * An array of fee types to which the wallet is applicable. By specifying the fee types in this field, you can restrict the wallet's usage to specific fee types only.
6014
+ * @example ["charge"]
6015
+ */
6016
+ fee_types?: any[] | null;
6017
+ };
5680
6018
  };
5681
6019
  }
5682
6020
  export interface WalletTransactionCreateInput {
@@ -5902,6 +6240,75 @@ export interface WebhookEndpointUpdateInput {
5902
6240
  signature_algo?: "jwt" | "hmac";
5903
6241
  };
5904
6242
  }
6243
+ export interface TriggeredAlertObject {
6244
+ /**
6245
+ * Unique identifier of the alert, created by Lago.
6246
+ * @format uuid
6247
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6248
+ */
6249
+ lago_id: string;
6250
+ /**
6251
+ * Unique identifier of the organization, created by Lago.
6252
+ * @format uuid
6253
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6254
+ */
6255
+ lago_organization_id: string;
6256
+ /**
6257
+ * Unique identifier of the alert, created by Lago.
6258
+ * @format uuid
6259
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6260
+ */
6261
+ lago_alert_id: string;
6262
+ /**
6263
+ * Unique identifier of the subscription, created by Lago.
6264
+ * @format uuid
6265
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6266
+ */
6267
+ lago_subscription_id: string;
6268
+ /**
6269
+ * The subscription external unique identifier (provided by your own application).
6270
+ * @example "sub_1234567890"
6271
+ */
6272
+ subscription_external_id: string;
6273
+ /**
6274
+ * The code of the billable metric associated with the alert. Only for alerts based on a billable metric.
6275
+ * @example "storage_usage"
6276
+ */
6277
+ billable_metric_code: string | null;
6278
+ /**
6279
+ * The type of alert triggered.
6280
+ * @example "billable_metric_current_usage_amount"
6281
+ */
6282
+ alert_type: "current_usage_amount" | "billable_metric_current_usage_amount" | "billable_metric_current_usage_units" | "lifetime_usage_amount";
6283
+ /**
6284
+ * Unique code used to identify the alert triggered.
6285
+ * @example "storage_threshold_alert"
6286
+ */
6287
+ alert_code: string;
6288
+ /**
6289
+ * The name of the alert triggered.
6290
+ * @example "Storage Usage Alert"
6291
+ */
6292
+ alert_name: string | null;
6293
+ /**
6294
+ * When the system checked if this alert should be triggered, this value was retrieved and checked if any threshold were crossed between this value and previous value.
6295
+ * @example 1200
6296
+ */
6297
+ current_value: number;
6298
+ /**
6299
+ * During the previous run, this value was retrieved.
6300
+ * @example 900
6301
+ */
6302
+ previous_value: number;
6303
+ /**
6304
+ * The date and time in UTC (ISO 8601) when the system triggered the alert.
6305
+ * @format date-time
6306
+ * @example "2025-05-19T10:04:21Z"
6307
+ */
6308
+ triggered_at: string | null;
6309
+ /** Array of thresholds crossed. All the recurring threshold values are present. */
6310
+ crossed_thresholds: AlertThresholdObject[];
6311
+ }
5905
6312
  export interface CustomerIntegratrionErrorObject {
5906
6313
  /**
5907
6314
  * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system.
@@ -6238,6 +6645,9 @@ export interface WalletTransactionPaymentFailureObject {
6238
6645
  payment_provider_code?: string;
6239
6646
  provider_error?: string | Record<string, any>;
6240
6647
  }
6648
+ export interface CreditNotes {
6649
+ credit_notes: CreditNoteObject[];
6650
+ }
6241
6651
  export type CustomerPaymentProvidernErrorObject = CustomerPaymentProviderErrorObject;
6242
6652
  export type QueryParamsType = Record<string | number, any>;
6243
6653
  export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
@@ -6299,7 +6709,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
6299
6709
  }
6300
6710
  /**
6301
6711
  * @title Lago API documentation
6302
- * @version 1.28.1
6712
+ * @version 1.31.0
6303
6713
  * @license AGPLv3
6304
6714
  * @baseUrl https://api.getlago.com/api/v1
6305
6715
  * @externalDocs https://github.com/getlago
@@ -6354,6 +6764,86 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
6354
6764
  */
6355
6765
  updateBillingEntity: (code: string, data: BillingEntityUpdateInput, params?: RequestParams) => Promise<HttpResponse<BillingEntityObjectExtended, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
6356
6766
  };
6767
+ activityLogs: {
6768
+ /**
6769
+ * @description This endpoint retrieves all existing activity logs that represent actions performed on application resources.
6770
+ *
6771
+ * @tags activity_logs
6772
+ * @name FindAllActivityLogs
6773
+ * @summary List all activity logs
6774
+ * @request GET:/activity_logs
6775
+ * @secure
6776
+ */
6777
+ findAllActivityLogs: (query?: {
6778
+ /**
6779
+ * Page number.
6780
+ * @example 1
6781
+ */
6782
+ page?: number;
6783
+ /**
6784
+ * Number of records per page.
6785
+ * @example 20
6786
+ */
6787
+ per_page?: number;
6788
+ /**
6789
+ * Filter activity logs from a specific date.
6790
+ * @format date
6791
+ * @example "2022-08-09"
6792
+ */
6793
+ from_date?: string;
6794
+ /**
6795
+ * Filter activity logs up to a specific date.
6796
+ * @format date
6797
+ * @example "2022-08-09"
6798
+ */
6799
+ to_date?: string;
6800
+ /**
6801
+ * Filter results by activity types
6802
+ * @example ["billing_metric.created","billing_metric.updated"]
6803
+ */
6804
+ "activity_types[]"?: string[];
6805
+ /**
6806
+ * Filter results by activity sources
6807
+ * @example ["api","front"]
6808
+ */
6809
+ "activity_sources[]"?: ("api" | "front" | "system")[];
6810
+ /**
6811
+ * Filter results by user emails
6812
+ * @example ["dinesh@piedpiper.test"]
6813
+ */
6814
+ "user_emails[]"?: string[];
6815
+ /**
6816
+ * Unique identifier assigned to the customer in your application.
6817
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
6818
+ */
6819
+ external_customer_id?: string;
6820
+ /**
6821
+ * External subscription ID
6822
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
6823
+ */
6824
+ external_subscription_id?: string;
6825
+ /**
6826
+ * Filter results by resources unique identifiers
6827
+ * @example ["5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba","1a901a90-1a90-1a90-1a90-1a901a901a90"]
6828
+ */
6829
+ "resource_ids[]"?: string[];
6830
+ /**
6831
+ * Filter results by resource class types
6832
+ * @example ["BillableMetric","Invoice"]
6833
+ */
6834
+ "resource_types[]"?: string[];
6835
+ }, params?: RequestParams) => Promise<HttpResponse<ActivityLogsPaginated, ApiErrorUnauthorized>>;
6836
+ /**
6837
+ * @description This endpoint retrieves an existing activity log that represents an action performed on some resource. The activity log is identified by its unique activity_id.
6838
+ *
6839
+ * @tags activity_logs
6840
+ * @name FindActivityLog
6841
+ * @summary Retrieve an activity log
6842
+ * @request GET:/activity_logs/{activity_id}
6843
+ * @secure
6844
+ */
6845
+ findActivityLog: (activityId: string, params?: RequestParams) => Promise<HttpResponse<ActivityLog, ApiErrorUnauthorized | ApiErrorNotFound>>;
6846
+ };
6357
6847
  addOns: {
6358
6848
  /**
6359
6849
  * @description This endpoint is used to create an add-on that can be then attached to a one-off invoice.
@@ -6417,6 +6907,71 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
6417
6907
  */
6418
6908
  destroyAddOn: (code: string, params?: RequestParams) => Promise<HttpResponse<AddOn, ApiErrorUnauthorized | ApiErrorNotFound>>;
6419
6909
  };
6910
+ apiLogs: {
6911
+ /**
6912
+ * @description This endpoint retrieves all existing api logs that represent requests performed to Lago's API.
6913
+ *
6914
+ * @tags api_logs
6915
+ * @name FindAllApiLogs
6916
+ * @summary List all api logs
6917
+ * @request GET:/api_logs
6918
+ * @secure
6919
+ */
6920
+ findAllApiLogs: (query?: {
6921
+ /**
6922
+ * Page number.
6923
+ * @example 1
6924
+ */
6925
+ page?: number;
6926
+ /**
6927
+ * Number of records per page.
6928
+ * @example 20
6929
+ */
6930
+ per_page?: number;
6931
+ /**
6932
+ * Filter api logs from a specific date.
6933
+ * @format date
6934
+ * @example "2022-08-09"
6935
+ */
6936
+ from_date?: string;
6937
+ /**
6938
+ * Filter api logs up to a specific date.
6939
+ * @format date
6940
+ * @example "2022-08-09"
6941
+ */
6942
+ to_date?: string;
6943
+ /**
6944
+ * Filter results by HTTP methods
6945
+ * @example ["post","put"]
6946
+ */
6947
+ "http_methods[]"?: ("post" | "put" | "delete")[];
6948
+ /**
6949
+ * Filter results by HTTP status or by generic request status
6950
+ * @example ["failed","succeeded",404]
6951
+ */
6952
+ "http_statuses[]"?: ("succeeded" | "failed" | number)[];
6953
+ /**
6954
+ * Filter results by API version
6955
+ * @example ["v1"]
6956
+ */
6957
+ "api_version[]"?: string[];
6958
+ /**
6959
+ * Filter results by the path of the request
6960
+ * @example "/billable_metrics/"
6961
+ */
6962
+ request_paths?: string;
6963
+ }, params?: RequestParams) => Promise<HttpResponse<ApiLogsPaginated, ApiErrorUnauthorized>>;
6964
+ /**
6965
+ * @description This endpoint retrieves an existing api log that represents a request made to the API. The api log is identified by its unique request_id.
6966
+ *
6967
+ * @tags api_logs
6968
+ * @name FindApiLog
6969
+ * @summary Retrieve an api log
6970
+ * @request GET:/api_logs/{request_id}
6971
+ * @secure
6972
+ */
6973
+ findApiLog: (requestId: string, params?: RequestParams) => Promise<HttpResponse<ApiLog, ApiErrorUnauthorized | ApiErrorNotFound>>;
6974
+ };
6420
6975
  analytics: {
6421
6976
  /**
6422
6977
  * @description Gross revenue is the sum of monthly `finalized` invoice payments and fees paid in advance that are not invoiceable. This total is calculated after deducting taxes and discounts.
@@ -6567,6 +7122,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
6567
7122
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
6568
7123
  */
6569
7124
  external_customer_id?: string;
7125
+ /**
7126
+ * The code of the coupon applied to the customer. Use it to filter applied coupons by their code.
7127
+ * @example ["BLACK_FRIDAY_2024","CHRISTMAS_2024"]
7128
+ */
7129
+ "coupon_code[]"?: string[];
6570
7130
  }, params?: RequestParams) => Promise<HttpResponse<AppliedCouponsPaginated, ApiErrorUnauthorized>>;
6571
7131
  };
6572
7132
  billableMetrics: {
@@ -6793,8 +7353,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
6793
7353
  * Filter credit notes by billing entity codes.
6794
7354
  * @example ["billing_entity_code_1","billing_entity_code_2"]
6795
7355
  */
6796
- billing_entity_codes?: string[];
6797
- }, params?: RequestParams) => Promise<HttpResponse<CreditNotes, ApiErrorUnauthorized>>;
7356
+ "billing_entity_codes[]"?: string[];
7357
+ }, params?: RequestParams) => Promise<HttpResponse<CreditNotesPaginated, ApiErrorUnauthorized>>;
6798
7358
  /**
6799
7359
  * @description This endpoint updates an existing credit note.
6800
7360
  *
@@ -6881,12 +7441,12 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
6881
7441
  * Filter customers by account type.
6882
7442
  * @example ["customer","partner"]
6883
7443
  */
6884
- account_type?: ("customer" | "partner")[];
7444
+ "account_type[]"?: ("customer" | "partner")[];
6885
7445
  /**
6886
7446
  * Filter customers by billing entity codes.
6887
7447
  * @example ["billing_entity_code_1","billing_entity_code_2"]
6888
7448
  */
6889
- billing_entity_codes?: string[];
7449
+ "billing_entity_codes[]"?: string[];
6890
7450
  }, params?: RequestParams) => Promise<HttpResponse<CustomersPaginated, ApiErrorUnauthorized>>;
6891
7451
  /**
6892
7452
  * @description This endpoint retrieves an existing customer.
@@ -7316,7 +7876,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7316
7876
  * Filter invoices by billing entity codes. Possible values are the billing entity codes you have created.
7317
7877
  * @example ["acme_corp","foo_bar"]
7318
7878
  */
7319
- billing_entity_codes?: string[];
7879
+ "billing_entity_codes[]"?: string[];
7320
7880
  /**
7321
7881
  * Filter invoices by metadata. Replace `key` with the actual metadata key you want to match, and provide the corresponding value. Providing empty value will search for invoice without given metadata key. For example, `metadata[color]=blue`.
7322
7882
  * @example "someValue"
@@ -7424,7 +7984,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7424
7984
  */
7425
7985
  retryPayment: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorUnauthorized | ApiErrorNotFound | ApiErrorNotAllowed>>;
7426
7986
  /**
7427
- * @description This endpoint is used for voiding an invoice. You can void an invoice only when it's in a `finalized` status, and the payment status is not `succeeded`.
7987
+ * @description This endpoint is used for voiding an invoice. • When no body parameters are provided, the invoice can be voided only if it is in a `finalized` status and its payment status is NOT `succeeded`. • When `generate_credit_note` is provided (optionally with `refund_amount` and/or `credit_amount`), this validation is bypassed: the invoice is forcibly voided and a credit note is generated. If the specified refund/credit amounts do not cover the full invoice total, the remainder is issued on a second credit note that is created and immediately voided.
7428
7988
  *
7429
7989
  * @tags invoices
7430
7990
  * @name VoidInvoice
@@ -7432,7 +7992,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7432
7992
  * @request POST:/invoices/{lago_id}/void
7433
7993
  * @secure
7434
7994
  */
7435
- voidInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
7995
+ voidInvoice: (lagoId: string, data?: InvoiceVoidInput, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
7436
7996
  };
7437
7997
  organizations: {
7438
7998
  /**
@@ -7563,7 +8123,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7563
8123
  * @format uuid
7564
8124
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
7565
8125
  */
7566
- lago_invoice_id?: string;
8126
+ invoice_id?: string;
7567
8127
  }, params?: RequestParams) => Promise<HttpResponse<PaymentsPaginated, ApiErrorUnauthorized>>;
7568
8128
  /**
7569
8129
  * @description This endpoint retrieves a specific payment by its ID.
@@ -7695,7 +8255,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7695
8255
  * @request GET:/subscriptions/{external_id}
7696
8256
  * @secure
7697
8257
  */
7698
- findSubscription: (externalId: string, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorNotFound>>;
8258
+ findSubscription: (externalId: string, query?: {
8259
+ /**
8260
+ * By default, this endpoint only return `active` subscriptions. If you want to retrieve a subscription with a different `status`, you can specify it here.
8261
+ *
8262
+ * _Note: As there may exists multiple `canceled` or `terminated` subscribtions for the same `external_id`, it is recommended to use the "List all subscriptions" endpoint to retrieve those subscriptions._
8263
+ * @example "active"
8264
+ */
8265
+ status?: "active" | "terminated" | "pending" | "canceled";
8266
+ }, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorNotFound>>;
7699
8267
  /**
7700
8268
  * @description This endpoint allows you to update a subscription.
7701
8269
  *
@@ -7727,7 +8295,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7727
8295
  *
7728
8296
  * @tags subscriptions
7729
8297
  * @name GetSubscriptionLifetimeUsage
7730
- * @summary Retrive subscription lifetime usage
8298
+ * @summary Retrieve subscription lifetime usage
7731
8299
  * @request GET:/subscriptions/{external_id}/lifetime_usage
7732
8300
  * @secure
7733
8301
  */
@@ -7742,6 +8310,56 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7742
8310
  * @secure
7743
8311
  */
7744
8312
  updateSubscriptionLifetimeUsage: (externalId: string, data: LifetimeUsageInput, params?: RequestParams) => Promise<HttpResponse<LifetimeUsage, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
8313
+ /**
8314
+ * @description This endpoint enables the retrieval of all alerts for a subscription.
8315
+ *
8316
+ * @tags subscriptions
8317
+ * @name GetSubscriptionAlerts
8318
+ * @summary List subscription alerts
8319
+ * @request GET:/subscriptions/{external_id}/alerts
8320
+ * @secure
8321
+ */
8322
+ getSubscriptionAlerts: (externalId: string, params?: RequestParams) => Promise<HttpResponse<Alerts, ApiErrorUnauthorized | ApiErrorNotFound>>;
8323
+ /**
8324
+ * @description This endpoint allows you to create a new alert for a subscription.
8325
+ *
8326
+ * @tags subscriptions
8327
+ * @name CreateSubscriptionAlert
8328
+ * @summary Create a subscription alert
8329
+ * @request POST:/subscriptions/{external_id}/alerts
8330
+ * @secure
8331
+ */
8332
+ createSubscriptionAlert: (externalId: string, data: AlertCreateInput, params?: RequestParams) => Promise<HttpResponse<Alert, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
8333
+ /**
8334
+ * @description This endpoint enables the retrieval of a specific alert for a subscription.
8335
+ *
8336
+ * @tags subscriptions
8337
+ * @name GetSubscriptionAlert
8338
+ * @summary Retrieve a subscription alert
8339
+ * @request GET:/subscriptions/{external_id}/alerts/{code}
8340
+ * @secure
8341
+ */
8342
+ getSubscriptionAlert: (externalId: string, code: string, params?: RequestParams) => Promise<HttpResponse<Alert, ApiErrorUnauthorized | ApiErrorNotFound>>;
8343
+ /**
8344
+ * @description This endpoint allows you to update an existing alert for a subscription.
8345
+ *
8346
+ * @tags subscriptions
8347
+ * @name UpdateSubscriptionAlert
8348
+ * @summary Update a subscription alert
8349
+ * @request PUT:/subscriptions/{external_id}/alerts/{code}
8350
+ * @secure
8351
+ */
8352
+ updateSubscriptionAlert: (externalId: string, code: string, data: AlertUpdateInput, params?: RequestParams) => Promise<HttpResponse<Alert, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
8353
+ /**
8354
+ * @description This endpoint allows you to delete an existing alert for a subscription.
8355
+ *
8356
+ * @tags subscriptions
8357
+ * @name DeleteSubscriptionAlert
8358
+ * @summary Delete a subscription alert
8359
+ * @request DELETE:/subscriptions/{external_id}/alerts/{code}
8360
+ * @secure
8361
+ */
8362
+ deleteSubscriptionAlert: (externalId: string, code: string, params?: RequestParams) => Promise<HttpResponse<Alert, ApiErrorUnauthorized | ApiErrorNotFound>>;
7745
8363
  };
7746
8364
  taxes: {
7747
8365
  /**