Skip to content
  • Auto
  • Light
  • Dark
Talk to an expert

Update End Date

Update the contract end date
client.V1.Contracts.UpdateEndDate(ctx, body) (*DataIDV1ContractUpdateEndDateResponse, error)
post/v1/contracts/updateEndDate

Update the end date of a contract

Parameters
bodyContractIDfieldCustomerIDfieldAllowEndingBeforeFinalizedInvoicefieldEndingBeforefieldV1ContractUpdateEndDateParams
Hide ParametersShow Parameters
ContractIDfield
param.Field[string]

ID of the contract to update

formatuuid
CustomerIDfield
param.Field[string]

ID of the customer whose contract is to be updated

formatuuid
AllowEndingBeforeFinalizedInvoicefield
optional
param.Field[bool]

If true, allows setting the contract end date earlier than the end_timestamp of existing finalized invoices. Finalized invoices will be unchanged; if you want to incorporate the new end date, you can void and regenerate finalized usage invoices. Defaults to true.

EndingBeforefield
optional
param.Field[Time]

RFC 3339 timestamp indicating when the contract will end (exclusive). If not provided, the contract will be updated to be open-ended.

formatdate-time
Returns
V1ContractUpdateEndDateResponsestruct
Hide ParametersShow Parameters
DataIDstringID
package main

import (
  "context"
  "fmt"
  "time"

  "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.UpdateEndDate(context.TODO(), metronome.V1ContractUpdateEndDateParams{
    ContractID: metronome.F("d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"),
    CustomerID: metronome.F("13117714-3f05-48e5-a6e9-a66093f13b4d"),
    EndingBefore: metronome.F(time.Now()),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Data)
}
200 Example
{
  "data": {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
  }
}