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

# CreateRelationDefinitionInput

> Sets up a new relation definition.



**Kind**: `input`

## Fields

**`description`**: `String`

Free-text note about the relation definition.

---

**`displayCategory`**: `RelationDisplayCategory!` (required)

Display hint for clients such as Studio. See `RelationDisplayCategory`.

---

**`id`**: `ID!` (required)

Global id the new relation definition gets: base64 of `RelationDefinition:<raw id>`. The raw id has letters and digits only, starts with a lowercase letter (e.g. `productAccessories`), can't match a card property id of either card definition, and can't change later.

---

**`name`**: `String!` (required)

Name of the relation definition.

---

**`sourceCardDefinitionId`**: `ID!` (required)

Global id of the source card definition (`CardDefinition.id`). It must be `ACTIVE`.

---

**`sourceCriteria`**: `JSON`

Criteria on the source side, shaped as `RelationDefinition.sourceCriteria`, with camelCase keys. Exactly one `dynamic` item across `sourceCriteria` and `targetCriteria`; both its card properties must be indexed `TEXT` or `LIST` card properties (not both `LIST`, no format-only conversions) or the reserved `id`. Null = no criteria on this side.

---

**`sourceRelationDisplayName`**: `String`

Label for the relation on the source side, up to 255 characters.

---

**`tags`**: `[String!]!` (required)

Labels for grouping and filtering relation definitions.

---

**`targetCardDefinitionId`**: `ID!` (required)

Global id of the target card definition (`CardDefinition.id`). It must be `ACTIVE`.

---

**`targetCriteria`**: `JSON`

Criteria on the target side, shaped as `RelationDefinition.targetCriteria`, with camelCase keys. Null = no criteria on this side.

---

**`targetRelationDisplayName`**: `String`

Label for the relation on the target side, up to 255 characters.

---

**`targetRelationOrderByProperty`**: `String`

Older way to set the order: a target card property id, used as `BASED_ON_TARGET_PROPERTY` sorting. Ignored when `targetRelationSortingConfiguration` is set.

---

**`targetRelationSortingConfiguration`**: `RelationDefinitionSortingConfigurationInput`

How the target cards related to a source card are ordered. Null = no order, unless `targetRelationOrderByProperty` is set.



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