contracts.adopt

What it does

Adopt a vendor plan version into the books: reuse or create its template and seller party, resolve tax, create a contract and optionally accept it, atomically. Choose replaces to end existing vendor contracts at the new start, or omit it to record beside them. The router retrieves catalog bytes by CID.

Before you send it

An authorized OAuth connection may call it, including a headless client. Effective membership, application grant and token permissions still apply. Describe contracts.adopt through GET /v1/catalog/commands/{name} before acting.

The envelope may reference a registered source document of kind source_document, contract, template, vendor_plan; this is separate from any evidence required by the input.

Inputs

Put these fields inside the envelope’s input object. The outer envelope names the command, a stable idempotency_key and effective_at; request and recovery rules explain those separately. Use exact minor-unit integer strings for monetary fields. Take existing IDs from prior reads or command results; choose a new identity only where the command asks for one.

Required means required within its containing object; an optional parent can be omitted.

FieldTypeRequiredMeaning and accepted values
vendorPlanobjectYes
vendorPlan.cidstringYesMinimum length: 1. Example: "bafkr4ideg6z2yocgkez77nr3outtvdnvjdcvqrs5phnqh7jvtrwnlpm5qu".
vendorPlan.templatestringYesMinimum length: 1. Example: "team".
vendorobjectYes
vendor.partyIdstringNoMinimum length: 1.
vendor.createobjectNo
vendor.create.partyIdstringYesMinimum length: 1. Example: "party_vendor".
billingCountryobjectNo
billingCountry.countrystringYesMinimum length: 1.
billingCountry.statestringNoMinimum length: 1.
billingCountry.evidencearrayYesItems: object. Minimum items: 1. Maximum items: 20.
billingCountry.evidence[].kindstringYesMinimum length: 1.
billingCountry.evidence[].refstringYesMinimum length: 1.
billingCountry.evidence[].signerstringNoMinimum length: 1.
buyerTaxobjectNo
buyerTax.registeredbooleanYes
buyerTax.registrationProvidedbooleanNo
buyerTax.evidencearrayYesItems: object. Minimum items: 1. Maximum items: 20.
buyerTax.evidence[].kindstringYesMinimum length: 1.
buyerTax.evidence[].refstringYesMinimum length: 1.
buyerTax.evidence[].signerstringNoMinimum length: 1.
sellerstringNoMinimum length: 1.
termsobjectNo
classificationobjectNo
ledgerBindingsobjectNo
sourceDocumentIdsarrayNoItems: string. Maximum items: 100.
lifecycleBindingobjectNo
lifecycleBinding.startsOnstringYesFormat: date. Minimum length: 1.
lifecycleBinding.endsOnstringNoFormat: date. Minimum length: 1.
lifecycleobjectNo
lifecycle.termobjectYes
lifecycle.term.indexintegerYesMinimum: 1. Maximum: 9007199254740991.
lifecycle.term.startsOnstringYesFormat: date. Minimum length: 1. Pattern: "^\\d{4}-\\d{2}-\\d{2}$".
lifecycle.term.endsOnstringNoFormat: date. Minimum length: 1. Pattern: "^\\d{4}-\\d{2}-\\d{2}$".
lifecycle.term.rollingschema-definedNoChoose a matching alternative in the exact schema below.
lifecycle.atTermEndstringYesChoose "renew", "evergreen", "end", "renew_once".
lifecycle.renewalobjectNo
lifecycle.renewal.lengthschema-definedNoChoose a matching alternative in the exact schema below.
lifecycle.renewal.priceschema-definedYesChoose a matching alternative in the exact schema below.
lifecycle.noticeobjectYes
lifecycle.notice.daysintegerYesMinimum: 0. Maximum: 366.
lifecycle.notice.basisstringYesChoose "calendar", "weekdays".
lifecycle.notice.remindDaysBeforeintegerNoMinimum: 0. Maximum: 366.
lifecycle.cancellationobjectNo
lifecycle.cancellation.windowsarrayYesItems: object. Minimum items: 0. Maximum items: 20.
lifecycle.cancellation.windows[].fromstringYesChoose "term_start", "term_end".
lifecycle.cancellation.windows[].daysintegerYesMinimum: 0. Maximum: 366.
lifecycle.cancellation.onlyInWindowsbooleanNoMust be true.
lifecycle.cancellation.otherwiseschema-definedYesChoose a matching alternative in the exact schema below.
acceptanceobjectNo
acceptance.sourceFactIdstringYesMinimum length: 1.
acceptance.evidenceobjectYes
acceptance.evidence.acceptancearrayYesItems: object. Minimum items: 1. Maximum items: 20.
acceptance.evidence.acceptance[].kindstringYesMinimum length: 1.
acceptance.evidence.acceptance[].refstringYesMinimum length: 1.
acceptance.evidence.acceptance[].signerstringNoMinimum length: 1.
acceptance.evidence.economicarrayNoItems: object. Minimum items: 1. Maximum items: 20.
acceptance.evidence.economic[].kindstringYesMinimum length: 1.
acceptance.evidence.economic[].refstringYesMinimum length: 1.
acceptance.evidence.economic[].signerstringNoMinimum length: 1.
acceptance.evidence.servicearrayNoItems: object. Minimum items: 1. Maximum items: 20.
acceptance.evidence.service[].kindstringYesMinimum length: 1.
acceptance.evidence.service[].refstringYesMinimum length: 1.
acceptance.evidence.service[].signerstringNoMinimum length: 1.
acceptance.factsobjectNo
replacesarrayNoItems: string. Maximum items: 100.
retireCreditbooleanNo

