> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate & Results

> Validate data contracts and manage execution results

# Validate & Results

Run on-demand validation of data contracts and manage execution results. Validation checks schema compliance, semantics rules, and quality expectations. SLA requirements are checked for tables. Security and terms of use aren't checked.

## Validate a Contract

Trigger on-demand validation of a data contract. Returns a `DataContractResult` with status for each validation dimension. Requires the **Edit All** permission on the contract.

Schema and semantics are checked immediately. When the contract has quality expectations, the call starts the contract's test suite pipeline and returns a `Running` result. The quality results and the final status are added to that result when the tests finish. A new validation aborts a result that's still `Running`.

`POST /v1/dataContracts/{id}/validate`

**id** `string` *required*

UUID of the data contract.

## Validate by Entity

Validate the effective contract for a specific entity, including rules inherited from its data product. If the entity only has an inherited contract from a data product, a local contract is materialized to store results. Requires the **Edit All** permission on the entity. Returns `404` if the entity has no effective contract.

`POST /v1/dataContracts/entity/validate`

**entityId** `string` *required*

UUID of the entity.

**entityType** `string` *required*

Type of the entity, for example `table`, `topic`.

```python POST /v1/dataContracts/{id}/validate theme={null}
from metadata.sdk import client, configure
from metadata.sdk.entities import DataContracts

configure(
    host="https://your-company.open-metadata.org/api",
    jwt_token="your-jwt-token"
)
rest = client().ometa.client

# Validate a specific contract
result = rest.post("/dataContracts/f7a1b2c3-d4e5-6789-0abc-def123456789/validate")
print(f"Status: {result['contractExecutionStatus']}")

# Validate by entity
result = DataContracts.validate_by_entity(
    "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "table"
)
print(f"Status: {result.contractExecutionStatus}")
```

```java POST /v1/dataContracts/{id}/validate theme={null}
import static org.openmetadata.sdk.fluent.DataContracts.*;
import org.openmetadata.schema.entity.datacontract.DataContractResult;

// Validate a contract
DataContractResult result = forContract(contractId).validate();
System.out.println("Status: " + result.getContractExecutionStatus());

// Or from a loaded contract
FluentDataContract contract = find(contractId).fetch();
DataContractResult sameResult = contract.validate();
```

```bash POST /v1/dataContracts/{id}/validate theme={null}
# Validate a contract
curl -X POST "{base_url}/api/v1/dataContracts/f7a1b2c3-d4e5-6789-0abc-def123456789/validate" \
  -H "Authorization: Bearer {access_token}"

# Validate by entity
curl -X POST "{base_url}/api/v1/dataContracts/entity/validate?entityId=a1b2c3d4-e5f6-7890-abcd-ef1234567890&entityType=table" \
  -H "Authorization: Bearer {access_token}"
```

```json Response (Validation Result) theme={null}
{
  "id": "e1f2a3b4-c5d6-7890-ef12-345678901234",
  "dataContractFQN": "sample_data.ecommerce_db.shopify.sales_orders.dataContract_sales-orders-contract",
  "timestamp": 1769986400000,
  "contractExecutionStatus": "Success",
  "schemaValidation": {
    "passed": 4,
    "failed": 0,
    "total": 4,
    "failedFields": []
  },
  "semanticsValidation": {
    "passed": 3,
    "failed": 0,
    "total": 3,
    "failedRules": []
  },
  "qualityValidation": {
    "passed": 2,
    "failed": 0,
    "total": 2,
    "qualityScore": 100.0
  }
}
```

***

## Execution Status Values

| Status | Description |
| - | - |
| `Running` | Validation is in progress. A contract with quality expectations stays `Running` until its tests finish. |
| `Success` | No schema column, semantics rule, or test case failed |
| `Failed` | At least one schema column, semantics rule, or test case failed, or an SLA requirement was missed |
| `Aborted` | The test suite couldn't be started, or a newer validation replaced this one |
| `PartialSuccess`, `Queued` | Reserved. OpenMetadata doesn't set them, but results added with `PUT /results` can use them. |

The **Data Contract Validation** application also validates every contract on a schedule, daily at midnight by default. Each night it validates a contract together with the contract it inherits, and it checks the SLA.

***

## List Results

Retrieve execution results for a contract.

`GET /v1/dataContracts/{id}/results`

**id** `string` *required*

UUID of the data contract.

**limit** `integer` (default: 10)

Maximum number of results to return (0–10,000).

