Umbraco CMS
CloudHeartcoreDXPMarketplace
14.latest
14.latest
  • Umbraco CMS Documentation
  • Legacy Documentation
    • Our Umbraco
    • GitHub
  • Release Notes
  • Contribute
  • Sustainability Best Practices
  • Fundamentals
    • Get to know Umbraco
    • Setup
      • Requirements
      • Installation
        • Install using .NET CLI
        • Running Umbraco in Docker using Docker Compose
        • Install using Visual Studio
        • Local IIS With Umbraco
        • Install using Visual Studio Code
        • Installing Nightly Builds
        • Running Umbraco on Linux/macOS
        • Unattended Installs
      • Upgrade your project
        • Version Specific Upgrades
          • Upgrade from Umbraco 8 to the latest version
          • Migrate content to Umbraco 8
          • Minor upgrades for Umbraco 8
          • Upgrade to Umbraco 7
          • Minor upgrades for Umbraco 7
      • Server setup
        • Running Umbraco On Azure Web Apps
        • Hosting Umbraco in IIS
        • File And Folder Permissions
        • Runtime Modes
        • Umbraco in Load Balanced Environments
          • Load Balancing Azure Web Apps
          • Standalone File System
          • Advanced Techniques With Flexible Load Balancing
          • Logging With Load Balancing
    • Backoffice
      • Sections
      • Property Editors
        • Built-in Property Editors
          • Checkbox List
          • Collection
          • Color Picker
          • Content Picker
          • Document Picker
          • DateTime
          • Date
          • Decimal
          • Email Address
          • Eye Dropper Color Picker
          • File Upload
          • Image Cropper
          • Label
          • Markdown Editor
          • Media Picker
          • Member Group Picker
          • Member Picker
          • Multi Url Picker
          • Repeatable Textstrings
          • Numeric
          • Radiobutton List
          • Slider
          • Tags
          • Textarea
          • Textbox
          • Toggle
          • User Picker
          • Block Editors
            • Block Grid
            • Block List
          • Dropdown
          • Rich Text Editor
            • Rich Text Editor Configuration
            • Rich Text Editor Styles
            • Rich Text Editor Plugins
            • Blocks in Rich Text Editor
      • Login
      • Document Blueprints
      • Sidebar
      • Log Viewer
      • Language Variants
      • Settings Dashboards
    • Data
      • Defining Content
        • Default Document Types
        • Document Type Localization
      • Creating Media
        • Default Data/Media Types
      • Members
      • Data Types
        • Default Data Types
      • Scheduled Publishing
      • Using Tabs
      • Users
      • Relations
      • Dictionary Items
      • Content Version Cleanup
    • Design
      • Templates
        • Basic Razor Syntax
        • Razor Cheatsheet
      • Rendering Content
      • Rendering Media
      • Partial Views
      • Stylesheets And JavaScript
    • Code
      • Service APIs
      • Subscribing To Notifications
      • Creating Forms
      • Debugging
        • Logging
      • Source Control
  • Implementation
    • Learn how Umbraco works
    • Routing
      • Controller & Action Selection
      • Execute Request
      • Request Pipeline
    • Custom Routing
      • Adding a hub with SignalR and Umbraco
    • Controllers
    • Data Persistence (CRUD)
    • Composing
    • Integration Testing
    • Nullable Reference Types
    • Services and Helpers
      • Circular Dependencies
    • Unit Testing
  • Customizing
    • Extend and customize the editing experience
    • Project Bellissima
    • Setup Your Development Environment
      • Vite Package Setup
    • Foundation
      • Working with Data
        • Repositories
        • Context API
        • Store
        • States
      • Contexts
        • Property Dataset Context
      • Umbraco Element
        • Controllers
          • Write your own controller
      • Sorting
      • Routes
      • Icons
      • Backoffice Localization
      • Terminology
    • Extension Overview
      • Extension Registry
        • Extension Registration
        • Extension Manifest
      • Extension Types
        • Menu
        • Header Apps
        • Icons
        • Modals
          • Confirm Dialog
          • Custom Modals
          • Route Registration
        • Bundle
        • Kind
        • Backoffice Entry Point
        • Extension Conditions
        • Dashboards
        • Entity Actions
        • Entity Bulk Actions
        • Entity Create Option Action
        • Trees
        • Global Context
        • Section Sidebar
        • Section View
        • Sections
        • Workspace Context
        • Workspace Views
        • Workspace Actions
        • Localization
      • Extension Kind
      • Extension Conditions
      • Custom Extension types
    • Sections & Trees
    • Searchable Trees (ISearchableTree)
    • Property Editors
      • Property Editors Composition
        • Property Editor Schema
        • Property Editor UI
      • Property Value Converters
      • Property Actions
      • Integrate Property Editors
      • Tracking References
      • Content Picker Value Converter Example
      • Property Dataset
      • Integrate Validaction
    • Workspaces
    • Umbraco Package
    • UI Library
  • Extending
    • Build on Umbraco functionality
    • Health Check
      • Health Check Guides
        • Click-Jacking Protection
        • Content Content Security Policy (CSP)
        • Content/MIME Sniffing Protection
        • Cross-site scripting Protection (X-XSS-Protection header)
        • Debug Compilation Mode
        • Excessive Headers
        • Fixed Application Url
        • Folder & File Permissions
        • HTTPS Configuration
        • Notification Email Settings
        • SMTP
        • Strict-Transport-Security Header
    • Language Files & Localization
      • .NET Localization
    • Backoffice Search
    • Creating a Custom Database Table
    • Embedded Media Providers
    • Custom File Systems (IFileSystem)
      • Using Azure Blob Storage for Media and ImageSharp Cache
    • Configuring Azure Key Vault
    • Packages
      • Creating a Package
      • Language file for packages
      • Listing a Package on the Umbraco Marketplace
      • Good practice and defaults
      • Packages on Umbraco Cloud
      • Installing and Uninstalling Packages
      • Maintaining packages
      • Create accessible Umbraco packages
      • Example Package Repository
  • Reference
    • Dive into the code
    • Configuration
      • Basic Authentication Settings
      • Connection strings settings
      • Content Dashboard Settings
      • Content Settings
      • Data Types Settings
      • Debug settings
      • Examine settings
      • Exception filter settings
      • FileSystemProviders Configuration
      • Global Settings
      • Health checks
      • Hosting settings
      • Imaging settings
      • Indexing settings
      • Install Default Data Settings
      • Logging settings
      • Maximum Upload Size Settings
      • Models builder settings
      • NuCache Settings
      • Package Migration
      • Plugins settings
      • Request handler settings
      • Runtime settings
      • Security Settings
      • Serilog settings
      • Type finder settings
      • Unattended
      • Web routing
    • Templating
      • Models Builder
        • Introduction
        • Configuration
        • Builder Modes
        • Understand and Extend
        • Using Interfaces
        • Tips and Tricks
      • Working with MVC
        • Working with MVC Views in Umbraco
        • View/Razor Examples
        • Using MVC Partial Views in Umbraco
        • Using View Components in Umbraco
        • Querying & Traversal
        • Creating Forms
      • Macros
    • Querying & Models
      • IMemberManager
      • IPublishedContentQuery
      • ITagQuery
      • UDI Identifiers
      • UmbracoContext helper
      • UmbracoHelper
      • IPublishedContent
        • IPublishedContent Collections
        • IPublishedContent IsHelpers
        • IPublishedContent Property Access & Extension Methods
    • Routing & Controllers
      • Custom MVC controllers (Umbraco Route Hijacking)
      • Custom MVC Routes
      • Custom Middleware
      • URL Rewrites in Umbraco
      • Special Property Type aliases for routing
      • URL Redirect Management
      • Routing in Umbraco
        • FindPublishedContentAndTemplate()
        • IContentFinder
        • Inbound request pipeline
        • Outbound request pipeline
        • Published Content Request Preparation
      • Surface controllers
        • Surface controller actions
      • Umbraco API Controllers
        • Porting old Umbraco API Controllers
    • Content Delivery API
      • Custom property editors support
      • Extension API for querying
      • Media Delivery API
      • Protected content in the Delivery API
      • Output caching
      • Property expansion and limiting
      • Additional preview environments support
    • Webhooks
      • Expanding Webhook Events
    • API versioning and OpenAPI
    • Searching
      • Examine
        • Examine Management
        • Examine Manager
        • Custom indexing
        • PDF indexes and multisearchers
        • Quick-start
    • Using Notifications
      • Notification Handler
      • CacheRefresher Notifications Example
      • ContentService Notifications Example
      • Creating And Publishing Notifications
      • Determining if an entity is new
      • MediaService Notifications Example
      • MemberService Notifications Example
      • Sending Allowed Children Notification
      • Umbraco Application Lifetime Notifications
      • EditorModel Notifications
        • Customizing the "Links" box
      • Hot vs. cold restarts
    • Inversion of Control / Dependency injection
    • Management
      • Using Umbraco services
        • Consent Service
        • Media Service
        • Relation Service
        • Content Service
        • Content Type Service
        • Localization Service
        • User Service
    • Plugins
      • Creating Resolvers
      • Finding types
    • Cache & Distributed Cache
      • Accessing the cache
      • ICacheRefresher
      • IServerMessenger
      • Getting/Adding/Updating/Inserting Into Cache
      • Examples
        • Working with caching
    • Response Caching
    • Security
      • API rate limiting
      • BackOfficeUserManager and Events
      • Cookies
      • Replacing the basic username/password check
      • External login providers
      • Locking of Users and password reset
      • Reset admin password
      • Umbraco Security Hardening
      • Umbraco Security Settings
      • Sensitive data
      • Sanitizing the Rich Text Editor
      • Setup Umbraco for a FIPS Compliant Server
      • HTTPS
      • Two-factor Authentication
      • Server-side file validation
    • Scheduling
    • Common Pitfalls & Anti-Patterns
    • API Documentation
    • Debugging with SourceLink
    • Language Variation
    • UmbracoMapper
    • Distributed Locks
    • Management API
      • Setup OAuth using Postman
    • Custom Swagger API
    • Umbraco Flavored Markdown
  • Tutorials
    • Overview
    • Creating a Basic Website
      • Getting Started
      • Document Types
      • Creating Your First Template
      • CSS and Images
      • Displaying the Document Type Properties
      • Creating a Master Template
      • Creating Pages and Using the Master Template
      • Setting the Navigation Menu
      • Articles and Article Items
      • Adding Language Variants
      • Conclusions
    • Creating your First Extension
    • Creating a Custom Dashboard
      • Adding localization to the dashboard
      • Adding functionality to the Dashboard
      • Using Umbraco UI library in the Dashboard
    • Creating a Property Editor
      • Adding configuration to a Property Editor
      • Integrating context with a Property Editor
      • Custom value conversion for rendering
      • Adding server-side validation
        • Default Property Editor Schema aliases
    • Creating a Multilingual Site
    • Add Google Authentication (Users)
    • Add Microsoft Entra ID authentication (Members)
    • Creating Custom Database Tables with Entity Framework
    • The Starter Kit
      • Lessons
        • Customize the Starter Kit
        • Add a Blog Post Publication Date
          • Add a Blog Post Publication Date
          • Add a Blog Post Publication Date
        • Add Open Graph
          • Add Open Graph - Step 1
          • Add Open Graph - Step 2
          • Add Open Graph - Step 3
          • Add Open Graph - Step 4
          • Add Open Graph - Summary
        • Ask For Help and Join the Community
    • Editor's Manual
      • Getting Started
        • Logging In and Out
        • Umbraco Interface
        • Creating, Saving and Publishing Content Options
        • Finding Content
        • Editing Existing Content
        • Sorting Pages
        • Moving a Page
        • Copying a Page
        • Deleting and Restoring Pages
      • Working with Rich Text Editor
      • Version Management
        • Comparing Versions
        • Rollback to a Previous Version
      • Media Management
        • Working with Folders
        • Working with Media Types
        • Cropping Images
      • Tips & Tricks
        • Refreshing the Tree View
        • Audit Trail
        • Notifications
        • Preview Pane Responsive View
        • Session Timeout
    • Multisite Setup
    • Member Registration and Login
    • Custom Views for Block List
    • Connecting Umbraco Forms and Zapier
    • Creating an XML Sitemap
    • Implement Custom Error Pages
    • Create a custom maintenance page
    • Creating a backoffice API
      • Documenting your controllers
      • Adding a custom Swagger document
      • Versioning your API
      • Polymorphic output in the Management API
      • Umbraco schema and operation IDs
      • Access policies
