> ## 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.

# Retrieve a Data Contract

> Get a data contract by ID, fully qualified name, or entity reference

# Retrieve a Data Contract

Get a data contract by its UUID, fully qualified name, or the entity it's attached to.

## Get by ID

**id** `string` *required*

UUID of the data contract.

**fields** `string`

Comma-separated list of fields to include: `owners`, `reviewers`, `extension`.

**include** `string` (default: non-deleted)

Include filter: `all`, `deleted`, or `non-deleted`.

## Get by Fully Qualified Name

Use `GET /v1/dataContracts/name/{fqn}` with the same query parameters.

## Get Effective Contract for Entity

Use `GET /v1/dataContracts/entity` to get the effective contract for an entity, including inherited properties from its data product.

**entityId** `string` *required*

UUID of the entity.

**entityType** `string` *required*

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

**fields** `string`

Comma-separated list of fields to include.

```python GET /v1/dataContracts/{id} theme={null}
from metadata.sdk import configure
from metadata.sdk.entities import DataContracts

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

# Get by ID
contract = DataContracts.retrieve("f7a1b2c3-d4e5-6789-0abc-def123456789")
print(f"{contract.name.root}: {contract.entityStatus}")

# Get by FQN
contract = DataContracts.retrieve_by_name("sample_data.ecommerce_db.shopify.sales_orders.dataContract_sales-orders-contract")

# Get effective contract for an entity (includes inherited properties)
contract = DataContracts.get_by_entity(
    "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "table"
)
```

```java GET /v1/dataContracts/{id} theme={null}
import static org.openmetadata.sdk.fluent.DataContracts.*;

// Get by ID with owners
FluentDataContract contract = find(contractId)
    .includeOwners()
    .fetch();
System.out.println(contract.getFqn());

// Get by FQN
FluentDataContract contract = findByName("sample_data.ecommerce_db.shopify.sales_orders.dataContract_sales-orders-contract")
    .includeAll()
    .fetch();

// Get effective contract for an entity
FluentDataContract contract = findByEntity(tableId, "table")
    .fetch();
```

```bash GET /v1/dataContracts/{id} theme={null}
# Get by ID
curl "{base_url}/api/v1/dataContracts/f7a1b2c3-d4e5-6789-0abc-def123456789?fields=owners,reviewers" \
  -H "Authorization: Bearer {access_token}"

# Get by FQN
curl "{base_url}/api/v1/dataContracts/name/sample_data.ecommerce_db.shopify.sales_orders.dataContract_sales-orders-contract" \
  -H "Authorization: Bearer {access_token}"

# Get effective contract for an entity (includes inherited)
curl "{base_url}/api/v1/dataContracts/entity?entityId=a1b2c3d4-e5f6-7890-abcd-ef1234567890&entityType=table" \
  -H "Authorization: Bearer {access_token}"
```

```json Response theme={null}
{
  "id": "f7a1b2c3-d4e5-6789-0abc-def123456789",
  "name": "sales-orders-contract",
  "fullyQualifiedName": "sample_data.ecommerce_db.shopify.sales_orders.dataContract_sales-orders-contract",
  "description": "Data contract for the sales orders table",
  "entityStatus": "Approved",
  "entity": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "type": "table",
    "name": "sales_orders",
    "fullyQualifiedName": "sample_data.ecommerce_db.shopify.sales_orders"
  },
  "schema": [
    {"name": "order_id", "dataType": "INT", "constraint": "PRIMARY_KEY"},
    {"name": "customer_id", "dataType": "INT", "constraint": "NOT_NULL"}
  ],
  "semantics": [
    {
      "name": "Owners is set",
      "description": "The table must have an owner.",
      "rule": "{\"and\":[{\"some\":[{\"var\":\"owners\"},{\"!=\":[{\"var\":\"fullyQualifiedName\"},null]}]}]}",
      "enabled": true
    }
  ],
  "sla": {
    "refreshFrequency": {"interval": 1, "unit": "day"}
  },
  "owners": [],
  "reviewers": [],
  "inherited": false,
  "version": 0.2,
  "updatedAt": 1769982800000,
  "updatedBy": "admin"
}
```

***

## Response Fields

**id** `string`

UUID of the data contract.

**name** `string`

Name of the data contract.

**fullyQualifiedName** `string`

Fully qualified name.

**entityStatus** `string`

Contract status: `Draft`, `In Review`, `Approved`, `Rejected`, `Deprecated`, or `Archived`.

**entity** `object`

Reference to the data asset this contract applies to.

**schema** `array`

Expected column definitions.

**semantics** `array`

Semantics rules.

**qualityExpectations** `array`

References to test cases.

**sla** `object`

SLA expectations (refresh frequency, maximum latency, availability time, time zone, and retention).

**termsOfUse** `string`

Terms of use in Markdown.

**security** `object`

Security and access policy expectations.

**inherited** `boolean`

Whether this contract is inherited from a data product.

**latestResult** `object`

Latest validation result summary.

**owners** `array`

Owner references.

**reviewers** `array`

Reviewer references.

**version** `number`

Entity version.

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission to view data contracts |
| `404` | `NOT_FOUND` | Data contract with given ID/FQN/entity not found |


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