Umbraco Heartcore
CMSCloudDXP
  • What is Umbraco Heartcore?
    • Compare with Umbraco CMS
  • Versions and updates
  • Getting Started
    • API Browser
    • Backoffice Users and API Keys
    • Building a project from scratch
    • Environments
    • GraphQL Playground
    • Preview
    • The Umbraco Cloud Portal
    • Tour of the Backoffice
    • Using the Forms API
    • Webhooks
    • Deployment workflow
      • Content and media transfer / restore
      • Structure deployments
  • API Documentation
    • API Documentation
      • Rate Limits
    • Content Delivery
      • Content
      • Media
      • Redirect API
    • Content Management
      • Umbraco Forms
      • Languages
      • Content
        • Content Types
      • Media
        • Media Types
      • Members
        • Member Groups
        • Member Types
      • Relations
        • Relation Types
    • GraphQL API
      • Filtering and Ordering
      • Property Editors
      • Schema Generation
      • Persisted Queries
  • Backoffice
    • Custom Grid Editors
  • Client Libraries
    • Client Libraries
    • .NET Core Console Application
    • Node.js Client library
    • .NET Client library
      • MVC Sample
      • Content Management Sample
  • Tutorials
    • Custom Grid Editors
    • Querying with GraphQL
    • Creating content with media
  • Release Notes
    • February 2024
    • April 2024
    • August 2024
    • September 2024
    • April 2025
Powered by GitBook
On this page
  • Table of Contents
  • Common Headers
  • Authentication
  • Errors
  • Get by id
  • Success Response
  • Get by relation type alias
  • Success Response
  • Get by parent id
  • Success Response
  • Get by child id
  • Success Response
  • Create relation
  • Request
  • Success Response
  • Delete relation
  • Success Response

Was this helpful?

Edit on GitHub
Export as PDF
  1. API Documentation
  2. Content Management

Relations

PreviousMember TypesNextRelation Types

Last updated 1 year ago

Was this helpful?

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

Table of Contents

Common Headers

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 occours 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

400

BadRequest

Body cannot be empty.

401

Unauthorized

Authorization has been denied for this request.

403

Forbidden

You are not authorized to access the given resource.

404

NotFound

Relation with id '{id}' could not be found.

422

ValidationFailed

Validation error occured when trying to save or update the relation.

500

InternalServerError

Internal server error.

JSON example:

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

Get by id

Get a specific relation by its integer ID.

URL: /relation/{id}

Method: GET

Permissions required : Access to Settings section of the Umbraco Backoffice

Success Response

Code: 200

Content Example:

{
    "_id": 4,
    "parentId": "af3e08fc-fb90-4c78-b11c-c1a0cf43bd31",
    "childId": "e0c5f0e5-c1f0-4422-9ac0-6dbb536e8eb5",
    "relationTypeAlias": "relateDocumentOnCopy",
    "comment": "Testing relations for relateDocumentOnCopy",
    "_links": {
        "self": {
            "href": "https://api.umbraco.io/relation/4"
        }
    }
}

Get by relation type alias

Get a list of relations by their Relation Type alias.

URL: /relation/{alias}

Method: GET

Permissions required : Access to Settings section of the Umbraco Backoffice

Success Response

Code: 200

Content Example:

{
    "_links": {
        "self": {
            "href": "https://api.umbraco.io/relation/parent/"
        },
        "relations": {
            "href": "https://api.umbraco.io/relation/4"
        }
    },
    "_embedded": {
        "relations": [
            {
                "_id": 4,
                "parentId": "af3e08fc-fb90-4c78-b11c-c1a0cf43bd31",
                "childId": "e0c5f0e5-c1f0-4422-9ac0-6dbb536e8eb5",
                "relationTypeAlias": "relateDocumentOnCopy",
                "comment": "Testing relations for relateDocumentOnCopy",
                "_links": {
                    "self": {
                        "href": "https://api.umbraco.io/relation/4"
                    }
                }
            }
        ]
    }
}