Powered by GitBook
On this page
  • Getting Started
  • Enable the Content Delivery API
  • Additional configuration
  • Concepts
  • Endpoints
  • Gets a content item by id
  • Gets a content item by route
  • Gets content item(s) by id
  • Gets content item(s) from a query
  • Query parameters
  • Extension points
  • Handling deeply nested JSON output
  • Current Limitations
  • Protected content
  • Property editors
  • Making changes to DisallowedContentTypeAliases
Edit on GitHub
Export as PDF
  1. Reference

Content Delivery API

Get started with the Content Delivery API.

The Content Delivery API delivers headless capabilities built directly into Umbraco. It allows you to retrieve your content items in a JSON format and use your preferred technology to present them in different channels.

The feature preserves a friendly editing experience in Umbraco while ensuring a performant delivery of content in a headless fashion. With the different extension points, you can tailor the API to fit a broad range of requirements.

Getting Started

The Delivery API is an opt-in feature in Umbraco. It must be explicitly enabled through configuration before it can be utilized.

Enable the Content Delivery API

When creating your project, you can enable the Delivery API using the --use-delivery-api or -da flag. This will automatically add the necessary configuration to your project.

dotnet new umbraco -n MyProject -da

You can also enable the Delivery API at a later point by following these steps:

  1. Open your project's appsettings.json.

  2. Insert the DeliveryApi configuration section under Umbraco:CMS.

  3. Add the Enabled key and set its value to true.

  4. Open Program.Cs

  5. Add .AddDeliveryApi() to builder.CreateUmbracoBuilder()

