PUT /v1/dataContracts
curl -X PUT "{base_url}/api/v1/dataContracts" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"name": "sales-orders-contract",
"entity": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"type": "table"
},
"description": "Data contract for the sales orders table",
"entityStatus": "Approved",
"schema": [
{"name": "order_id", "dataType": "INT", "constraint": "PRIMARY_KEY"},
{"name": "customer_id", "dataType": "INT", "constraint": "NOT_NULL"},
{"name": "order_date", "dataType": "TIMESTAMP", "constraint": "NOT_NULL"},
{"name": "total_amount", "dataType": "DECIMAL"}
],
"semantics": [
{
"name": "Has owner",
"description": "The table must have an owner",
"rule": "{\"!!\":{\"var\":\"owners\"}}",
"enabled": true
},
{
"name": "Has description",
"description": "The table must have a description",
"rule": "{\"!!\":{\"var\":\"description\"}}",
"enabled": true
}
],
"sla": {
"refreshFrequency": {"interval": 1, "unit": "hour"},
"maxLatency": {"value": 4, "unit": "hour"}
}
}'
from metadata.sdk import configure
from metadata.sdk.entities import DataContracts
configure(
host="https://your-company.getcollate.io/api",
jwt_token="your-jwt-token"
)
# Update contract description and status
contract = DataContracts.update(
"f7a1b2c3-d4e5-6789-0abc-def123456789",
description="Updated contract for sales orders table",
entityStatus="Approved"
)
import static org.openmetadata.sdk.fluent.DataContracts.*;
// client is an initialized OpenMetadataClient.
setDefaultClient(client);
// Update using fluent API
FluentDataContract contract = find(contractId).fetch();
contract.withDescription("Updated contract for sales orders table")
.withStatus(EntityStatus.APPROVED)
.save();
# Update description
curl -X PATCH "{base_url}/api/v1/dataContracts/f7a1b2c3-d4e5-6789-0abc-def123456789" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated contract for sales orders table"},
{"op": "replace", "path": "/entityStatus", "value": "Approved"}
]'
# Add a semantic rule
curl -X PATCH "{base_url}/api/v1/dataContracts/f7a1b2c3-d4e5-6789-0abc-def123456789" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "add", "path": "/semantics/-", "value": {"name": "hasDomain"}}
]'
{
"id": "f7a1b2c3-d4e5-6789-0abc-def123456789",
"name": "sales-orders-contract",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.sales_orders.dataContract_sales-orders-contract",
"description": "Updated contract for sales orders table",
"entityStatus": "Approved",
"entity": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"type": "table",
"name": "sales_orders",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.sales_orders"
},
"version": 0.2,
"updatedAt": 1769986400000,
"updatedBy": "admin",
"changeDescription": {
"fieldsUpdated": [
{"name": "description", "oldValue": "Data contract for the sales orders table", "newValue": "Updated contract for sales orders table"},
{"name": "entityStatus", "oldValue": "Draft", "newValue": "Approved"}
]
}
}
Update a Data Contract
Create or update a data contract with a full request body
PUT
/
v1
/
dataContracts
PUT /v1/dataContracts
curl -X PUT "{base_url}/api/v1/dataContracts" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"name": "sales-orders-contract",
"entity": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"type": "table"
},
"description": "Data contract for the sales orders table",
"entityStatus": "Approved",
"schema": [
{"name": "order_id", "dataType": "INT", "constraint": "PRIMARY_KEY"},
{"name": "customer_id", "dataType": "INT", "constraint": "NOT_NULL"},
{"name": "order_date", "dataType": "TIMESTAMP", "constraint": "NOT_NULL"},
{"name": "total_amount", "dataType": "DECIMAL"}
],
"semantics": [
{
"name": "Has owner",
"description": "The table must have an owner",
"rule": "{\"!!\":{\"var\":\"owners\"}}",
"enabled": true
},
{
"name": "Has description",
"description": "The table must have a description",
"rule": "{\"!!\":{\"var\":\"description\"}}",
"enabled": true
}
],
"sla": {
"refreshFrequency": {"interval": 1, "unit": "hour"},
"maxLatency": {"value": 4, "unit": "hour"}
}
}'
from metadata.sdk import configure
from metadata.sdk.entities import DataContracts
configure(
host="https://your-company.getcollate.io/api",
jwt_token="your-jwt-token"
)
# Update contract description and status
contract = DataContracts.update(
"f7a1b2c3-d4e5-6789-0abc-def123456789",
description="Updated contract for sales orders table",
entityStatus="Approved"
)
import static org.openmetadata.sdk.fluent.DataContracts.*;
// client is an initialized OpenMetadataClient.
setDefaultClient(client);
// Update using fluent API
FluentDataContract contract = find(contractId).fetch();
contract.withDescription("Updated contract for sales orders table")
.withStatus(EntityStatus.APPROVED)
.save();
# Update description
curl -X PATCH "{base_url}/api/v1/dataContracts/f7a1b2c3-d4e5-6789-0abc-def123456789" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated contract for sales orders table"},
{"op": "replace", "path": "/entityStatus", "value": "Approved"}
]'
# Add a semantic rule
curl -X PATCH "{base_url}/api/v1/dataContracts/f7a1b2c3-d4e5-6789-0abc-def123456789" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "add", "path": "/semantics/-", "value": {"name": "hasDomain"}}
]'
{
"id": "f7a1b2c3-d4e5-6789-0abc-def123456789",
"name": "sales-orders-contract",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.sales_orders.dataContract_sales-orders-contract",
"description": "Updated contract for sales orders table",
"entityStatus": "Approved",
"entity": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"type": "table",
"name": "sales_orders",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.sales_orders"
},
"version": 0.2,
"updatedAt": 1769986400000,
"updatedBy": "admin",
"changeDescription": {
"fieldsUpdated": [
{"name": "description", "oldValue": "Data contract for the sales orders table", "newValue": "Updated contract for sales orders table"},
{"name": "entityStatus", "oldValue": "Draft", "newValue": "Approved"}
]
}
}
Update a Data Contract
Create a data contract or update it if it already exists, usingPUT /v1/dataContracts with the full request body. Send the complete definition, not just the fields you want to change. To change only some fields, use PATCH with a JSON Patch array and the application/json-patch+json content type, as shown in the PATCH examples below.
Body Parameters
Reference to the data asset this contract applies to.
Contract status:
Draft, In Review, Approved, Archived, Deprecated, Rejected, or Unprocessed.Service level agreement expectations.
Show properties
Show properties
Terms of use in Markdown format. Describes allowed/disallowed use cases and compliance requirements.
Security and access policy expectations.
Show properties
Show properties
Intended consumers of the data and the policies that govern their access.
PUT /v1/dataContracts
curl -X PUT "{base_url}/api/v1/dataContracts" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{
"name": "sales-orders-contract",
"entity": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"type": "table"
},
"description": "Data contract for the sales orders table",
"entityStatus": "Approved",
"schema": [
{"name": "order_id", "dataType": "INT", "constraint": "PRIMARY_KEY"},
{"name": "customer_id", "dataType": "INT", "constraint": "NOT_NULL"},
{"name": "order_date", "dataType": "TIMESTAMP", "constraint": "NOT_NULL"},
{"name": "total_amount", "dataType": "DECIMAL"}
],
"semantics": [
{
"name": "Has owner",
"description": "The table must have an owner",
"rule": "{\"!!\":{\"var\":\"owners\"}}",
"enabled": true
},
{
"name": "Has description",
"description": "The table must have a description",
"rule": "{\"!!\":{\"var\":\"description\"}}",
"enabled": true
}
],
"sla": {
"refreshFrequency": {"interval": 1, "unit": "hour"},
"maxLatency": {"value": 4, "unit": "hour"}
}
}'
from metadata.sdk import configure
from metadata.sdk.entities import DataContracts
configure(
host="https://your-company.getcollate.io/api",
jwt_token="your-jwt-token"
)
# Update contract description and status
contract = DataContracts.update(
"f7a1b2c3-d4e5-6789-0abc-def123456789",
description="Updated contract for sales orders table",
entityStatus="Approved"
)
import static org.openmetadata.sdk.fluent.DataContracts.*;
// client is an initialized OpenMetadataClient.
setDefaultClient(client);
// Update using fluent API
FluentDataContract contract = find(contractId).fetch();
contract.withDescription("Updated contract for sales orders table")
.withStatus(EntityStatus.APPROVED)
.save();
# Update description
curl -X PATCH "{base_url}/api/v1/dataContracts/f7a1b2c3-d4e5-6789-0abc-def123456789" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "replace", "path": "/description", "value": "Updated contract for sales orders table"},
{"op": "replace", "path": "/entityStatus", "value": "Approved"}
]'
# Add a semantic rule
curl -X PATCH "{base_url}/api/v1/dataContracts/f7a1b2c3-d4e5-6789-0abc-def123456789" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json-patch+json" \
-d '[
{"op": "add", "path": "/semantics/-", "value": {"name": "hasDomain"}}
]'
{
"id": "f7a1b2c3-d4e5-6789-0abc-def123456789",
"name": "sales-orders-contract",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.sales_orders.dataContract_sales-orders-contract",
"description": "Updated contract for sales orders table",
"entityStatus": "Approved",
"entity": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"type": "table",
"name": "sales_orders",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.sales_orders"
},
"version": 0.2,
"updatedAt": 1769986400000,
"updatedBy": "admin",
"changeDescription": {
"fieldsUpdated": [
{"name": "description", "oldValue": "Data contract for the sales orders table", "newValue": "Updated contract for sales orders table"},
{"name": "entityStatus", "oldValue": "Draft", "newValue": "Approved"}
]
}
}
Common Patch Operations
| Operation | Path | Description |
|---|---|---|
replace | /description | Update description |
replace | /entityStatus | Change status (for example, Draft, Approved, Deprecated) |
add | /semantics/- | Add a semantic rule |
remove | /semantics/0 | Remove a semantic rule by index |
replace | /sla | Update SLA section |
add | /schema/- | Add a schema column |
Error Handling
| Code | Error Type | Description |
|---|---|---|
400 | BAD_REQUEST | Invalid patch operations |
401 | UNAUTHORIZED | Invalid or missing authentication token |
403 | FORBIDDEN | User lacks permission to update data contracts |
Was this page helpful?