After acceptance

When the command emits events, its documented effects and receipt are recorded in the command transaction. The response returns commandId, replayed, the command-specific result below and emitted events with their IDs and CIDs. A command is not automatically a cash movement or revenue recognition: use the behavior above to determine what this command records.

Inspect result and the affected records or reports before continuing. Save returned identifiers for later calls. Fetch GET /v1/commands/{id} with commandId to recover the accepted receipt; retry the same intent with the same idempotency key if the response was lost. Some commands can succeed with events: [] and return a transient result and commandId without persisting a receipt. A lookup of that ID can return null; retain the returned result and verify the affected record. Retrying can re-evaluate the current state rather than replay a stored result. A domain no_change is a separate success outcome with no persisted receipt.

Result fields

Required means required within its containing object; an optional parent can be omitted.

FieldTypeRequiredMeaning and accepted values
contractIdstringYesMinimum length: 1.
contractDocumentIdstringNoMinimum length: 1.
templateIdstringYesMinimum length: 1.
templateDocumentIdstringNoMinimum length: 1.
partyIdstringNoMinimum length: 1.
reusedbooleanYes
firstCopybooleanNo
sellerstringNoMinimum length: 1.
taxobjectNo
tax.outcomestringYesMinimum length: 1.
tax.rolestringNoMinimum length: 1.
flagsarrayNoItems: string.

All commands · Operation and errors · Reusable schemas

Keep credentials out of prompts; rehearse writes only in a disposable sandbox.

