# Relations

The `relations` key defines relationships between models. Hormo Studio managing relations in you back-end services by set options as relations configs easily as below:

![](/files/-Lz79H_glw47h_mpc9oL)

| Key        | Type            | Description                                                                                                       |
| ---------- | --------------- | ----------------------------------------------------------------------------------------------------------------- |
| foreignKey | String          | Optional foreign key used to find related model instances.                                                        |
| ref(model) | String          | Name of the related model. Required.                                                                              |
| type       | String          | <p>Relation type. Required</p><p><strong>hasMany</strong></p><p><strong>hasManyThrough and belongsTo</strong></p> |
| Filter     | Object/Function | You can filter a relationship field using the filters option. `{ "type": "user" }`                                |

{% content-ref url="/pages/-Lz7-hWbuZz4HAVvUyuY" %}
[Built-in User model](/models/built-in-user-model.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hormo.studio/models/relations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