Get by parent id

Get a list of relations by their parents GUID ID.

URL: /relation/parent/{id}

Method: GET

Permissions required : Access to Settings section of the Umbraco Backoffice

Success Response

Code: 200

Content Example:

{
    "_links": {
        "self": {
            "href": "https://api.umbraco.io/relation/parent/af3e08fc-fb90-4c78-b11c-c1a0cf43bd31"
        },
        "relations": {
            "href": "https://api.umbraco.io/relation/4"
        }
    },
    "_embedded": {
        "relations": [
            {
                "_id": 4,
                "parentId": "af3e08fc-fb90-4c78-b11c-c1a0cf43bd31",
                "childId": "e0c5f0e5-c1f0-4422-9ac0-6dbb536e8eb5",
                "relationTypeAlias": "relateDocumentOnCopy",
                "comment": "Testing relations for relateDocumentOnCopy",
                "_links": {
                    "self": {
                        "href": "https://api.umbraco.io/relation/4"
                    }
                }
            }
        ]
    }
}

Get by child id

Get a list of relations by their childs GUID ID.

URL: /relation/child/{id}

Method: GET

Permissions required : Access to Settings section of the Umbraco Backoffice

Success Response

Code: 200

Content Example:

{
    "_links": {
        "self": {
            "href": "https://api.umbraco.io/relation/child/e0c5f0e5-c1f0-4422-9ac0-6dbb536e8eb5"
        },
        "relations": {
            "href": "https://api.umbraco.io/relation/4"
        }
    },
    "_embedded": {
        "relations": [
            {
                "_id": 4,
                "parentId": "af3e08fc-fb90-4c78-b11c-c1a0cf43bd31",
                "childId": "e0c5f0e5-c1f0-4422-9ac0-6dbb536e8eb5",
                "relationTypeAlias": "relateDocumentOnCopy",
                "comment": "Testing relations for relateDocumentOnCopy",
                "_links": {
                    "self": {
                        "href": "https://api.umbraco.io/relation/4"
                    }
                }
            }
        ]
    }
}

Create relation

Create a new relation.

URL: /relation/

Method: POST

Permissions required : Access to Settings section of the Umbraco Backoffice

Request

{
    "parentId": "af3e08fc-fb90-4c78-b11c-c1a0cf43bd31",
    "childId": "e0c5f0e5-c1f0-4422-9ac0-6dbb536e8eb5",
    "relationTypeAlias": "relateDocumentOnCopy",
    "comment": "Testing relations for relateDocumentOnCopy"
}

Success Response

Code: 201

Content Example:

{
    "_id": 4,
    "parentId": "af3e08fc-fb90-4c78-b11c-c1a0cf43bd31",
    "childId": "e0c5f0e5-c1f0-4422-9ac0-6dbb536e8eb5",
    "relationTypeAlias": "relateDocumentOnCopy",
    "comment": "Testing relations for relateDocumentOnCopy",
    "_links": {
        "self": {
            "href": "https://api.umbraco.io/relation/4"
        }
    }
}

Delete relation

Delete a relation by its integer ID.

URL: /relation/{id}

Method: DELETE

Permissions required : Access to Settings section of the Umbraco Backoffice

Success Response

Code: 200

Content Example:

DELETE https://api.umbraco.io/relation/4

{
    "_id": 4,
    "parentId": "af3e08fc-fb90-4c78-b11c-c1a0cf43bd31",
    "childId": "e0c5f0e5-c1f0-4422-9ac0-6dbb536e8eb5",
    "relationTypeAlias": "relateDocumentOnCopy",
    "comment": "Testing relations for relateDocumentOnCopy",
    "_links": {
        "self": {
            "href": "https://api.umbraco.io/relation/4"
        }
    }
}
Common Headers
Authentication
Errors
Get By Id
Get by relation type alias
Get by parent id
Get by child id
Create relation
Delete relation