Skip to main content
POST
https://sandbox.getcollate.io/api
/
v1
/
dataContracts
POST /v1/dataContracts
from metadata.sdk import configure
from metadata.sdk.entities import DataContracts

configure(
    host="https://your-company.getcollate.io/api",
    jwt_token="your-jwt-token"
)

# Create a basic data contract for a table
contract = DataContracts.create(
    name="sales-orders-contract",
    entity={
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "type": "table"
    },
    description="Data contract for the sales orders table",
    entityStatus="Active",
    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": "hasOwner"},
        {"name": "hasDescription"},
        {"name": "hasTags"}
    ],
    sla={
        "refreshFrequency": "PT1H",
        "availability": 99.9
    }
)
print(f"Created contract: {contract.fullyQualifiedName}")
{
  "id": "f7a1b2c3-d4e5-6789-0abc-def123456789",
  "name": "sales-orders-contract",
  "fullyQualifiedName": "sales-orders-contract",
  "displayName": "sales-orders-contract",
  "description": "Data contract for the sales orders table",
  "entityStatus": "Active",
  "entity": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "type": "table",
    "name": "sales_orders",
    "fullyQualifiedName": "sample_data.ecommerce_db.shopify.sales_orders"
  },
  "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": "hasOwner"},
    {"name": "hasDescription"},
    {"name": "hasTags"}
  ],
  "sla": {
    "refreshFrequency": "PT1H",
    "availability": 99.9
  },
  "version": 0.1,
  "updatedAt": 1769982800000,
  "updatedBy": "admin"
}

Create a Data Contract

Create a new data contract and attach it to a data asset. Only the name and entity reference are required — all other sections (schema, semantics, quality, SLA, security, terms of use) are optional.

Body Parameters

name
string
required
Name of the data contract. Must be unique.
entity
object
required
Reference to the data asset this contract applies to.
displayName
string
Human-readable display name.
description
string
Description in Markdown format.
entityStatus
string
default:"Draft"
Contract status: Draft, Active, or Deprecated.
schema
array
Expected column definitions. Each item follows the Column schema.
semantics
array
Semantics rules defining business expectations.
qualityExpectations
array
References to test cases that must pass.
sla
object
Service level agreement expectations.
termsOfUse
string
Terms of use in Markdown format. Describes allowed/disallowed use cases and compliance requirements.
security
object
Security and access policy expectations.
owners
array
Owner references (users or teams).
reviewers
array
Reviewer user references.
effectiveFrom
string
ISO 8601 date from which this contract is effective.
effectiveUntil
string
ISO 8601 date until which this contract is effective.
POST /v1/dataContracts
from metadata.sdk import configure
from metadata.sdk.entities import DataContracts

configure(
    host="https://your-company.getcollate.io/api",
    jwt_token="your-jwt-token"
)

# Create a basic data contract for a table
contract = DataContracts.create(
    name="sales-orders-contract",
    entity={
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "type": "table"
    },
    description="Data contract for the sales orders table",
    entityStatus="Active",
    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": "hasOwner"},
        {"name": "hasDescription"},
        {"name": "hasTags"}
    ],
    sla={
        "refreshFrequency": "PT1H",
        "availability": 99.9
    }
)
print(f"Created contract: {contract.fullyQualifiedName}")
{
  "id": "f7a1b2c3-d4e5-6789-0abc-def123456789",
  "name": "sales-orders-contract",
  "fullyQualifiedName": "sales-orders-contract",
  "displayName": "sales-orders-contract",
  "description": "Data contract for the sales orders table",
  "entityStatus": "Active",
  "entity": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "type": "table",
    "name": "sales_orders",
    "fullyQualifiedName": "sample_data.ecommerce_db.shopify.sales_orders"
  },
  "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": "hasOwner"},
    {"name": "hasDescription"},
    {"name": "hasTags"}
  ],
  "sla": {
    "refreshFrequency": "PT1H",
    "availability": 99.9
  },
  "version": 0.1,
  "updatedAt": 1769982800000,
  "updatedBy": "admin"
}

Upsert (Create or Update)

Use PUT /v1/dataContracts with the same body to create a new contract or update an existing one.

Error Handling

CodeError TypeDescription
400BAD_REQUESTInvalid request body or missing required fields
401UNAUTHORIZEDInvalid or missing authentication token
403FORBIDDENUser lacks permission to create data contracts
409CONFLICTA contract with the same name already exists