appsettings.json
{
    "Umbraco": {
        "CMS": {
            "DeliveryApi": {
                "Enabled": true
            }
        }
    }
}
Program.cs
builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();

Once the Content Delivery API is enabled, the next step is to rebuild the Delivery API content index (DeliveryApiContentIndex). This can be done using the Examine Management dashboard in the Settings section of the Umbraco Backoffice.

  1. Access the Umbraco Backoffice.

  2. Navigate to the Settings section.

  3. Open the Examine Management dashboard.

  4. Scroll down to find the Tools.

  1. Use the Rebuild index button.

Once the index is rebuilt, the API can serve the latest content from the multiple-items endpoint.

Additional configuration

When the Delivery API is enabled in your project, all your published content will be made available to the public by default.

A few additional configuration options will allow you to restrict access to the Delivery API endpoints and limit the content returned.

appsettings.json
{
    "Umbraco": {
        "CMS": {
            "DeliveryApi": {
                "Enabled": true,
                "PublicAccess": true,
                "ApiKey": "my-api-key",
                "DisallowedContentTypeAliases": ["alias1", "alias2", "alias3"],
                "RichTextOutputAsJson": false
            }
        }
    }
}

Find a description of each of the configuration keys in the table below.

Configuration key
Description

PublicAccess