**startTs** `integer`

Return results after this epoch timestamp (milliseconds).

**endTs** `integer`

Return results before this epoch timestamp (milliseconds).

## Get Latest Result

`GET /v1/dataContracts/{id}/results/latest`

Returns the most recent validation result.

## Add a Result

`PUT /v1/dataContracts/{id}/results`

Programmatically add a validation result (useful for external validation pipelines).

### Body Parameters

**dataContractFQN** `string` *required*

Fully qualified name of the data contract the result belongs to.

**timestamp** `integer` *required*

Epoch timestamp (milliseconds) of the validation run.

**contractExecutionStatus** `string` *required*

Status: `Running`, `Success`, `Failed`, `PartialSuccess`, `Aborted`, `Queued`.

**result** `string`

Human-readable summary message.

**schemaValidation** `object`

Schema validation details.

**properties**

**passed** `integer`

Number of fields that passed.

**failed** `integer`

Number of fields that failed.

**total** `integer`

Total fields checked.

**failedFields** `array`

List of field names that failed validation.

**semanticsValidation** `object`

Semantics validation details.

**properties**

**passed** `integer`

Number of rules that passed.

**failed** `integer`

Number of rules that failed.

**total** `integer`

Total rules checked.

**skipped** `integer`

Number of rules not evaluated because they are disabled or don't apply to the entity's type.

**failedRules** `array`

List of rule names that failed.

**qualityValidation** `object`

Quality validation details.

**properties**

**passed** `integer`

Number of quality tests that passed.

**failed** `integer`

Number of quality tests that failed.

**total** `integer`

Total quality tests.

**qualityScore** `number`

Quality score (0-100).

**slaValidation** `object`

SLA validation details. A contract run fills this in for tables. External pipelines can also set it.

**properties**

**refreshFrequencyMet** `boolean`

Whether refresh frequency target was met.

**latencyMet** `boolean`

Whether latency target was met.

**availabilityMet** `boolean`

Whether availability target was met.

**actualLatency** `integer`

Actual observed latency in milliseconds.

**lastRefreshedAt** `integer`

When the data was last refreshed, as a timestamp in milliseconds. Absent when no source records it.

**refreshedAtSource** `string`

Where the last refresh time comes from: `slaColumnProfile` (newest value in the latest profile of the SLA column), `systemProfile` (the table's latest write), or `lifeCycle` (the table's last update).

**message** `string`

Which SLA requirements were missed, and which couldn't be evaluated and why.

**executionTime** `integer`

Total validation execution time in milliseconds.

```python Add Result theme={null}
from metadata.sdk import client, configure

configure(
    host="https://your-company.open-metadata.org/api",
    jwt_token="your-jwt-token"
)
rest = client().ometa.client

# Add a validation result
rest.put("/dataContracts/f7a1b2c3-d4e5-6789-0abc-def123456789/results", json={
    "dataContractFQN": "sample_data.ecommerce_db.shopify.sales_orders.dataContract_sales-orders-contract",
    "timestamp": 1769986400000,
    "contractExecutionStatus": "Success",
    "schemaValidation": {"passed": 4, "failed": 0, "total": 4},
    "semanticsValidation": {"passed": 3, "failed": 0, "total": 3},
    "executionTime": 850
})
```

```java Add Result theme={null}
import static org.openmetadata.sdk.fluent.DataContracts.*;

// Add a result using fluent API
forContract(contractId)
    .addResult()
    .success()
    .withMessage("All validations passed")
    .withExecutionTime(850L)
    .execute();
```

```bash Add Result theme={null}
curl -X PUT "{base_url}/api/v1/dataContracts/f7a1b2c3-d4e5-6789-0abc-def123456789/results" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "dataContractFQN": "sample_data.ecommerce_db.shopify.sales_orders.dataContract_sales-orders-contract",
    "timestamp": 1769986400000,
    "contractExecutionStatus": "Success",
    "schemaValidation": {"passed": 4, "failed": 0, "total": 4, "failedFields": []},
    "semanticsValidation": {"passed": 3, "failed": 0, "total": 3, "failedRules": []},
    "executionTime": 850
  }'
```

## Delete Results

`DELETE /v1/dataContracts/{id}/results/{timestamp}` — Delete a result at a specific timestamp.

`DELETE /v1/dataContracts/{id}/results/before/{timestamp}` — Delete all results before a timestamp.

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission |
| `404` | `NOT_FOUND` | Data contract not found |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.