Exact request schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "const": "contracts.adopt"
    },
    "input": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "vendorPlan": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "cid": {
              "type": "string",
              "minLength": 1
            },
            "template": {
              "type": "string",
              "minLength": 1
            }
          },
          "required": [
            "cid",
            "template"
          ]
        },
        "vendor": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "partyId": {
              "type": "string",
              "minLength": 1
            },
            "create": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "partyId": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "partyId"
              ]
            }
          },
          "required": []
        },
        "billingCountry": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "country": {
              "type": "string",
              "minLength": 1
            },
            "state": {
              "type": "string",
              "minLength": 1
            },
            "evidence": {
              "type": "array",
              "minItems": 1,
              "maxItems": 20,
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "minLength": 1
                  },
                  "ref": {
                    "type": "string",
                    "minLength": 1
                  },
                  "signer": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "kind",
                  "ref"
                ]
              }
            }
          },
          "required": [
            "country",
            "evidence"
          ]
        },
        "buyerTax": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "registered": {
              "type": "boolean"
            },
            "registrationProvided": {
              "type": "boolean"
            },
            "evidence": {
              "type": "array",
              "minItems": 1,
              "maxItems": 20,
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "minLength": 1
                  },
                  "ref": {
                    "type": "string",
                    "minLength": 1
                  },
                  "signer": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "kind",
                  "ref"
                ]
              }
            }
          },
          "required": [
            "registered",
            "evidence"
          ]
        },
        "seller": {
          "type": "string",
          "minLength": 1
        },
        "terms": {
          "type": "object",
          "maxProperties": 100,
          "additionalProperties": {
            "type": "object",
            "maxProperties": 100,
            "additionalProperties": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "classification": {
          "type": "object",
          "maxProperties": 100,
          "additionalProperties": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "expenseAccount": {
                "type": "integer"
              },
              "expenseFunction": {
                "type": "string"
              },
              "taxCode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "taxTreatment": {
                "enum": [
                  "exclusive",
                  "inclusive",
                  null
                ]
              }
            }
          }
        },
        "ledgerBindings": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "minLength": 1
          }
        },
        "sourceDocumentIds": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "maxItems": 100
        },
        "lifecycleBinding": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "startsOn": {
              "type": "string",
              "minLength": 1,
              "format": "date"
            },
            "endsOn": {
              "type": "string",
              "minLength": 1,
              "format": "date"
            }
          },
          "required": [
            "startsOn"
          ]
        },
        "lifecycle": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "term": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "index": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "startsOn": {
                  "type": "string",
                  "minLength": 1,
                  "format": "date",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "endsOn": {
                  "type": "string",
                  "minLength": 1,
                  "format": "date",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "rolling": {
                  "anyOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "everyMonths": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 120
                        }
                      },
                      "required": [
                        "everyMonths"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "everyDays": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 3660
                        }
                      },
                      "required": [
                        "everyDays"
                      ]
                    }
                  ]
                }
              },
              "required": [
                "index",
                "startsOn"
              ]
            },
            "atTermEnd": {
              "enum": [
                "renew",
                "evergreen",
                "end",
                "renew_once"
              ]
            },
            "renewal": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "length": {
                  "anyOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "everyMonths": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 120
                        }
                      },
                      "required": [
                        "everyMonths"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "everyDays": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 3660
                        }
                      },
                      "required": [
                        "everyDays"
                      ]
                    }
                  ]
                },
                "price": {
                  "anyOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "rule": {
                          "enum": [
                            "same",
                            "list"
                          ]
                        },
                        "reducedLosesPrice": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "quantityTerms": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "right": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "term": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "right",
                                  "term"
                                ]
                              },
                              "maxItems": 100,
                              "minItems": 1
                            }
                          },
                          "required": [
                            "quantityTerms"
                          ]
                        }
                      },
                      "required": [
                        "rule"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "rule": {
                          "const": "uplift"
                        },
                        "bps": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 100000
                        },
                        "terms": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "right": {
                                "type": "string",
                                "minLength": 1
                              },
                              "term": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "right",
                              "term"
                            ]
                          },
                          "maxItems": 100,
                          "minItems": 1
                        },
                        "reducedLosesPrice": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "quantityTerms": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "right": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "term": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "right",
                                  "term"
                                ]
                              },
                              "maxItems": 100,
                              "minItems": 1
                            }
                          },
                          "required": [
                            "quantityTerms"
                          ]
                        }
                      },
                      "required": [
                        "rule",
                        "bps",
                        "terms"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "rule": {
                          "const": "capped"
                        },
                        "bps": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 100000
                        },
                        "terms": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "right": {
                                "type": "string",
                                "minLength": 1
                              },
                              "term": {
                                "type": "string",
                                "minLength": 1
                              }
                            },
                            "required": [
                              "right",
                              "term"
                            ]
                          },
                          "maxItems": 100,
                          "minItems": 1
                        },
                        "index": {
                          "type": "string",
                          "minLength": 1
                        },
                        "uncappedWhen": {
                          "type": "array",
                          "items": {
                            "enum": [
                              "quantity_reduced",
                              "term_shortened"
                            ]
                          },
                          "maxItems": 2,
                          "minItems": 0
                        },
                        "reducedLosesPrice": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "quantityTerms": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                  "right": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "term": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": [
                                  "right",
                                  "term"
                                ]
                              },
                              "maxItems": 100,
                              "minItems": 1
                            }
                          },
                          "required": [
                            "quantityTerms"
                          ]
                        }
                      },
                      "required": [
                        "rule",
                        "bps",
                        "terms"
                      ]
                    }
                  ]
                }
              },
              "required": [
                "price"
              ]
            },
            "notice": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "days": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 366
                },
                "basis": {
                  "enum": [
                    "calendar",
                    "weekdays"
                  ]
                },
                "remindDaysBefore": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 366
                }
              },
              "required": [
                "days",
                "basis"
              ]
            },
            "cancellation": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "windows": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "from": {
                        "enum": [
                          "term_start",
                          "term_end"
                        ]
                      },
                      "days": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 366
                      }
                    },
                    "required": [
                      "from",
                      "days"
                    ]
                  },
                  "maxItems": 20,
                  "minItems": 0
                },
                "onlyInWindows": {
                  "const": true
                },
                "otherwise": {
                  "anyOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "type": {
                          "const": "none"
                        }
                      },
                      "required": [
                        "type"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "type": {
                          "const": "fee"
                        },
                        "right": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "type",
                        "right"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "type": {
                          "const": "accelerate"
                        },
                        "rights": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1
                          },
                          "maxItems": 100,
                          "minItems": 1
                        }
                      },
                      "required": [
                        "type",
                        "rights"
                      ]
                    }
                  ]
                }
              },
              "required": [
                "windows",
                "otherwise"
              ]
            }
          },
          "required": [
            "term",
            "atTermEnd",
            "notice"
          ]
        },
        "acceptance": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "sourceFactId": {
              "type": "string",
              "minLength": 1
            },
            "evidence": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "acceptance": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 20,
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1
                      },
                      "ref": {
                        "type": "string",
                        "minLength": 1
                      },
                      "signer": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind",
                      "ref"
                    ]
                  }
                },
                "economic": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 20,
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1
                      },
                      "ref": {
                        "type": "string",
                        "minLength": 1
                      },
                      "signer": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind",
                      "ref"
                    ]
                  }
                },
                "service": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 20,
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "kind": {
                        "type": "string",
                        "minLength": 1
                      },
                      "ref": {
                        "type": "string",
                        "minLength": 1
                      },
                      "signer": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind",
                      "ref"
                    ]
                  }
                }
              },
              "required": [
                "acceptance"
              ]
            },
            "facts": {
              "type": "object"
            }
          },
          "required": [
            "sourceFactId",
            "evidence"
          ]
        },
        "replaces": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "maxItems": 100,
          "uniqueItems": true
        },
        "retireCredit": {
          "type": "boolean"
        }
      },
      "required": [
        "vendorPlan",
        "vendor"
      ]
    },
    "idempotency_key": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "effective_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
    },
    "source_document_id": {
      "description": "A registered document of kind source_document, contract, template, vendor_plan that caused this command.",
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "name",
    "input",
    "idempotency_key",
    "effective_at"
  ],
  "additionalProperties": false
}