Determines whether the enabled Delivery API should be publicly accessible or if access should require an API key.

ApiKey

Specifies the API key needed to authorize access to the API when public access is disabled. This setting is also used to access draft content for preview.

DisallowedContentTypeAliases

Contains the aliases of the content types that should never be exposed through the Delivery API, regardless of any other configurations.

RichTextOutputAsJson

Enable outputting rich text content as JSON rather than the default HTML output. JSON can be a preferred format in many scenarios, not least because it supports the routing of internal links better than HTML does.

Are you using Umbraco Cloud?

To test the functionality of the API, you need to create some content first.

Concepts

Before exploring the API endpoints detailed below, there are a few concepts to know.

Content item JSON structure

The Delivery API outputs the JSON structure outlined below to represent the retrieved content items, which consist of a range of properties:

  • Basic properties for any content item include name, createDate, updateDate, id and contentType.

  • All editorial properties from the content type can be found in the properties collection. Depending on the configured property editor, the property output value can be one of the following:

    • String: "This is a string"

    • Number: 1234

    • Boolean expression: true

    • Array: ["hello", "world"]

    • Object: {myObject}

    • Empty: null

  • If the content item varies by culture, the cultures property will contain information about all configured cultures for the content node. This includes the culture-variant path and startItem for each culture.

