Skip to main content
GET
https://sandbox.getcollate.io/api
/
v1
/
dataContracts
/
{id}
/
odcs
Export ODCS
from metadata.sdk import configure
from metadata.sdk.entities import DataContracts

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

# Export as ODCS JSON object
odcs = DataContracts.export_odcs(contract_id).execute()
print(f"ODCS version: {odcs.apiVersion}")
print(f"Status: {odcs.status}")

# Export as YAML string
yaml_str = DataContracts.export_odcs(contract_id).as_yaml().execute()
print(yaml_str)

# Export by FQN
odcs = DataContracts.export_odcs_by_name("sales-orders-contract").execute()
{
  "apiVersion": "v3.1.0",
  "kind": "DataContract",
  "name": "sales-orders-contract",
  "version": "1.0.0",
  "status": "active",
  "domain": "ecommerce",
  "description": {
    "purpose": "Data contract for the sales orders table"
  },
  "schema": [
    {
      "name": "orders",
      "logicalType": "object",
      "properties": [
        {
          "name": "order_id",
          "logicalType": "integer",
          "required": true,
          "primaryKey": true
        },
        {
          "name": "customer_id",
          "logicalType": "integer",
          "required": true
        },
        {
          "name": "order_date",
          "logicalType": "timestamp",
          "required": true
        },
        {
          "name": "total_amount",
          "logicalType": "decimal"
        }
      ]
    }
  ],
  "quality": [
    {
      "type": "custom",
      "dimension": "completeness",
      "description": "All required fields must be present"
    }
  ],
  "slaProperties": [
    {
      "property": "frequency",
      "value": "PT1H"
    },
    {
      "property": "availability",
      "value": "99.9"
    }
  ]
}

Import & Export

Data contracts can be imported and exported using the Open Data Contract Standard (ODCS) v3.1.0 format. Both JSON and YAML are supported, with smart merge and full replace modes for updates.

Export to ODCS

Export by ID (JSON)

GET /v1/dataContracts/{id}/odcs

Export by ID (YAML)

GET /v1/dataContracts/{id}/odcs/yaml

Export by FQN (JSON)

GET /v1/dataContracts/name/{fqn}/odcs

Export by FQN (YAML)

GET /v1/dataContracts/name/{fqn}/odcs/yaml
id
string
UUID of the data contract.
fqn
string
Fully qualified name of the data contract.
fields
string
Fields to include in the export. Defaults to owners,reviewers,extension,schema,sla,security.
Export ODCS
from metadata.sdk import configure
from metadata.sdk.entities import DataContracts

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

# Export as ODCS JSON object
odcs = DataContracts.export_odcs(contract_id).execute()
print(f"ODCS version: {odcs.apiVersion}")
print(f"Status: {odcs.status}")

# Export as YAML string
yaml_str = DataContracts.export_odcs(contract_id).as_yaml().execute()
print(yaml_str)

# Export by FQN
odcs = DataContracts.export_odcs_by_name("sales-orders-contract").execute()
{
  "apiVersion": "v3.1.0",
  "kind": "DataContract",
  "name": "sales-orders-contract",
  "version": "1.0.0",
  "status": "active",
  "domain": "ecommerce",
  "description": {
    "purpose": "Data contract for the sales orders table"
  },
  "schema": [
    {
      "name": "orders",
      "logicalType": "object",
      "properties": [
        {
          "name": "order_id",
          "logicalType": "integer",
          "required": true,
          "primaryKey": true
        },
        {
          "name": "customer_id",
          "logicalType": "integer",
          "required": true
        },
        {
          "name": "order_date",
          "logicalType": "timestamp",
          "required": true
        },
        {
          "name": "total_amount",
          "logicalType": "decimal"
        }
      ]
    }
  ],
  "quality": [
    {
      "type": "custom",
      "dimension": "completeness",
      "description": "All required fields must be present"
    }
  ],
  "slaProperties": [
    {
      "property": "frequency",
      "value": "PT1H"
    },
    {
      "property": "availability",
      "value": "99.9"
    }
  ]
}