Accepted command receipt

{
  "type": "object",
  "required": [
    "commandId",
    "replayed",
    "result",
    "events"
  ],
  "properties": {
    "commandId": {
      "type": "string"
    },
    "replayed": {
      "type": "boolean"
    },
    "imported": {
      "const": true,
      "description": "The command's events are history from before the business joined Economico, recorded as an import: free of monthly events."
    },
    "result": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "contractId": {
          "type": "string",
          "minLength": 1
        },
        "contractDocumentId": {
          "type": "string",
          "minLength": 1
        },
        "templateId": {
          "type": "string",
          "minLength": 1
        },
        "templateDocumentId": {
          "type": "string",
          "minLength": 1
        },
        "partyId": {
          "type": "string",
          "minLength": 1
        },
        "reused": {
          "type": "boolean"
        },
        "firstCopy": {
          "type": "boolean"
        },
        "seller": {
          "type": "string",
          "minLength": 1
        },
        "tax": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "outcome": {
              "type": "string",
              "minLength": 1
            },
            "role": {
              "type": "string",
              "minLength": 1
            }
          },
          "required": [
            "outcome"
          ]
        },
        "flags": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "required": [
        "contractId",
        "templateId",
        "reused"
      ]
    },
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "cid": {
            "type": "string"
          }
        }
      }
    }
  }
}

Example request

{
  "name": "contracts.adopt",
  "input": {
    "vendorPlan": {
      "cid": "bafkr4ideg6z2yocgkez77nr3outtvdnvjdcvqrs5phnqh7jvtrwnlpm5qu",
      "template": "team"
    },
    "vendor": {
      "create": {
        "partyId": "party_vendor"
      }
    }
  },
  "effective_at": "2026-09-01T00:00:00Z",
  "idempotency_key": "contracts.adopt-example-0"
}
Navigate documentation