{
  "name": "string",
  "createDate": "2023-06-23T11:31:07.281Z",
  "updateDate": "2023-06-23T11:31:07.281Z",
  "route": {
    "path": "string",
    "startItem": {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "path": "string"
    }
  },
  "id": "11fb598b-5c51-4d1a-8f2e-0c7594361d15",
  "contentType": "string",
  "properties": {
    "property1Alias": "string",
    "property2Alias": 0,
    "property3Alias": true,
    "property4Alias": [],
    "property5Alias": {},
    "property6Alias": null
  },
  "cultures": {
    "cultureIsoCode1": {
      "path": "string",
      "startItem": {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "path": "string"
      }
    },
    "cultureIsoCode2": {
      "path": "string",
      "startItem": {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "path": "string"
      }
    }
  }
}
Start item

When working headlessly in a multi-site setup, it can be difficult to determine the site context of a particular content item. This is where the start item comes into play.

The start item represents the root of a content item and is commonly returned from the API in conjunction with a content path. For instance:

{
  "route": {
    "path": "/articles/2023/getting-started",
    "startItem": {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "path": "docs-portal"
    }
  }
}

This means that the content item resides under the docs-portal root node and can be retrieved using the path /articles/2023/getting-started.

The start item can also be helpful through the Start-Item request header when obtaining content from the Delivery API. Supplying a root node id or path as the header value, allows you to specify the starting point for the requested content operation:

GET /umbraco/delivery/api/v2/content/item/articles/2023/getting-started
Start-Item: docs-portal
Property expansion and limiting

Property expansion and limiting allows you to:

  • Include properties from related content or media in the API output for a given content item.

  • Limit the content properties in the API output.

By default, a content property that allows picking a different content item (for example a content picker) outputs a "shallow" representation of the picked item. This means that the output only includes basic information about the picked item, excluding the item properties.

When property expansion is applied to the content property, the properties of the picked item are included in the output. This functionality applies to media items and block editors, as well.

Property expansion can also be applied to expanded properties, thus obtaining nested property expansion. As a result, the output grows in size, and this is where property limiting comes into the picture.

All content properties (including expanded properties) are part of the output by default. Property limiting allows for limiting which content properties are included. This means we can tailor the output to concrete use cases without over-fetching.

Property expansion and limiting can be used when querying for single and multiple content or media items. You can expand properties by adding an expand parameter to the query and limit them using the fields query parameter.

Preview

Similar to the preview concept in Umbraco, the Delivery API allows for requesting unpublished content through its endpoints.

This is done by setting a Preview header to true in the API request.

Accessing unpublished versions of your content nodes requires authorization via an API key configured in appsettings.json file using the Umbraco:CMS:DeliveryApi:ApiKey configuration key. To obtain preview data, you must add the Api-Key request header containing the configured API key to the appropriate endpoints.

GET /umbraco/delivery/api/v2/content/item/11fb598b-5c51-4d1a-8f2e-0c7594361d15
Preview: true
Api-Key: my-api-key

Is the API key not applied using the Api-Key request header, the unpublished content will not be included in the JSON response.

Localization

When your content is available in multiple languages, the Delivery API can resolve localized content. When querying content by id, the Accept-Language header can be used to request variant content.

GET /umbraco/delivery/api/v2/content/item/11fb598b-5c51-4d1a-8f2e-0c7594361d15
Accept-Language: en-US

When querying content by path, the culture is already known and included in the path, making the Accept-Language header unnecessary. However, if this header is present in the request, the value of it will take precedence over any other configuration settings. Localization is also supported through the CMS's culture and hostname configuration.

