Update a contract
const url = 'https://api.ebitex.io/content/management/v1/contracts/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","externalId":"example","parentContractId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","isAbstract":true,"fields":[{"name":"example","externalId":"example","fieldTypeKey":"example","isMandatory":true,"isEnumerable":true,"isLocalizable":true,"isContextual":true,"isPersonalizable":true,"settings":"example","defaultValue":"example"}],"rowVersion":1,"defaultFolderId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","titleFieldPath":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.ebitex.io/content/management/v1/contracts/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "externalId": "example", "parentContractId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "isAbstract": true, "fields": [ { "name": "example", "externalId": "example", "fieldTypeKey": "example", "isMandatory": true, "isEnumerable": true, "isLocalizable": true, "isContextual": true, "isPersonalizable": true, "settings": "example", "defaultValue": "example" } ], "rowVersion": 1, "defaultFolderId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "titleFieldPath": "example" }'Replaces a contract’s definition. The body has the same members as a create, and fields is the complete new list in order: a field left out is removed. Send the rowVersion from your last read so an edit somebody else made in between is refused rather than overwritten.
Each save is classified against the current definition. A breaking change (removing a field, adding a mandatory one, changing the parent, tightening a setting) cuts a new version, and every contract that inherits from this one gets a new version too; components already pinned to an older version keep validating against it. An additive change updates the latest version in place, and a save that changes nothing writes no version. When the contract is used as a template’s settings contract, each such template also records a new version.
Add ?dryRun=true to run the same validation and change classification without saving anything. The response is { classification, currentLatestVersionNumber, resultingVersionNumber, breakingReasons }, where classification is new, additive, breaking or noChange, and each breaking reason is { fieldExternalId, reason }.
Key: a management key with content.management.authoring.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Query Parameters
Section titled “Query Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Examplegenerated
{ "name": "example", "externalId": "example", "parentContractId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "isAbstract": true, "fields": [ { "name": "example", "externalId": "example", "fieldTypeKey": "example", "isMandatory": true, "isEnumerable": true, "isLocalizable": true, "isContextual": true, "isPersonalizable": true, "settings": "example", "defaultValue": "example" } ], "rowVersion": 1, "defaultFolderId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "titleFieldPath": "example"}Responses
Section titled “ Responses ”The updated contract, shaped like getContract. With dryRun=true, the change classification instead.
validation_failed: the body is invalid. errors maps each failing member (such as externalId or fields[2].settings) to a message.
missing_api_key or invalid_api_key: no key was sent, or it is unknown, revoked or expired.
payment_required: the organization’s subscription needs attention.
permission_denied: the key’s role lacks content.contracts.manage.
scope_denied: the key lacks this route’s scope. tier_required: the Content Management API needs the Pro plan or above. ip_denied: the caller’s address is outside the key’s allowed ranges. app_not_available: Content is not enabled for the organization.
No contract with this id exists in the key’s environment.
concurrency_conflict: the contract changed since rowVersion; the body carries currentRowVersion and currentUpdatedAtUtc, so re-read and reapply your change. duplicate_external_id: another contract already has this external id. contract_read_only: the contract is synced from a content provider and changes only when that provider is refreshed. inherited_read_only: the contract is inherited from another environment (sourceEnvironmentId); edit it there.
Rate limit or quota exceeded; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.