> ## Documentation Index
> Fetch the complete documentation index at: https://ekso.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# DataConstraint

> Sample shape for DataConstraint.

Sample shape for `DataConstraint`.

## Sample JSON

Copy, edit, paste. Server-set fields (`id`, `created`, `tenantId`, …) are omitted from the example — they're populated by the server on response.

```json theme={null}
{
  "name": "Example name",
  "container": [
    "example"
  ],
  "sourceFieldId": "<source-field_id>",
  "sourceFieldDataId": "<source-field-data_id>",
  "targetFieldId": "<target-field_id>",
  "targetFieldDataId": [
    "<target-field-data_id>"
  ],
  "targetMode": "<constraint-target-type>"
}
```

## Fields

| Field               | Type                                                                   | Required     | Notes                                   |
| ------------------- | ---------------------------------------------------------------------- | ------------ | --------------------------------------- |
| `entity`            | string • nullable                                                      | Server-set   | Set by the server. Read-only on writes. |
| `name`              | string                                                                 | **Required** |                                         |
| `container`         | array\<string>                                                         | Optional     |                                         |
| `sourceFieldId`     | string                                                                 | **Required** |                                         |
| `sourceFieldDataId` | string                                                                 | **Required** |                                         |
| `targetFieldId`     | string                                                                 | **Required** |                                         |
| `targetFieldDataId` | array\<string>                                                         | **Required** |                                         |
| `targetMode`        | [`ConstraintTargetType`](/data-model/constants#constraint-target-type) | Optional     |                                         |
| `tenantId`          | string                                                                 | Server-set   | Set by the server. Read-only on writes. |
| `id`                | string                                                                 | Server-set   | Set by the server. Read-only on writes. |
| `created`           | string (date-time)                                                     | Server-set   | Set by the server. Read-only on writes. |
| `createdBy`         | string                                                                 | Server-set   | Set by the server. Read-only on writes. |
| `updated`           | string (date-time)                                                     | Server-set   | Set by the server. Read-only on writes. |
| `updatedBy`         | string                                                                 | Server-set   | Set by the server. Read-only on writes. |
| `deleted`           | boolean                                                                | Server-set   | Set by the server. Read-only on writes. |

## Used by

### Request body

* `POST /api/constraint`
* `PUT /api/constraint/{id}`

### Response body

* `GET /api/constraint/container/{containerId}`
* `GET /api/constraint/{id}`
* `GET /api/constraint`

### CLI

`ekso constraint` — see the [command branches](/cli/branches) page for available verbs. Body for create / update verbs typically passed via `--data @file.json` matching the [sample JSON](#sample-json) above.
