## List Balances `client.V1.Contracts.ListBalances(ctx, body) (*V1ContractListBalancesResponse, error)` **post** `/v1/contracts/customerBalances/list` List balances (commits and credits). ### Parameters - **body:** `V1ContractListBalancesParams` - **CustomerID:** `param.Field[string]` - **ID:** `param.Field[string]` - **CoveringDate:** `param.Field[Time]` Return only balances that have access schedules that "cover" the provided date - **EffectiveBefore:** `param.Field[Time]` Include only balances that have any access before the provided date (exclusive) - **IncludeArchived:** `param.Field[bool]` Include archived credits and credits from archived contracts. - **IncludeBalance:** `param.Field[bool]` Include the balance of credits and commits in the response. Setting this flag may cause the query to be slower. - **IncludeContractBalances:** `param.Field[bool]` Include balances on the contract level. - **IncludeLedgers:** `param.Field[bool]` Include ledgers in the response. Setting this flag may cause the query to be slower. - **Limit:** `param.Field[int64]` The maximum number of commits to return. Defaults to 25. - **NextPage:** `param.Field[string]` The next page token from a previous response. - **StartingAt:** `param.Field[Time]` Include only balances that have any access on or after the provided date ### Returns - Not supported - **Data:** `[]V1ContractListBalancesResponseData` - Not supported - **ID:** `string` - **Product:** `CommitProduct` - **ID:** `string` - **Name:** `string` - **Type:** `CommitType` - `CommitType` - `CommitType` - **AccessSchedule:** `ScheduleDuration` The schedule that the customer will gain access to the credits purposed with this commit. - **Amount:** `float64` (DEPRECATED) Use access_schedule + invoice_schedule instead. - **ApplicableContractIDs:** `[]string` - **ApplicableProductIDs:** `[]string` - **ApplicableProductTags:** `[]string` - **ArchivedAt:** `Time` RFC 3339 timestamp indicating when the commit was archived. If not provided, the commit is not archived. - **Balance:** `float64` The current balance of the credit or commit. This balance reflects the amount of credit or commit that the customer has access to use at this moment - thus, expired and upcoming credit or commit segments contribute 0 to the balance. The balance will match the sum of all ledger entries with the exception of the case where the sum of negative manual ledger entries exceeds the positive amount remaining on the credit or commit - in that case, the balance will be 0. All manual ledger entries associated with active credit or commit segments are included in the balance, including future-dated manual ledger entries. - **Contract:** `CommitContract` - **ID:** `string` - **CustomFields:** `map[string, string]` - **Description:** `string` - **HierarchyConfiguration:** `CommitHierarchyConfiguration` Optional configuration for commit hierarchy access control - **ChildAccess:** `CommitHierarchyConfigurationChildAccess` - Not supported - **Type:** `CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessAllType` - `CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessAllType` - Not supported - **Type:** `CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessNoneType` - `CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessNoneType` - Not supported - **ContractIDs:** `[]string` - **Type:** `CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessContractIDsType` - `CommitHierarchyConfigurationChildAccessCommitHierarchyChildAccessContractIDsType` - **InvoiceContract:** `CommitInvoiceContract` The contract that this commit will be billed on. - **ID:** `string` - **InvoiceSchedule:** `SchedulePointInTime` The schedule that the customer will be invoiced for this commit. - **Ledger:** `[]CommitLedger` A list of ordered events that impact the balance of a commit. For example, an invoice deduction or a rollover. - Not supported - **Amount:** `float64` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPrepaidCommitSegmentStartLedgerEntryType` - `CommitLedgerPrepaidCommitSegmentStartLedgerEntryType` - Not supported - **Amount:** `float64` - **InvoiceID:** `string` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntryType` - `CommitLedgerPrepaidCommitAutomatedInvoiceDeductionLedgerEntryType` - **ContractID:** `string` - Not supported - **Amount:** `float64` - **NewContractID:** `string` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPrepaidCommitRolloverLedgerEntryType` - `CommitLedgerPrepaidCommitRolloverLedgerEntryType` - Not supported - **Amount:** `float64` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPrepaidCommitExpirationLedgerEntryType` - `CommitLedgerPrepaidCommitExpirationLedgerEntryType` - Not supported - **Amount:** `float64` - **InvoiceID:** `string` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPrepaidCommitCanceledLedgerEntryType` - `CommitLedgerPrepaidCommitCanceledLedgerEntryType` - **ContractID:** `string` - Not supported - **Amount:** `float64` - **InvoiceID:** `string` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPrepaidCommitCreditedLedgerEntryType` - `CommitLedgerPrepaidCommitCreditedLedgerEntryType` - **ContractID:** `string` - Not supported - **Amount:** `float64` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPrepaidCommitSeatBasedAdjustmentLedgerEntryType` - `CommitLedgerPrepaidCommitSeatBasedAdjustmentLedgerEntryType` - Not supported - **Amount:** `float64` - **Timestamp:** `Time` - **Type:** `CommitLedgerPostpaidCommitInitialBalanceLedgerEntryType` - `CommitLedgerPostpaidCommitInitialBalanceLedgerEntryType` - Not supported - **Amount:** `float64` - **InvoiceID:** `string` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntryType` - `CommitLedgerPostpaidCommitAutomatedInvoiceDeductionLedgerEntryType` - **ContractID:** `string` - Not supported - **Amount:** `float64` - **NewContractID:** `string` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPostpaidCommitRolloverLedgerEntryType` - `CommitLedgerPostpaidCommitRolloverLedgerEntryType` - Not supported - **Amount:** `float64` - **InvoiceID:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPostpaidCommitTrueupLedgerEntryType` - `CommitLedgerPostpaidCommitTrueupLedgerEntryType` - **ContractID:** `string` - Not supported - **Amount:** `float64` - **Reason:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPrepaidCommitManualLedgerEntryType` - `CommitLedgerPrepaidCommitManualLedgerEntryType` - Not supported - **Amount:** `float64` - **Reason:** `string` - **Timestamp:** `Time` - **Type:** `CommitLedgerPostpaidCommitManualLedgerEntryType` - `CommitLedgerPostpaidCommitManualLedgerEntryType` - Not supported - **Amount:** `float64` - **Timestamp:** `Time` - **Type:** `CommitLedgerPostpaidCommitExpirationLedgerEntryType` - `CommitLedgerPostpaidCommitExpirationLedgerEntryType` - **Name:** `string` - **NetsuiteSalesOrderID:** `string` This field's availability is dependent on your client's configuration. - **Priority:** `float64` If multiple credits or commits are applicable, the one with the lower priority will apply first. - **RateType:** `CommitRateType` - `CommitRateType` - `CommitRateType` - **RolledOverFrom:** `CommitRolledOverFrom` - **CommitID:** `string` - **ContractID:** `string` - **RolloverFraction:** `float64` - **SalesforceOpportunityID:** `string` This field's availability is dependent on your client's configuration. - **Specifiers:** `[]CommitSpecifier` List of filters that determine what kind of customer usage draws down a commit or credit. A customer's usage needs to meet the condition of at least one of the specifiers to contribute to a commit's or credit's drawdown. - **PresentationGroupValues:** `map[string, string]` - **PricingGroupValues:** `map[string, string]` - **ProductID:** `string` If provided, the specifier will only apply to the product with the specified ID. - **ProductTags:** `[]string` If provided, the specifier will only apply to products with all the specified tags. - **UniquenessKey:** `string` Prevents the creation of duplicates. If a request to create a commit or credit is made with a uniqueness key that was previously used to create a commit or credit, a new record will not be created and the request will fail with a 409 error. - Not supported - **ID:** `string` - **Product:** `CreditProduct` - **ID:** `string` - **Name:** `string` - **Type:** `CreditType` - `CreditType` - **AccessSchedule:** `ScheduleDuration` The schedule that the customer will gain access to the credits. - **ApplicableContractIDs:** `[]string` - **ApplicableProductIDs:** `[]string` - **ApplicableProductTags:** `[]string` - **Balance:** `float64` The current balance of the credit or commit. This balance reflects the amount of credit or commit that the customer has access to use at this moment - thus, expired and upcoming credit or commit segments contribute 0 to the balance. The balance will match the sum of all ledger entries with the exception of the case where the sum of negative manual ledger entries exceeds the positive amount remaining on the credit or commit - in that case, the balance will be 0. All manual ledger entries associated with active credit or commit segments are included in the balance, including future-dated manual ledger entries. - **Contract:** `CreditContract` - **ID:** `string` - **CustomFields:** `map[string, string]` - **Description:** `string` - **HierarchyConfiguration:** `CreditHierarchyConfiguration` Optional configuration for credit hierarchy access control - **ChildAccess:** `CreditHierarchyConfigurationChildAccess` - Not supported - **Type:** `CreditHierarchyConfigurationChildAccessCommitHierarchyChildAccessAllType` - `CreditHierarchyConfigurationChildAccessCommitHierarchyChildAccessAllType` - Not supported - **Type:** `CreditHierarchyConfigurationChildAccessCommitHierarchyChildAccessNoneType` - `CreditHierarchyConfigurationChildAccessCommitHierarchyChildAccessNoneType` - Not supported - **ContractIDs:** `[]string` - **Type:** `CreditHierarchyConfigurationChildAccessCommitHierarchyChildAccessContractIDsType` - `CreditHierarchyConfigurationChildAccessCommitHierarchyChildAccessContractIDsType` - **Ledger:** `[]CreditLedger` A list of ordered events that impact the balance of a credit. For example, an invoice deduction or an expiration. - Not supported - **Amount:** `float64` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CreditLedgerCreditSegmentStartLedgerEntryType` - `CreditLedgerCreditSegmentStartLedgerEntryType` - Not supported - **Amount:** `float64` - **InvoiceID:** `string` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntryType` - `CreditLedgerCreditAutomatedInvoiceDeductionLedgerEntryType` - **ContractID:** `string` - Not supported - **Amount:** `float64` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CreditLedgerCreditExpirationLedgerEntryType` - `CreditLedgerCreditExpirationLedgerEntryType` - Not supported - **Amount:** `float64` - **InvoiceID:** `string` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CreditLedgerCreditCanceledLedgerEntryType` - `CreditLedgerCreditCanceledLedgerEntryType` - **ContractID:** `string` - Not supported - **Amount:** `float64` - **InvoiceID:** `string` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CreditLedgerCreditCreditedLedgerEntryType` - `CreditLedgerCreditCreditedLedgerEntryType` - **ContractID:** `string` - Not supported - **Amount:** `float64` - **Reason:** `string` - **Timestamp:** `Time` - **Type:** `CreditLedgerCreditManualLedgerEntryType` - `CreditLedgerCreditManualLedgerEntryType` - Not supported - **Amount:** `float64` - **SegmentID:** `string` - **Timestamp:** `Time` - **Type:** `CreditLedgerCreditSeatBasedAdjustmentLedgerEntryType` - `CreditLedgerCreditSeatBasedAdjustmentLedgerEntryType` - **Name:** `string` - **NetsuiteSalesOrderID:** `string` This field's availability is dependent on your client's configuration. - **Priority:** `float64` If multiple credits or commits are applicable, the one with the lower priority will apply first. - **RateType:** `CreditRateType` - `CreditRateType` - `CreditRateType` - **SalesforceOpportunityID:** `string` This field's availability is dependent on your client's configuration. - **Specifiers:** `[]CreditSpecifier` List of filters that determine what kind of customer usage draws down a commit or credit. A customer's usage needs to meet the condition of at least one of the specifiers to contribute to a commit's or credit's drawdown. - **PresentationGroupValues:** `map[string, string]` - **PricingGroupValues:** `map[string, string]` - **ProductID:** `string` If provided, the specifier will only apply to the product with the specified ID. - **ProductTags:** `[]string` If provided, the specifier will only apply to products with all the specified tags. - **UniquenessKey:** `string` Prevents the creation of duplicates. If a request to create a commit or credit is made with a uniqueness key that was previously used to create a commit or credit, a new record will not be created and the request will fail with a 409 error. - **NextPage:** `string` ### Example ```go package main import ( "context" "fmt" "github.com/Metronome-Industries/metronome-go" "github.com/Metronome-Industries/metronome-go/option" ) func main() { client := metronome.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.V1.Contracts.ListBalances(context.TODO(), metronome.V1ContractListBalancesParams{ CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"), ID: metronome.F("6162d87b-e5db-4a33-b7f2-76ce6ead4e85"), IncludeLedgers: metronome.F(true), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Data) } ```