> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-heartcore/api-documentation/content-management/relation/type.md).

# Relation Types

**BASE URL**: `https://api.umbraco.io`

## Table of Contents

* [Common Headers](#common-headers)
* [Authentication](#authentication)
* [Errors](#errors)
* [Get all relation types](#get-all-relation-types)
* [Get by alias](#get-by-alias)

## Common Headers

```http
Api-Version: 2
Umb-Project-Alias: {project-alias}
```

## Authentication

Auth is required for this API meaning that you must supply a Bearer Token via an Authorization header or an API Key via an Authorization or Api-Key header.

## Errors

If an error occurs you will receive a HTTP status code along with an API error code and an error message in the response body.

| Status Code | Error Code          | Message                                                |
| ----------- | ------------------- | ------------------------------------------------------ |
| 401         | Unauthorized        | Authorization has been denied for this request.        |
| 403         | Forbidden           | You are not authorized to access the given resource.   |
| 404         | NotFound            | Relation Type with alias '{alias}' could not be found. |
| 500         | InternalServerError | Internal server error.                                 |

**JSON example**:

```json
{
  "error": {
    "code": "Unauthorized",
    "message": "Authorization has been denied for this request."
  }
}
```

## Get all relation types

Get a list of all available relation types.

**URL**: `/relation/type`

**Method**: `GET`

**Permissions required** : Access to Settings section of the Umbraco Backoffice

### Success Response

**Code**: 200

**Content Example**:

```json
{
    "_links": {
        "self": {
            "href": "https://api.umbraco.io/relation/type"
        },
        "relationtypes": [
            {
                "href": "https://api.umbraco.io/relation/type/relateDocumentOnCopy"
            },
            {
                "href": "https://api.umbraco.io/relation/type/relateParentDocumentOnDelete"
            },
            {
                "href": "https://api.umbraco.io/relation/type/relateParentMediaFolderOnDelete"
            }
        ]
    },
    "_embedded": {
        "relationtypes": [
            {
                "name": "Relate Document On Copy",
                "alias": "relateDocumentOnCopy",
                "isBidirectional": true,
                "parentObjectType": "DOCUMENT",
                "childObjectType": "DOCUMENT",
                "_createDate": "0001-01-01T00:00:00Z",
                "_id": "4cbeb612-e689-3563-b755-bf3ede295433",
                "_updateDate": "0001-01-01T00:00:00Z",
                "_links": {
                    "self": {
                        "href": "https://api.umbraco.io/relation/type/relateDocumentOnCopy"
                    },
                    "root": {
                        "href": "https://api.umbraco.io/relation/type"
                    }
                }
            },
            {
                "name": "Relate Parent Document On Delete",
                "alias": "relateParentDocumentOnDelete",
                "isBidirectional": false,
                "parentObjectType": "DOCUMENT",
                "childObjectType": "DOCUMENT",
                "_createDate": "0001-01-01T00:00:00Z",
                "_id": "0cc3507c-66ab-3091-8913-3d998148e423",
                "_updateDate": "0001-01-01T00:00:00Z",
                "_links": {
                    "self": {
                        "href": "https://api.umbraco.io/relation/type/relateParentDocumentOnDelete"
                    },
                    "root": {
                        "href": "https://api.umbraco.io/relation/type"
                    }
                }
            },
            {
                "name": "Relate Parent Media Folder On Delete",
                "alias": "relateParentMediaFolderOnDelete",
                "isBidirectional": false,
                "parentObjectType": "MEDIA",
                "childObjectType": "MEDIA",
                "_createDate": "0001-01-01T00:00:00Z",
                "_id": "8307994f-faf2-3844-bab9-72d34514edf2",
                "_updateDate": "0001-01-01T00:00:00Z",
                "_links": {
                    "self": {
                        "href": "https://api.umbraco.io/relation/type/relateParentMediaFolderOnDelete"
                    },
                    "root": {
                        "href": "https://api.umbraco.io/relation/type"
                    }
                }
            }
        ]
    }
}
```

## Get by alias

Get a specific Relation Type by its alias.

**URL**: `/relation/type/{alias}`

**Method**: `GET`

**Permissions required** : Access to Settings section of the Umbraco Backoffice

### Success Response

**Code**: 200

**Content Example**:

```json
{
    "name": "Relate Document On Copy",
    "alias": "relateDocumentOnCopy",
    "isBidirectional": true,
    "parentObjectType": "DOCUMENT",
    "childObjectType": "DOCUMENT",
    "_createDate": "0001-01-01T00:00:00Z",
    "_id": "4cbeb612-e689-3563-b755-bf3ede295433",
    "_updateDate": "0001-01-01T00:00:00Z",
    "_links": {
        "self": {
            "href": "https://api.umbraco.io/relation/type/relateDocumentOnCopy"
        },
        "root": {
            "href": "https://api.umbraco.io/relation/type"
        }
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/umbraco-heartcore/api-documentation/content-management/relation/type.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