Import from ODCS

Create from ODCS JSON

POST /v1/dataContracts/odcs

Create from ODCS YAML

POST /v1/dataContracts/odcs/yaml

Create or Update from ODCS JSON

PUT /v1/dataContracts/odcs

Create or Update from ODCS YAML

PUT /v1/dataContracts/odcs/yaml
entityId
string
required
UUID of the entity to attach the contract to.
entityType
string
required
Type of the entity (e.g., table, topic, apiEndpoint).
mode
string
default:"merge"
Import mode for PUT endpoints: merge (preserves existing fields not in the import) or replace (fully overwrites the contract).
objectName
string
Schema object name to import for multi-object ODCS contracts. If not specified, auto-selects based on entity name.
Import ODCS
from metadata.sdk import configure
from metadata.sdk.entities import DataContracts

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

# Import from ODCS object (creates new contract)
contract = (DataContracts.import_odcs(table_id, "table")
    .from_odcs(odcs_contract)
    .execute())

# Import from YAML with smart merge
yaml_content = open("contract.yaml").read()
contract = (DataContracts.import_odcs(table_id, "table")
    .from_yaml(yaml_content)
    .merge()
    .execute())
Import ODCS
// Import from ODCS JSON
var contract = client.dataContracts().importFromODCS(
    entityId, "table", odcsContract
);

// Import from YAML
var contract = client.dataContracts().importFromODCSYaml(
    entityId, "table", yamlContent
);
Import ODCS
# Import from ODCS JSON (create new)
curl -X POST "{base_url}/api/v1/dataContracts/odcs?entityId=a1b2c3d4-e5f6-7890-abcd-ef1234567890&entityType=table" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d @contract.json

# Import from ODCS YAML
curl -X POST "{base_url}/api/v1/dataContracts/odcs/yaml?entityId=a1b2c3d4-e5f6-7890-abcd-ef1234567890&entityType=table" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/yaml" \
  --data-binary @contract.yaml

# Create or update with smart merge
curl -X PUT "{base_url}/api/v1/dataContracts/odcs?entityId=a1b2c3d4-e5f6-7890-abcd-ef1234567890&entityType=table&mode=merge" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d @contract.json

# Full replace
curl -X PUT "{base_url}/api/v1/dataContracts/odcs?entityId=a1b2c3d4-e5f6-7890-abcd-ef1234567890&entityType=table&mode=replace" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d @contract.json

Parse ODCS YAML

Preview an ODCS YAML contract without importing. Useful for inspecting multi-object contracts. POST /v1/dataContracts/odcs/parse/yaml
Parse YAML
curl -X POST "{base_url}/api/v1/dataContracts/odcs/parse/yaml" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/yaml" \
  --data-binary @contract.yaml
Response
{
  "name": "sales-contract",
  "version": "1.0.0",
  "status": "active",
  "schemaObjects": ["orders", "order_items"],
  "hasMultipleObjects": true
}

Validate ODCS YAML

Validate an ODCS YAML contract against a target entity without creating it. POST /v1/dataContracts/odcs/validate/yaml
entityId
string
required
UUID of the entity to validate against.
entityType
string
required
Type of the entity.
objectName
string
Schema object name for multi-object contracts.
Validate YAML
curl -X POST "{base_url}/api/v1/dataContracts/odcs/validate/yaml?entityId=a1b2c3d4-e5f6-7890-abcd-ef1234567890&entityType=table" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/yaml" \
  --data-binary @contract.yaml
Response
{
  "passed": 3,
  "failed": 1,
  "total": 4,
  "failedFields": ["missing_column"]
}

Supported ODCS Versions

VersionStatus
v3.1.0Full support
v3.0.2Supported
v3.0.1Supported
v3.0.0Supported
v2.2.2Supported
v2.2.1Supported
v2.2.0Supported

Error Handling

CodeError TypeDescription
400BAD_REQUESTInvalid ODCS content or YAML syntax
401UNAUTHORIZEDInvalid or missing authentication token
403FORBIDDENUser lacks permission
404NOT_FOUNDData contract or entity not found