This is a placeholder for a diagram. Do not edit this line directly.
OpenEmbed is a service that allows your blocklet and its components to expose oEmbed-compatible endpoints. This makes it possible for other websites and applications to easily discover and embed content from your blocklet, enhancing its discoverability and integration capabilities. The service aggregates OpenEmbed data from all running components and provides it in both JSON and YAML formats.
This guide explains how the OpenEmbed service works and how you, as a developer, can make your blocklet's components compatible with it.
How It Works
The OpenEmbed service operates on a discovery and aggregation model. When an external application (a consumer) wants to embed content from your blocklet, it first needs to discover the available embeddable resources. Blocklet Service facilitates this by providing a standardized endpoint.
The process is as follows:
Discovery
An oEmbed consumer queries the well-known endpoint provided by the Blocklet Service:
/.well-known/openembed.json.Internal Query
The Blocklet Service, upon receiving the request, scans for all active child components that are configured to provide OpenEmbed data.
Data Fetching
For each compatible component, the service makes an internal request to a specific path within that component (
/__blocklet__/openembed.json) to retrieve its list of embeddable content URLs.Aggregation & Enrichment
The service collects the responses from all components. It enriches this data by prefixing each embeddable path with its component's mount point and adding relevant metadata.
Response
The service returns a single, aggregated
openembed.json(or.yaml) file to the consumer, containing a complete list of all embeddable content from the entire blocklet application.
The following diagram illustrates this data flow: This is a placeholder for a diagram. Do not edit this line directly.
Developer Implementation
To make a component's content embeddable, you must expose a JSON endpoint that provides metadata about the resources you want to make available.
1. Create the OpenEmbed Endpoint
Within your component, create a route that responds to GET requests at /__blocklet__/openembed.json. This is the fixed path that the Blocklet Service will query.
The response from this endpoint must include the x-blocklet-openembed: true header to be recognized by the service.
2. Define the JSON Structure
The JSON file served by your endpoint should define the embeddable paths and their properties. The core of this file is the embeds object, where each key is a URL path (relative to the component's root) and the value is an object describing the resource, following the oEmbed specification.
Here is an example of what a component's openembed.json file might look like:
component/openembed.json
{
"info": {
"version": "1.2.0"
},
"embeds": {
"/posts/{post-id}": {
"get": {
"summary": "Embed a single blog post",
"description": "Provides an oEmbed-compatible response for a single blog post, allowing it to be embedded in external sites.",
"parameters": [
{
"name": "post-id",
"in": "path",
"required": true,
"description": "The unique identifier of the post to embed.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "oEmbed Response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"type": { "type": "string", "example": "rich" },
"version": { "type": "string", "example": "1.0" },
"title": { "type": "string" },
"author_name": { "type": "string" },
"provider_name": { "type": "string" },
"html": { "type": "string" }
}
}
}
}
}
}
}
}
}
}Service API Endpoints
The Blocklet Service exposes the following public endpoints for consumers to discover embeddable content.
Get Aggregated OpenEmbed Data
- Endpoint (JSON):
/.well-known/openembed.json - Endpoint (YAML):
/.well-known/openembed.yaml - Method:
GET - Description: Retrieves the aggregated OpenEmbed metadata for all running and compatible components within the blocklet.
- Query Parameters:
did(optional): If provided, the service will only return the OpenEmbed data for the component with the matching DID.
Data Structures
The final output from the service endpoint is a merged and enriched version of the data provided by the individual components.
Top-Level Object
- openembed
string(required) — The version of the OpenEmbed specification being used. Example: '0.1.0'. - info
object(required) — Contains metadata about the root blocklet application.- title
string— The title of the blocklet application. - description
string— A short description of the blocklet application. - contact
object— Contact information for the blocklet owner.- email
string— The owner's email address. - name
string— The owner's full name. - url
string— A URL pointing to the owner's user profile.
- email
- version
string— The version of the root blocklet.
- title
- tags
array(required) — An array of tag objects, used to group related embeds. Tags are derived from component metadata.- name
string— The name of the tag (typically the component title). - description
string— A description for the tag (typically the component description).
- name
- embeds
object(required) — An object containing all discoverable embed endpoints from all components.
Embed Item Object
Each key within the main embeds object is a full URL path (e.g., /my-component/posts/{post-id}), and its value is an object with the following structure.
- tags
array— An array of strings that associate this embed with one or more tags. Example: ['My Component']. - x-meta
object— An object containing metadata added by the Blocklet Service for internal tracking and identification.- id
string— A unique, deterministically generated address for this specific embeddable path. - did
string— The DID of the component that provides this embed. - path
string— The original path as defined within the component (without the mount point prefix). - version
string— The version of the component. - prefix
string— The mount point of the component.
- id