Manage data contracts with CLI or API

You can interact with the Data Contract service through a CLI or direct API calls. You can also use the Collibra user interface to create or manage data contracts.

CLI

The Data Contract CLI packages API calls to enable automation and integration. Before you use the CLI, you need to install and configure it. Then, you can use its commands to create and maintain data contracts. You can perform the following tasks from the CLI. Detailed information and examples are available in the CLI.

Command Description Permissions
collibra data-contract init

Create a data contract with an initial manifest, or add a manifest to an existing, uninitialized Data Contract asset.

  • Product Rights > Data Contract global permission.
  • View permission on the domain.
  • Asset > Add resource permission on the domain.
  • Asset > Attribute > Add resource permission on the domain.
  • To initialize an existing Data Contract asset that does not have a manifest yet:
    • View permission on the Data Contract asset.
    • Asset > Attribute > Add resource permission on the Data Contract asset.
    • Asset > Attribute > Update resource permission on the Data Contract asset.
    • If you also link the data contract to a governed asset: Asset > Attribute > Add resource permission on the governed asset.
collibra data-contract draft Generate a new manifest version based on Collibra metadata.
  • Product Rights > Data Contract global permission.
  • View permission on the Data Contract asset.
collibra data-contract push Upload a new version of a manifest to Collibra.
  • Product Rights > Data Contract global permission.
  • View permission on the Data Contract asset.
  • Asset > Attribute > Update resource permission on the Data Contract asset.
collibra data-contract fetch Retrieve a data contract.

View permission on the Data Contract asset.

collibra data-contract list List all data contracts and their metadata. View permission on the Data Contract asset.
collibra data-contract list-versions List versions and metadata for a data contract. View permission on the Data Contract asset.
collibra data-contract set-active Set a specific manifest version as active.
  • Product Rights > Data Contract global permission.
  • View permission on the Data Contract asset.
  • Asset > Attribute > Update resource permission on the Data Contract asset.
collibra data-contract clear

Depending on the delete-asset value, either clear the data contract or delete the data contract.

Clearing the data contract deletes all versions and unlinks the manifest ID from the contract.

  • Product Rights > Data Contract global permission.
  • View permission on the Data Contract asset.
  • To clear the Data Contract asset: Asset > Attribute > Remove resource permission on the Data Contract asset.
  • To delete the Data Contract asset: Asset > Remove resource permission on the Data Contract asset.
collibra data-contract delete Permanently delete a specific manifest version.
  • Product Rights > Data Contract global permission.
  • View permission on the Data Contract asset.
  • Asset > Attribute > Remove resource permission on the Data Contract asset.

Tip The CLI includes a --help flag to retrieve the built-in reference documentation, for example, ./collibra data-contract --help.

API

If you prefer to work directly with API calls, you do not need to set up the CLI. You can use any API tool, such as Postman, cURL, or Insomnia, to interact with the Data Contract service. Refer to the API specifications for detailed information about all available endpoints, including endpoints for listing contract metadata, managing versions, and setting the active version.

The required permissions are as follows.

API endpoint Permissions

POST /dataContracts

Note Initializing a data contract is the first step in linking a Data Contract asset to its initial manifest. By default, this creates a new Data Contract asset. To link the new asset to an existing governed asset (such as a Data Product Port), provide governedAssetId. To create a standalone data contract with no governed asset, omit governedAssetId but provide domainId. To initialize an existing, uninitialized Data Contract asset, provide dataContractId instead.
You can optionally provide an existing manifest to upload. If no manifest is provided during initialization, a template is generated from the associated Collibra metadata. Because a standalone data contract is not linked to a port, its generated template does not have a Schema section.
Once a data contract is initialized, you can perform all other actions on it.
  • Product Rights > Data Contract global permission.
  • View permission on the domain.
  • Asset > Add resource permission on the domain.
  • Asset > Attribute > Add resource permission on the domain.
  • To initialize an existing Data Contract asset that does not have a manifest yet (by using dataContractId):
    • View permission on the Data Contract asset.
    • Asset > Attribute > Add resource permission on the Data Contract asset.
    • Asset > Attribute > Update resource permission on the Data Contract asset.
    • If you also link the data contract to a governed asset: Asset > Attribute > Add resource permission on the governed asset.
GET /dataContracts View permission on the Data Contract asset.
GET /dataContracts/{id} View permission on the Data Contract asset.
DELETE /dataContracts/{id}
  • Product Rights > Data Contract global permission.
  • View permission on the Data Contract asset.
  • If deleteAsset=false: Asset > Attribute > Remove resource permission on the Data Contract asset.
  • If deleteAsset=true: Asset > Remove resource permission on the Data Contract asset.
POST /dataContracts/addFromManifest
  • Product Rights > Data Contract global permission.
  • View permission on the Data Contract asset.
  • Asset > Attribute > Update resource permission on the Data Contract asset.
GET /dataContracts/{id}/draftVersion View permission on the Data Contract asset.

POST /dataContracts/{id}/apply

Note The apply endpoint applies the active manifest version to the Collibra knowledge graph. This creates and updates relations, and also updates the SLA attributes that match existing out-of-the-box SLA attributes on the Data Contract asset.
  • Product Rights > Data Contract global permission.
  • View permission on the Data Contract asset.
  • To update relations: Asset > Attribute > Add resource permission on the Data Product Port asset.
  • To update SLAs:
    • Asset > Attribute > Add resource permission on the Data Contract asset.
    • Asset > Attribute > Update resource permission on the Data Contract asset.
    • Asset > Attribute > Remove resource permission on the Data Contract asset.
POST /dataContracts/{id}/versions
  • Product Rights > Data Contract global permission.
  • View permission on the Data Contract asset.
  • Asset > Attribute > Update resource permission on the Data Contract asset.
DELETE /dataContracts/{id}/versions
  • Product Rights > Data Contract global permission.
  • View permission on the Data Contract asset.
  • Asset > Attribute > Remove resource permission on the Data Contract asset.
GET /dataContracts/{id}/versions View permission on the Data Contract asset.
GET /dataContracts/{id}/versions/manifest View permission on the Data Contract asset.
GET /dataContracts/{id}/activeVersion View permission on the Data Contract asset.
PATCH /dataContracts/{id}/activeVersion
  • Product Rights > Data Contract global permission.
  • View permission on the Data Contract asset.
  • Asset > Attribute > Update resource permission on the Data Contract asset.
GET /dataContracts/{id}/activeVersion/manifest View permission on the Data Contract asset.
Note The API and CLI do not expose whether a data contract is linked to a governed asset, or which asset it is linked to. To check this, use the Collibra user interface.

Related topics

Manage data contracts

What's next