# Data contracts

**Base URL:** `https://{tenant}.{region}.qlikcloud.com`

Use the Data contracts API to manage data contracts for datasets in Qlik Cloud.

## Table of Contents

| Method | Path | Description |
|--------|------|-------------|
| `DELETE` | [`/api/data-governance/data-contracts/datasets/{datasetId}`](#delete-apidata-governancedata-contractsdatasetsdatasetid) | Permanently deletes the data contract for the given dataset, along with every expectation and evaluation belonging to it. This is a hard delete: unlike deactivation, nothing is preserved and the operation cannot be undone. |
| `GET` | [`/api/data-governance/data-contracts/datasets/{datasetId}/expectations`](#get-apidata-governancedata-contractsdatasetsdatasetidexpectations) | Returns every expectation for the dataset — the Trust Score dimension expectations and the data volume expectation — with their current activation status, configured thresholds or bounds, latest actual value, and last evaluation result. If the dataset has no data contract, the operation still returns 200 with the default, non-activated expectations. For non-activated expectations, the actual value (Trust Score) or row count (volume) is fetched live while the response is built and is omitted if it cannot be retrieved. |
| `PATCH` | [`/api/data-governance/data-contracts/datasets/{datasetId}/expectations`](#patch-apidata-governancedata-contractsdatasetsdatasetidexpectations) | Updates, activates, or deactivates the dataset's expectations in a single call. Trust Score and data volume expectations are supplied in their respective arrays, and each item is processed independently: some items may succeed while others fail, and the per-item outcome is reported in the response with HTTP 200. When the dataset has no data contract yet, activating at least one expectation creates the contract; a request that would create a contract without activating any expectation is rejected with HTTP 400. For Trust Score items, threshold and warning must be within 0-100 and warning, when set, must be strictly greater than threshold. |
| `POST` | [`/api/data-governance/data-contracts/datasets/actions/create`](#post-apidata-governancedata-contractsdatasetsactionscreate) | Creates a data contract for each listed dataset ID, notably to apply a contract to every dataset of a data product at once. The caller's "Compute data quality" write privilege is checked once for the whole request, before any dataset is processed: it does not depend on any single dataset, so a caller lacking it is rejected upfront with HTTP 403, rather than failing every dataset entry individually. Each dataset is then processed independently and concurrently: a failure on one dataset (no write permission on its space, dataset not found, or a contract already existing for that dataset) does not block the others. An existing contract is never overwritten. The request is capped at 100 datasets; a larger batch is rejected upfront with HTTP 400, before any contract is created. |

## API Reference

### DELETE /api/data-governance/data-contracts/datasets/{datasetId}

Permanently deletes the data contract for the given dataset, along with every expectation and evaluation belonging to it. This is a hard delete: unlike deactivation, nothing is preserved and the operation cannot be undone.

- **Rate Limit:** Tier 2 (100 requests per minute)

#### Path Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `datasetId` | string | Yes |  |

#### Responses

##### 204

The data contract, its expectations, and its evaluation history were deleted.

##### 400

The datasetId path parameter is malformed.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 401

User does not have valid authentication credentials.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 403

User does not have access to the resource, or the feature is not available for this tenant.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 404

Dataset or data contract not found.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 500

Internal Server Error.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 502

The Catalog service could not be reached to verify the dataset.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

#### Examples

**JavaScript:**

```javascript
// qlik-api has not implemented support for `DELETE /api/data-governance/data-contracts/datasets/{datasetId}` yet.
// In the meantime, you can use fetch like this:

const response = await fetch(
  '/api/data-governance/data-contracts/datasets/{datasetId}',
  {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json',
    },
  },
)

```

**Qlik CLI:**

```bash
# qlik-cli has not implemented support for DELETE /api/data-governance/data-contracts/datasets/{datasetId} yet.
```

**cURL:**

```bash
curl "https://{tenant}.{region}.qlikcloud.com/api/data-governance/data-contracts/datasets/{datasetId}" \
-X DELETE \
-H "Authorization: Bearer <access_token>"
```

---

### GET /api/data-governance/data-contracts/datasets/{datasetId}/expectations

Returns every expectation for the dataset — the Trust Score dimension expectations and the data volume expectation — with their current activation status, configured thresholds or bounds, latest actual value, and last evaluation result. If the dataset has no data contract, the operation still returns 200 with the default, non-activated expectations. For non-activated expectations, the actual value (Trust Score) or row count (volume) is fetched live while the response is built and is omitted if it cannot be retrieved.

- **Rate Limit:** Tier 1 (1000 requests per minute)

#### Path Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `datasetId` | string | Yes |  |

#### Responses

##### 200

Expectations retrieved successfully.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `expectations` | undefined[] | Yes |  |

<details>
<summary>Properties of `expectations`</summary>

**One of:**

**Option 1:**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `GetTrustScoreExpectationItem` | object | No |  |

<details>
<summary>Properties of `GetTrustScoreExpectationItem`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | The name of a trust score dimension. Enum: "global", "validity", "completeness", "accuracy", "diversity", "discoverability", "usage", "timeliness" |
| `status` | string | Yes | Activation status of an expectation. `ACTIVATED` means the expectation is enforced, `DEACTIVATED` means it was explicitly turned off, and `NOT_ACTIVATED` means it has never been activated. Enum: "ACTIVATED", "DEACTIVATED", "NOT_ACTIVATED" |
| `category` | string | Yes | The expectations category. |
| `updatedAt` | string | No | When the expectation was last updated. Absent for NOT_ACTIVATED items. |
| `activatable` | boolean | No | Whether the expectation can be activated right now. Present only for non-active items (NOT_ACTIVATED and DEACTIVATED); omitted for ACTIVATED items. For trust_score expectations it is true only when the dataset has a computed Trust Score and the dimension is available, and false otherwise (quality not computed, dimension disabled, or the Trust Score service is unreachable). Always true for data_profile expectations. |
| `trustScore` | object | Yes |  |

<details>
<summary>Properties of `trustScore`</summary>

_Properties truncated due to depth limit._

</details>

</details>

**Option 2:**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `GetVolumeExpectationItem` | object | No |  |

<details>
<summary>Properties of `GetVolumeExpectationItem`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | The name of a volume expectation. Enum: "volume" |
| `status` | string | Yes | Activation status of an expectation. `ACTIVATED` means the expectation is enforced, `DEACTIVATED` means it was explicitly turned off, and `NOT_ACTIVATED` means it has never been activated. Enum: "ACTIVATED", "DEACTIVATED", "NOT_ACTIVATED" |
| `category` | string | Yes | The expectations category. |
| `updatedAt` | string | No | When the expectation was last updated. Absent for NOT_ACTIVATED items. |
| `activatable` | boolean | No | Whether the expectation can be activated right now. Present only for non-active items (NOT_ACTIVATED and DEACTIVATED); omitted for ACTIVATED items. For trust_score expectations it is true only when the dataset has a computed Trust Score and the dimension is available, and false otherwise (quality not computed, dimension disabled, or the Trust Score service is unreachable). Always true for data_profile expectations. |
| `dataProfile` | object | Yes |  |

<details>
<summary>Properties of `dataProfile`</summary>

_Properties truncated due to depth limit._

</details>

</details>

</details>

##### 400

The datasetId path parameter is malformed.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 401

User does not have valid authentication credentials.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 403

User does not have access to the resource, or the feature is not available for this tenant.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 404

Dataset not found.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 500

Internal Server Error.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 502

The Catalog service could not be reached to verify the dataset.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

#### Examples

**JavaScript:**

```javascript
// qlik-api has not implemented support for `GET /api/data-governance/data-contracts/datasets/{datasetId}/expectations` yet.
// In the meantime, you can use fetch like this:

const response = await fetch(
  '/api/data-governance/data-contracts/datasets/{datasetId}/expectations',
  {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json',
    },
  },
)

```

**Qlik CLI:**

```bash
# qlik-cli has not implemented support for GET /api/data-governance/data-contracts/datasets/{datasetId}/expectations yet.
```

**cURL:**

```bash
curl "https://{tenant}.{region}.qlikcloud.com/api/data-governance/data-contracts/datasets/{datasetId}/expectations" \
-H "Authorization: Bearer <access_token>"
```

**Example Response:**

```json
{
  "expectations": [
    {
      "name": "validity",
      "status": "ACTIVATED",
      "category": "string",
      "updatedAt": "2024-01-15T10:30:00Z",
      "activatable": true,
      "trustScore": {
        "warning": 90,
        "threshold": 85,
        "actualValue": 85.1,
        "lastEvaluation": {
          "error": "Service unreachable",
          "status": "PASS",
          "trigger": "TRUST_SCORE_EVENT",
          "errorCode": "DCI-001",
          "actualValue": 85,
          "evaluatedAt": "2018-03-20T09:12:28Z",
          "expectedWarning": 90,
          "expectedThreshold": 85
        },
        "dimensionStatus": "AVAILABLE"
      }
    }
  ]
}
```

---

### PATCH /api/data-governance/data-contracts/datasets/{datasetId}/expectations

Updates, activates, or deactivates the dataset's expectations in a single call. Trust Score and data volume expectations are supplied in their respective arrays, and each item is processed independently: some items may succeed while others fail, and the per-item outcome is reported in the response with HTTP 200. When the dataset has no data contract yet, activating at least one expectation creates the contract; a request that would create a contract without activating any expectation is rejected with HTTP 400. For Trust Score items, threshold and warning must be within 0-100 and warning, when set, must be strictly greater than threshold.

- **Rate Limit:** Tier 2 (100 requests per minute)

#### Path Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `datasetId` | string | Yes |  |

#### Request Body

**Required**

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `expectations` | object | Yes |  |

<details>
<summary>Properties of `expectations`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `trustScore` | object[] | No |  |
| `dataProfile` | object[] | No |  |

<details>
<summary>Properties of `trustScore`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | The name of the trust score dimension. One of: global, validity, completeness, accuracy, diversity, discoverability, usage, timeliness. Unknown names produce a per-item error in the response. |
| `status` | string | No | Activation status of an expectation. `ACTIVATED` means the expectation is enforced, `DEACTIVATED` means it was explicitly turned off, and `NOT_ACTIVATED` means it has never been activated. Enum: "ACTIVATED", "DEACTIVATED", "NOT_ACTIVATED" |
| `warning` | number | No | New warning range value (0-100 inclusive). Must be strictly greater than threshold. Set to null to remove. |
| `threshold` | number | No | New failure threshold value (0-100 inclusive). |

</details>

<details>
<summary>Properties of `dataProfile`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `max` | integer | No | New upper bound (inclusive). Absent = unchanged, null = remove the bound, value = set. |
| `min` | integer | No | New lower bound (inclusive). Absent = unchanged, null = remove the bound, value = set. |
| `name` | string | Yes | The name of the volume expectation. Currently only "volume" is supported. |
| `status` | string | No | Activation status of an expectation. `ACTIVATED` means the expectation is enforced, `DEACTIVATED` means it was explicitly turned off, and `NOT_ACTIVATED` means it has never been activated. Enum: "ACTIVATED", "DEACTIVATED", "NOT_ACTIVATED" |

</details>

</details>

#### Responses

##### 200

Per-item results are returned. Individual items may have succeeded or failed.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `expectations` | object | Yes |  |

<details>
<summary>Properties of `expectations`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `trustScore` | object[] | No |  |
| `dataProfile` | object[] | No |  |

<details>
<summary>Properties of `trustScore`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No | The error code for failure (only present when updateStatus is ERROR). |
| `name` | string | Yes | The name of the expectation. For trust score items, one of: global, validity, completeness, accuracy, diversity, discoverability, usage, timeliness. May also contain the raw input name for per-item error responses. |
| `reason` | string | No | The reason for failure (only present when updateStatus is ERROR). |
| `status` | string | No | Activation status of an expectation. `ACTIVATED` means the expectation is enforced, `DEACTIVATED` means it was explicitly turned off, and `NOT_ACTIVATED` means it has never been activated. Enum: "ACTIVATED", "DEACTIVATED", "NOT_ACTIVATED" |
| `warning` | number | No | The current warning range (only present when updateStatus is SUCCESS). |
| `category` | string | No | The expectation category (only present when updateStatus is SUCCESS). |
| `threshold` | number | No | The current threshold (only present when updateStatus is SUCCESS). |
| `updatedAt` | string | No | When the expectation was last updated (only present when updateStatus is SUCCESS). |
| `updateStatus` | string | Yes | Enum: "SUCCESS", "ERROR" |
| `lastEvaluation` | object | No | The last evaluation result (only present when updateStatus is SUCCESS). |
| `dimensionStatus` | string | No | The availability status of the trust score dimension. Enum: "AVAILABLE", "NOT_AVAILABLE" |

<details>
<summary>Properties of `lastEvaluation`</summary>

_Properties truncated due to depth limit._

</details>

</details>

<details>
<summary>Properties of `dataProfile`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `max` | integer | No | The current upper bound (only present when updateStatus is SUCCESS). |
| `min` | integer | No | The current lower bound (only present when updateStatus is SUCCESS). |
| `code` | string | No | Diagnostic error code for the failure (only present when updateStatus is ERROR). Provided to help troubleshooting; the example values shown are not an exhaustive list of possible codes. |
| `name` | string | Yes | The name of the volume expectation. Currently only "volume" is supported. |
| `reason` | string | No | The reason for failure (only present when updateStatus is ERROR). |
| `status` | string | No | Activation status of an expectation. `ACTIVATED` means the expectation is enforced, `DEACTIVATED` means it was explicitly turned off, and `NOT_ACTIVATED` means it has never been activated. Enum: "ACTIVATED", "DEACTIVATED", "NOT_ACTIVATED" |
| `category` | string | No | The expectation category (only present when updateStatus is SUCCESS). |
| `updatedAt` | string | No | When the expectation was last updated (only present when updateStatus is SUCCESS). |
| `updateStatus` | string | Yes | Enum: "SUCCESS", "ERROR" |
| `lastEvaluation` | object | No | The last volume evaluation result (only present when updateStatus is SUCCESS). |

<details>
<summary>Properties of `lastEvaluation`</summary>

_Properties truncated due to depth limit._

</details>

</details>

</details>

##### 400

Request-level validation failure.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 401

User does not have valid authentication credentials.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 403

User does not have access to the resource, or the feature is not available for this tenant.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 404

Dataset not found.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 500

Internal Server Error.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 502

The Catalog service could not be reached to verify the dataset.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

#### Examples

**JavaScript:**

```javascript
// qlik-api has not implemented support for `PATCH /api/data-governance/data-contracts/datasets/{datasetId}/expectations` yet.
// In the meantime, you can use fetch like this:

const response = await fetch(
  '/api/data-governance/data-contracts/datasets/{datasetId}/expectations',
  {
    method: 'PATCH',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      expectations: {
        trustScore: [
          {
            name: 'global',
            status: 'ACTIVATED',
            warning: 90,
            threshold: 85,
          },
        ],
        dataProfile: [
          {
            max: 10500,
            min: 9500,
            name: 'volume',
            status: 'ACTIVATED',
          },
        ],
      },
    }),
  },
)

```

**Qlik CLI:**

```bash
# qlik-cli has not implemented support for PATCH /api/data-governance/data-contracts/datasets/{datasetId}/expectations yet.
```

**cURL:**

```bash
curl "https://{tenant}.{region}.qlikcloud.com/api/data-governance/data-contracts/datasets/{datasetId}/expectations" \
-X PATCH \
-H "Content-type: application/json" \
-H "Authorization: Bearer <access_token>" \
-d '{"expectations":{"trustScore":[{"name":"global","status":"ACTIVATED","warning":90,"threshold":85}],"dataProfile":[{"max":10500,"min":9500,"name":"volume","status":"ACTIVATED"}]}}'
```

**Example Response:**

```json
{
  "expectations": {
    "trustScore": [
      {
        "code": "DCI-001",
        "name": "string",
        "reason": "Unknown trust score dimension: Foo",
        "status": "ACTIVATED",
        "warning": 90,
        "category": "trust_score",
        "threshold": 85,
        "updatedAt": "2026-05-13T10:00:00Z",
        "updateStatus": "SUCCESS",
        "lastEvaluation": {
          "error": "Service unreachable",
          "status": "PASS",
          "trigger": "TRUST_SCORE_EVENT",
          "errorCode": "DCI-001",
          "actualValue": 92,
          "evaluatedAt": "2026-05-13T10:00:00Z",
          "expectedWarning": 90,
          "expectedThreshold": 85
        },
        "dimensionStatus": "AVAILABLE"
      }
    ],
    "dataProfile": [
      {
        "max": 10500,
        "min": 9500,
        "code": "DCI-008",
        "name": "string",
        "reason": "Invalid volume bounds: min must be less than or equal to max.",
        "status": "ACTIVATED",
        "category": "data_profile",
        "updatedAt": "2026-07-15T10:00:00Z",
        "updateStatus": "SUCCESS",
        "lastEvaluation": {
          "error": "string",
          "status": "PASS",
          "trigger": "TRUST_SCORE_EVENT",
          "errorCode": "DCI-005",
          "evaluatedAt": "2026-07-15T10:00:00Z",
          "expectedMax": 10500,
          "expectedMin": 9500,
          "actualRowCount": 10000
        }
      }
    ]
  }
}
```

---

### POST /api/data-governance/data-contracts/datasets/actions/create

Creates a data contract for each listed dataset ID, notably to apply a contract to every dataset of a data product at once. The caller's "Compute data quality" write privilege is checked once for the whole request, before any dataset is processed: it does not depend on any single dataset, so a caller lacking it is rejected upfront with HTTP 403, rather than failing every dataset entry individually. Each dataset is then processed independently and concurrently: a failure on one dataset (no write permission on its space, dataset not found, or a contract already existing for that dataset) does not block the others. An existing contract is never overwritten. The request is capped at 100 datasets; a larger batch is rejected upfront with HTTP 400, before any contract is created.

- **Rate Limit:** Tier 2 (100 requests per minute)

#### Request Body

**Required**

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `datasets` | object[] | Yes |  |

<details>
<summary>Properties of `datasets`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `datasetId` | string | Yes | Identifier of the dataset the data contract must be created for. |
| `expectations` | object | Yes |  |

<details>
<summary>Properties of `expectations`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `trustScore` | object[] | No |  |
| `dataProfile` | object[] | No |  |

<details>
<summary>Properties of `trustScore`</summary>

_Properties truncated due to depth limit._

</details>

<details>
<summary>Properties of `dataProfile`</summary>

_Properties truncated due to depth limit._

</details>

</details>

</details>

#### Responses

##### 200

Per-dataset results are returned. Individual datasets may have succeeded or failed.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `datasets` | object[] | Yes |  |

<details>
<summary>Properties of `datasets`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No | Diagnostic error code for the failure (only present when updateStatus is ERROR). Provided to help troubleshooting; the example values shown are not an exhaustive list of possible codes. |
| `reason` | string | No | The reason for failure (only present when updateStatus is ERROR). |
| `datasetId` | string | Yes |  |
| `expectations` | object | No | Per-expectation results (only present when updateStatus is SUCCESS). |
| `updateStatus` | string | Yes | Enum: "SUCCESS", "ERROR" |

<details>
<summary>Properties of `expectations`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `trustScore` | object[] | No |  |
| `dataProfile` | object[] | No |  |

<details>
<summary>Properties of `trustScore`</summary>

_Properties truncated due to depth limit._

</details>

<details>
<summary>Properties of `dataProfile`</summary>

_Properties truncated due to depth limit._

</details>

</details>

</details>

##### 400

Request-level validation failure. No contract is created for any dataset.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 401

User does not have valid authentication credentials.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 403

The feature is not available for this tenant, or the caller lacks the "Compute data quality" privilege.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

##### 500

Internal Server Error.

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No |  |
| `traceId` | string | No | Identifier of the request trace. Quote it when reporting a problem so the request can be located in the logs. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No |  |
| `meta` | object | No | Optional additional context for the error. Null when none is provided. |
| `title` | string | No |  |
| `detail` | string | No |  |
| `status` | string | No |  |

</details>

#### Examples

**JavaScript:**

```javascript
// qlik-api has not implemented support for `POST /api/data-governance/data-contracts/datasets/actions/create` yet.
// In the meantime, you can use fetch like this:

const response = await fetch(
  '/api/data-governance/data-contracts/datasets/actions/create',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      datasets: [
        {
          datasetId: '66a3aa9800358457159ecd12',
          expectations: {
            trustScore: [
              {
                name: 'global',
                status: 'ACTIVATED',
                warning: 90,
                threshold: 85,
              },
            ],
            dataProfile: [
              {
                max: 10500,
                min: 9500,
                name: 'volume',
                status: 'ACTIVATED',
              },
            ],
          },
        },
      ],
    }),
  },
)

```

**Qlik CLI:**

```bash
# qlik-cli has not implemented support for POST /api/data-governance/data-contracts/datasets/actions/create yet.
```

**cURL:**

```bash
curl "https://{tenant}.{region}.qlikcloud.com/api/data-governance/data-contracts/datasets/actions/create" \
-X POST \
-H "Content-type: application/json" \
-H "Authorization: Bearer <access_token>" \
-d '{"datasets":[{"datasetId":"66a3aa9800358457159ecd12","expectations":{"trustScore":[{"name":"global","status":"ACTIVATED","warning":90,"threshold":85}],"dataProfile":[{"max":10500,"min":9500,"name":"volume","status":"ACTIVATED"}]}}]}'
```

**Example Response:**

```json
{
  "datasets": [
    {
      "code": "DCI-013",
      "reason": "Data contract already exists for dataset: 66a3aa9800358457159ecd12",
      "datasetId": "66a3aa9800358457159ecd12",
      "expectations": {
        "trustScore": [
          {
            "code": "DCI-001",
            "name": "string",
            "reason": "Unknown trust score dimension: Foo",
            "status": "ACTIVATED",
            "warning": 90,
            "category": "trust_score",
            "threshold": 85,
            "updatedAt": "2026-05-13T10:00:00Z",
            "updateStatus": "SUCCESS",
            "lastEvaluation": {
              "error": "Service unreachable",
              "status": "PASS",
              "trigger": "TRUST_SCORE_EVENT",
              "errorCode": "DCI-001",
              "actualValue": 92,
              "evaluatedAt": "2026-05-13T10:00:00Z",
              "expectedWarning": 90,
              "expectedThreshold": 85
            },
            "dimensionStatus": "AVAILABLE"
          }
        ],
        "dataProfile": [
          {
            "max": 10500,
            "min": 9500,
            "code": "DCI-008",
            "name": "string",
            "reason": "Invalid volume bounds: min must be less than or equal to max.",
            "status": "ACTIVATED",
            "category": "data_profile",
            "updatedAt": "2026-07-15T10:00:00Z",
            "updateStatus": "SUCCESS",
            "lastEvaluation": {
              "error": "string",
              "status": "PASS",
              "trigger": "TRUST_SCORE_EVENT",
              "errorCode": "DCI-005",
              "evaluatedAt": "2026-07-15T10:00:00Z",
              "expectedMax": 10500,
              "expectedMin": 9500,
              "actualRowCount": 10000
            }
          }
        ]
      },
      "updateStatus": "SUCCESS"
    }
  ]
}
```

---
