---
title: "Entity reference"
date: "2023-10-05T00:51:51+00:00"
summary: "Discover how to use entity references in Site Studio. Learn about JSON schema, form elements, and JSON:API output for seamless integration of referenced content in your Drupal layouts."
image:
type: "page"
url: "/drupal-starter-kits/add-ons/site-studio/entity-reference"
id: "f048ea10-21ae-4212-887a-d080ec062f8a"
---

Schema:

    {
      "type": "object",
      "properties": {
        "type": {"type": "string", "pattern": "^form-field$"},
        "id": {"type": "string", "pattern": "^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$"},
        "machine_name": {"type": "string"},
        "data": {
          "type": "object",
          "properties": {
            "uid": {"type": "string","pattern": "^form-entity-reference$"},
            "title": {"type": "string"},
            "value": {
              "type": "object",
              "properties": {
                "entity_type": {"type": "string"},
                "view_mode": {"type": "string"},
                "entity": {"type": "string"}
              }
            }
          }
        }
      },
      "required": ["id", "type", "data"]
    }
    

Example output:

Given "Entity reference" form element on a component set up like so

![d567170f-Screenshot%202023-12-06%20at%2001.51.36.png](https://acquia.widen.net/content/4d6d2417-0656-4762-9168-49b296db6287/web/d567170f-Screenshot%202023-12-06%20at%2001.51.36.png)

And used on Node layout canvas like so

![3d2eebf6-Screenshot%202023-12-06%20at%2001.52.58.png](https://acquia.widen.net/content/4d9f42c6-f309-4b07-ac95-0203bf94b277/web/3d2eebf6-Screenshot%202023-12-06%20at%2001.52.58.png)

JSON:API output for this form field will be this:

    {
      "type": "form-field",
      "id": "954f324a-d706-4f72-9cfa-e74d02aa692f",
      "machine_name": "entity-reference",
      "data": {
        "uid": "form-entity-reference",
        "title": "Entity reference",
        "value": {
          "entity_type": "node",
          "view_mode": "full",
          "entity": "6549c652-a789-410a-aeb5-534b8458a45b",
          "jsonapi_link": "https://sitestudiodocs.acquia.com/jsonapi/node/layout_page/6549c652-a789-410a-aeb5-534b8458a45b"    }
      }
    }

In this example "value" property contains "jsonapi\_link" property as the "Entity reference" form field stores a reference to a Node. The value of "jsonapi\_link" property is an absolute url pointing to a JSON:API Resource for referenced node "Example node".