Endpoints

The Delivery API output can represent a specific content item or a paged list of multiple items.

When referring to a specific content item in your API requests, the id parameter always refers to the item’s key (GUID).

Gets a content item by id

GET /umbraco/delivery/api/v2/content/item/{id}

Returns a single item.

Path Parameters

Name
Type
Description

id*

String

GUID of the content item.

Query Parameters

Name
Type
Description

expand

String

Which properties to expand and therefore include in the output if they refer to another piece of content.

fields

String

Which properties to include in the response. All properties are included by default.

Headers

Name
Type
Description

Accept-Language

String

Requested culture.

Api-Key

String

Access token.

Preview

Boolean

Whether draft content is requested.

Start-Item

String

URL segment or GUID of the root content item.

Response Status
Description

200: OK

Content item.

401: Unauthorized

Missing permissions after protection is set up.

404: Not Found

Content item not found.

Gets a content item by route

GET /umbraco/delivery/api/v2/content/item/{path}

Returns a single item.

Path Parameters

Name
Type
Description

path*

String

Path of the content item.

Query Parameters

Name
Type
Description

expand

String

Which properties to expand and therefore include in the output if they refer to another piece of content.

fields

String

Which properties to include in the response. All properties are included by default.

Headers

Name
Type
Description

Accept-Language

String

Requested culture.

Api-Key

String

Access token.

Preview

Boolean

Whether draft content is requested.

Start-Item

String

URL segment or GUID of the root content item.

Response Status
Description

200: OK

Content item.

401: Unauthorized

Missing permissions after protection is set up.

404: Not Found

Content item not found.

Gets content item(s) by id

GET /umbraco/delivery/api/v2/content/items

Returns single or multiple items by id.

Query Parameters

Name
Type
Description

id*

String Array

GUIDs of the content items.

expand

String

Which properties to expand in the response.

fields

String

Which properties to include in the response. All properties are included by default.

Headers

Name
Type
Description

Accept-Language

String

Requested culture.

Api-Key

String

Access token.

Preview

Boolean

Whether draft content is requested.

Start-Item

String

URL segment or GUID of the root content item.

Response Status
Description

200: OK

Content item.

401: Unauthorized

Missing permissions after protection is set up.

Gets content item(s) from a query

GET /umbraco/delivery/api/v2/content

Returns single or multiple items.

Query Parameters

Name
Type
Description

fetch

String

Structural query string option (e.g. ancestors, children, descendants).

filter

String Array

Filtering query string options (e.g. contentType, name, createDate, updateDate).

sort

String Array

Sorting query string options (e.g. createDate, level, name, sortOrder, updateDate).

skip

Integer

Amount of items to skip.

take

Integer

Amount of items to take.

expand

String

Which properties to expand and therefore include in the output if they refer to another piece of content.

fields

String

Which properties to include in the response. All properties are included by default.

Headers

Name
Type
Description

Accept-Language

String

Requested culture.

Api-Key

String

Access token.

Preview

Boolean

Whether draft content is requested.

Start-Item

String

URL segment or GUID of the root content item.

Response Status
Description

200: OK

Content item.

401: Unauthorized

Missing permissions after protection is set up.

404: Not Found

Content item not found.

Query parameters

The Content Delivery API provides query parameters that allow you to customize the content returned by the API. The relevant query parameters for each endpoint are already specified in the corresponding documentation above.

In addition to standard parameters like skip and take, the API provides different possibilities for the value of the expand, fields, fetch, filter and sort parameters. Below are the options that are supported out of the box.

You can extend the built-in selector, filter, and sorting capabilities of the Delivery API by creating custom query handlers.

?expand=properties[$all] All expandable properties on the retrieved content item will be expanded.

?expand=properties[alias1] A specific expandable property with the property alias alias1 will be expanded.

?expand=properties[alias1,alias2,alias3] Multiple expandable properties with the specified property aliases will be expanded.

?expand=properties[alias1[properties[nestedAlias1,nestedAlias2]]] The property with the property alias alias1 will be expanded, and likewise the properties nestedAlias1 and nestedAlias2 of the expanded alias1 property.

