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.

  • 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 add a manifest to a 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.
    • Asset > Attribute > Add resource permission on the Data Product Port asset.
collibra data-contract draft Generate a new manifest draft 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.
  • Asset > Attribute > Add 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.
  • Asset > Attribute > Add 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 end point Permissions

POST /dataContracts

Initializing a data contract is the first step in creating a new Data Contract asset and linking it to its initial manifest. You can provide an existing manifest to upload. If you do not provide one, a template is generated from the associated Collibra content. Once a data contract is initialized, you can use 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 add a manifest to a 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.
    • Asset > Attribute > Add resource permission on the Data Product Port 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 > Add resource 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

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 apply relations: Asset > Attribute > Add resource permission on the Data Product Port asset.
  • To apply 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 > Add resource 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 > Add resource 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.

Related topics

Manage data contracts

What's next