Skip to main content
PATCH
Update

Authorizations

Authorization
string
header
required

API key authentication

Path Parameters

id
string
required

The contract ID.

Body

application/json
customerId
string

Unique identifier for a customer

Pattern: ^cus_[a-zA-Z0-9]+$
currency
string
Pattern: ^[A-Z]{3}$
name
string
Minimum string length: 1
contractStart
string<date-time>
contractEnd
string<date-time>
billingAnchor
string<date-time> | null

The date the contract's billing cycles are counted from. Null: the contract start.

billingStartsAt
string<date-time> | null

The date billing starts. Null: the contract start.

upliftPercent
string | null

The yearly price uplift, in percent.

Pattern: ^\d+(\.\d+)?$
note
string | null
autoCharge
boolean

Charge the invoices with the customer's stored payment method.

bankTransferOnly
boolean

Pay the invoices by bank transfer only.

terminatedAt
string<date-time> | null

End the contract early on this date.

terminationReason
string | null
autoApprove
object
lines
object[]

The complete set of lines. An entry with an id keeps that line and changes the fields sent. An entry without one is a new line. A line left out is removed.

A line the contract already has. It keeps its identity, and each field sent changes. A field left out keeps the line's value.

basedOnUpdatedAt
string<date-time>

The updatedAt of the draft or pending change you read. It is required to edit a draft or a pending change. A different value answers 409 CONTRACT_CHANGED.

Response

The contract, with its pending change when the PATCH opened or edited one

A set of priced lines with a fixed term, owned by one customer and billed in one currency. The fields show the version in force: the last approved one, or the draft while nothing is approved yet. A change that waits for approval is in pendingChange.

id
string
required

Unique identifier for a contract.

Pattern: ^ctr_[a-zA-Z0-9]+$
object
enum<string>
required
Available options:
contract
merchantId
string
required

Unique identifier for an organization

Pattern: ^org_[a-zA-Z0-9]+$
customerId
string
required

Unique identifier for a customer

Pattern: ^cus_[a-zA-Z0-9]+$
currency
string
required
status
enum<string>
required

draft and rejected hold while the contract was never approved. After approval the status follows the dates, on the customer's clock: scheduled before contractStart, active from it, and ended once contractEnd or terminatedAt has passed.

Available options:
draft,
rejected,
scheduled,
active,
ended
createdAt
string<date-time>
required

When the contract was first written: the createdAt of its first version. It does not change when a version is approved or changed.

externalReference
object | null
required

The record in another system, such as a CRM deal, that the contract comes from. A create that names a record that already has a contract returns that contract and creates nothing.

name
string
required
contractStart
string<date-time>
required
contractEnd
string<date-time>
required
billingAnchor
string<date-time> | null
required

The date the contract's billing cycles are counted from.

billingStartsAt
string<date-time> | null
required

The date billing starts, when it is not the contract start.

upliftPercent
string | null
required

The yearly price uplift, in percent.

note
string | null
required
autoCharge
boolean
required
bankTransferOnly
boolean
required
autoApprove
object
required

Two separate choices. contract: approve the contract, and each change to it, when it is written. It needs the contracts:approve permission. invoices: approve its invoices when they are collected.

terminatedAt
string<date-time> | null
required

The date the contract was ended early.

terminationReason
string | null
required
lines
object[]
required
updatedAt
string<date-time>
required

When this version last changed. Send it back as basedOnUpdatedAt to edit it.

createdByPrincipalId
string | null
required
pendingChange
object | null
required

The change that waits for a decision, in the same shape as the contract.

decidedAt
string<date-time> | null
required

When the version in force was approved or rejected.

decidedByPrincipalId
string | null
required
rejectReason
string | null
required
rejectText
string | null
required
validation
object[]

The reasons the draft or pending change cannot be approved. Empty when it can, or when nothing waits. Present on the answer to one contract, not on a list.

conflicts
object[]

Where the draft or pending change shares an item or a billable metric with another live contract of the customer. Present on the answer to one contract, not on a list.