?fields=properties[$all] Includes all properties of the retrieved content item in the output.

?fields=properties[alias1] Includes only the property with the property alias alias1 in the output.

?fields=properties[alias1,alias2,alias3] Includes only the properties with the specified property aliases in the output.

?fields=properties[alias1[properties[nestedAlias1,nestedAlias2]]] Includes only the property with the property alias alias1 in the output. If this property is expanded, only the properties nestedAlias1 and nestedAlias2 of the expanded alias1 property are included.

You can apply a selector option to the /umbraco/delivery/api/v2/content endpoint to query content items based on their structure. The selector allows you to fetch different subsets of items based on a GUID or path of a specific content item. The Delivery API will search all available content items if no fetch parameter is provided. The following built-in selectors can be used out of the box:

?fetch=ancestors:id/path All ancestors of a content item specified by either its id or path will be retrieved.

?fetch=children:id/path All immediate children of a content item specified by either its id or path will be retrieved.

?fetch=descendants:id/path All descendants of a content item specified by either its id or path will be retrieved.

Only one selector option can be applied to a query at a time. You cannot combine multiple fetch parameters in a single query.

For example, the following API call will attempt to retrieve all the content items that are directly below an item with the id dc1f43da-49c6-4d87-b104-a5864eca8152:

Request

GET /umbraco/delivery/api/v2/content?fetch=children:dc1f43da-49c6-4d87-b104-a5864eca8152

The filter query parameter allows you to specify one or more filters. These filters must match for a content item to be included in the response. The API provides a few built-in filters that you can use right away with the /umbraco/delivery/api/v2/content endpoint:

?filter=contentType:alias This filter restricts the results to content items that belong to the specified content type. Replace alias with the alias of the content type you want to filter by.

?filter=name:nodeName Only content items whose name matches the specified value will be returned when this filter is applied. Replace nodeName with the name of the item that you want to filter by.

The contentType and name filters support negation. You can exclude content items from the result set that match the filter criteria using an exclamation mark before the filter value.

For example, you can fetch all content items that are not of type article like this: ?filter=contentType:!article.

?filter=createDate>date Only content items created later than the specified value will be returned when this filter is applied. Replace date with the date that you want to filter by.

?filter=updateDate>date Only content items updated later than the specified value will be returned when this filter is applied. Replace date with the date that you want to filter by.

The createDate and updateDate filters support both "greater than", "greater than or equal", "less than" and "less than or equal":

  • Use > for "greater than" filtering.

  • Use >: for "greater than or equal" filtering.

  • Use < for "less than" filtering.

  • Use <: for "less than or equal" filtering.

Multiple filters can be applied to the same request in addition to other query parameters:

Request

GET /umbraco/delivery/api/v2/content?filter=contentType:article&filter=name:guide&skip=0&take=10

This technique can also be used to perform range filtering. For example, fetch articles created in 2023:

Request

GET /umbraco/delivery/api/v2/content?filter=contentType:article&filter=createDate>:2023-01-01&filter=createDate<2024-01-01&skip=0&take=10

Specifying how the results should be ordered, can be achieved using the sort query option. You can use this parameter to sort the content items by fields, including create date, level, name, sort order, and update date. For each field, you can specify whether the items should be sorted in ascending (asc) or descending (desc) order. Without a sort query parameter, the order of the results will be determined by the relevance score of the DeliveryApiContentIndex for the search term.

?sort=createDate:asc/desc An option to sort the results based on the creation date of the content item in either asc or desc order.

?sort=level:asc/desc An option to sort the results based on the level of the content item in the content tree in either asc or desc order.

?sort=name:asc/desc An option to sort the results based on the name of the content item in either asc or desc order.

?sort=sortOrder:asc/desc An option to sort the results based on the sort order of the content item in either asc or desc order.

?sort=updateDate:asc/desc An option to sort the results based on the last update date of the content item in either asc or desc order.

Different sorting options can be combined for the /umbraco/delivery/api/v2/content endpoint, allowing for more advanced sorting functionality. Here is an example:

Request

GET /umbraco/delivery/api/v2/content?sort=name:asc&sort=createDate:asc

