Site Reference

Site Reference

Schemas

This document provides a detailed reference for the data schemas that constitute a Site program. Understanding these schemas is crucial for preparing data for API calls and for interpreting the data returned by the LensService.

All data objects submitted to the LensService for creation or editing should conform to the structures described below.

Common Document Properties

While there is no rigid base class, most documents share a set of common, fundamental properties. When creating a new content item (like a Release), the id, postedBy, and siteAddress fields are automatically handled by the LensService.

FieldTypeDescription
idstringA unique identifier for the document. Usually a UUID, generated automatically on creation. Required when editing an existing document.
postedByPublicSignKey or Uint8ArrayThe cryptographic public key of the identity associated with the document. When creating content, this is automatically set to the current user unless specified otherwise.
siteAddressstringThe unique address of the Site where this document was originally created. This is always set by the service and is immutable.

Note on Immutability: The postedBy and siteAddress fields are considered immutable. Once a document is created, these values cannot be changed via an edit operation. The SDK enforces this rule at the service layer.


1. Release

The Release is the primary content object. It represents a single, publishable item like a music album, a video, or an article.

FieldTypeRequiredDescription
namestringYesThe display title of the release.
categoryIdstringYesThe id of the ContentCategory this release belongs to (e.g., “music”).
contentCIDstringYesThe IPFS Content Identifier (CID) of the main data file(s) for this release.
thumbnailCIDstringNoThe IPFS CID for a thumbnail or cover image associated with the release.
metadatastringNoA JSON string containing additional, category-specific metadata.

2. ContentCategory

A ContentCategory defines a template for a type of content, including what metadata is expected. These are typically created by a Site administrator or initialized from a default set.

FieldTypeRequiredDescription
categoryIdstringYesA unique, human-readable string identifier (e.g., “movies”, “tv-shows”). This field is immutable.
displayNamestringYesThe human-readable name for the category (e.g., “TV Shows”).
featuredbooleanNoA flag to indicate if this category should be prominently displayed. Defaults to false.
descriptionstringNoA brief explanation of what content belongs in this category.
metadataSchemastringNoA JSON string defining the structure of the metadata field for Releases in this category. See defaults.ts for examples.

Note on categoryId Immutability: The categoryId field acts as a stable “business key”. Once a category is created, this ID cannot be changed to ensure that all Releases linked to it remain valid. The SDK enforces this rule.

3. FeaturedRelease

A FeaturedRelease acts as a “pin” or “shortcut” to an existing Release, allowing it to be highlighted.

FieldTypeRequiredDescription
releaseIdstringYesThe id of the Release document that is being featured.
startTimestringYesAn ISO 8601 formatted date-time string indicating when the feature should become active.
endTimestringYesAn ISO 8601 formatted date-time string indicating when the feature should expire.
promotedbooleanYesA flag for additional styling or priority in a “promoted” section.

4. Subscription

A Subscription represents a unilateral “follow” action, forming the basis of federation. When a Subscription is created, the FederationManager begins syncing content from the target Site.

FieldTypeRequiredDescription
tostringYesThe full, unique address of the remote Site program being subscribed to.

Note: The id for a subscription is deterministically generated from a combination of the subscriber’s and the target site’s addresses to prevent duplicate subscriptions.

5. BlockedContent

A BlockedContent record is a moderation tool used by Site administrators to hide or prevent content from being displayed.

FieldTypeRequiredDescription
cidstringYesThe IPFS Content Identifier (CID) to be blocked.

This reference provides the necessary detail for developers to correctly format data for all API interactions. For information on how to create, retrieve, or manage documents using these schemas, please consult the API Reference.