Content Client SDK
Deprecated
ContentClient is deprecated. It is replaced by EntryDeliveryClient, EntryManagementClient, and ContentTypeClient. See content API clients for the current clients and a migration guide.
The Content Client (ContentClient from @uniformdev/canvas) provides programmatic access to headless content entries stored in Uniform. Use it for server-side data fetching, search indexing, custom API routes, or any scenario where you need to query content outside of the standard composition rendering pipeline.
note
Within the App Router SDK's composition rendering flow, content is resolved automatically. The Content Client is for use cases where you need to access content directly -- such as building sitemaps, search indexes, custom API endpoints, or fetching content that isn't part of a composition.
Installation#
The Content Client is part of the @uniformdev/canvas package:
Initializing the client#
The App Router SDK does not provide a pre-configured Content Client factory; initialize the client directly as shown above. For composition access, the App Router SDK provides a pre-configured Canvas Client.
Fetching entries#
Get entries by content type#
Pagination#
Search and filtering#
getEntries accepts filters, search, orderBy, and select with the same syntax as the current entry clients:
For the filter syntax, operators, supported field types, and sorting, see search and filter. For the select option, see data projection.
Building a search index#
A common use case for the Content Client is building a search index. Here is a pattern that retrieves all compositions via the project map and the Route Client, then extracts text content for indexing:
note
For large sites, consider running index rebuilds outside the Next.js build process to avoid build timeout limits. You can trigger rebuilds via a webhook when content is published.
Import reference#
| Export | Package | Description |
|---|---|---|
ContentClient | @uniformdev/canvas | Client for fetching content entries |
CanvasClient | @uniformdev/canvas | Client for fetching compositions |
RouteClient | @uniformdev/canvas | Client for route resolution |
ProjectionSpec | @uniformdev/canvas | Type for the select data projection option |