Extension points

The Delivery API has been designed for extensibility, offering multiple extension points that provide greater flexibility and customization options. These extension points allow you to tailor the API's behavior and expand its capabilities to meet your specific requirements.

You can find detailed information about the specific areas of extension in the articles below:

Handling deeply nested JSON output

If the limit is exceeded, .NET will throw a JsonException.

To handle this we have to change the limit. Since the Delivery API has its own JSON configuration, we can do so without affecting the rest of our site.

  1. Add the following using statements to Program.cs:

Program.cs
using Umbraco.Cms.Api.Common.DependencyInjection;
using Umbraco.Cms.Core;
  1. Add the following code snippet to the Program.cs file:

Program.cs
builder.Services.AddControllers().AddJsonOptions(
    Constants.JsonOptionsNames.DeliveryApi,
    options =>
    {
        // set the maximum allowed depth of
        options.JsonSerializerOptions.MaxDepth = {desired max depth}
    });

Current Limitations

The Content Delivery API provides a powerful and flexible way to retrieve content from the Umbraco CMS. There are, however, certain limitations to be aware of.

In this section, we will discuss some of the known limitations of the API, and how to work around them if necessary.

Protected content

If member authentication is not explicitly enabled, protected content is ignored and never exposed by the Delivery API.

As a result, lifting protection from a content item requires an additional step to ensure it becomes accessible through the Delivery API. The recommended way is to publish the content item again. Alternatively, you can manually rebuild the DeliveryApiContentIndex to reflect the changes.

Property editors

Certain limitations are associated with some of the built-in property editors in Umbraco. These limitations are listed below.

Rich Text Editor

Internal links may be insufficient in a multi-site setup when outputting the Rich Text Editor content as HTML (the default format). There is a possibility that this limitation may be addressed in future updates. However, consider the alternative approach to rendering the Rich Text Editor content as JSON.

Member Picker

The Member Picker property editor is not supported in the Delivery API to avoid the risk of leaking member data.

Content Picker

The Content Picker property editor is not supported in the Delivery API when configured for Members. This is due to the concern of potentially leaking member data.

Making changes to DisallowedContentTypeAliases

When changing the content type aliases in the Umbraco:CMS:DeliveryApi:DisallowedContentTypeAliases configuration setting, DeliveryApiContentIndex should be rebuilt. This ensures that disallowed content types are not exposed through the Delivery API.

Alternatively, the relevant content items can be republished. This will ensure that changes are reflected, eliminating the need to rebuild the index.

PreviousPorting old Umbraco API ControllersNextCustom property editors support

Last updated 5 months ago

When hosting your Umbraco website on Umbraco Cloud, security should always be prioritized for sensitive information like API keys. Rather than storing it as plain text in the appsettings.json file use the Umbraco Cloud's built-in secrets management. This feature lets you store and manage sensitive data, keeping your API key safe from potential exposure or unauthorized access. To learn more about implementing secrets management, read the .

The route property provides the path to the content item and details about the root node value represented by the startItem object. We will discuss the concept of a in more detail in the next section.

Refer to the article for an in-depth explanation of this feature.

All endpoints are documented in a Swagger document at {yourdomain}/umbraco/swagger. This document is not available in production mode by default. For more information read the article.

Refer to the concept for more information about this parameter.

Refer to the concept for more information about this parameter.

.NET imposes a limit on the depth of object nesting within rendered JSON. This is done to detect cyclic references. Learn more about it in .

The content models might be so deeply nested that the Delivery API produces JSON that exceeds this limit. If this happens, the JsonException will be logged and shown in the .

The Delivery API supports protected content and member authentication. This is an opt-in feature. You can read more about it in the article.

Secrets management documentation
Property Expansion and Limiting
API versioning and OpenAPI
Tailor the API's response for custom property editors
Extend the API with custom selecting, filtering, and sorting options
the official .NET API docs
Umbraco log viewer
Protected Content in the Delivery API
startItem
Property expansion and limiting
Property expansion and limiting
Use the "Rebuild index" button under Tools on the Examine Management dashboard in the Settings section.