Overview
The Font endpoints provide access to manage custom fonts used in web stories. The API supports both built-in fonts (Google Fonts) and custom uploaded fonts. Base Path:/wp-json/web-stories/v1/web-story-font
List Fonts
Retrieves a collection of available fonts.GET /web-stories/v1/web-story-font
Query Parameters
Scope:
view, edit, or embedFilter by font service:
all- Returns both built-in and custom fontsbuiltin- Returns only built-in fonts (Google Fonts + system fonts)custom- Returns only user-uploaded custom fonts
Search fonts by family name (case-insensitive)
Limit results to specific font families (case-insensitive)Example:
?include[]=Roboto&include[]=Open+SansResponse
Response Fields
Unique identifier for custom fonts (null for built-in fonts)
Font family name
Fallback font families (e.g.,
["sans-serif"], ["serif"])Available font weights (100-900, in increments of 100)Example:
[400, 700] for normal and boldAvailable font stylesExample:
["normal", "italic"]Font weight and style combinations as
[weight, style] tuplesStyle: 0 = normal, 1 = italicExample: [[400, 0], [400, 1], [700, 0]]Font source:
builtin for Google Fonts/system fonts, custom for uploaded fontsFont metrics for text rendering
Font file URL or Google Fonts CSS URL
Get Font
Retrieves a single custom font by ID.GET /web-stories/v1/web-story-font/:id
This endpoint only works for custom fonts (with numeric IDs). Built-in fonts don’t have individual endpoints.
Path Parameters
Unique identifier for the custom font
Response
Returns a single font object (same structure as list response).Create Custom Font
Registers a new custom font.POST /web-stories/v1/web-story-font
Request Body
Font family name (must be unique)
Array of fallback font familiesExample:
["sans-serif"] or ["Georgia", "serif"]Array of available font weights (integers 100-900)Minimum: 1 weight required
Array of available stylesExample:
["normal"] or ["normal", "italic"]Minimum: 1 style requiredArray of
[weight, style] tuples where style is 0 (normal) or 1 (italic)Must have exactly 2 items per variantMinimum: 1 variant requiredDirect URL to the font file (WOFF2, WOFF, TTF, or OTF)
Font metrics object with all required properties (see Response Fields above)
Response
Returns the created font object with HTTP 201 status.Font family names must be unique. Attempting to create a font with a name that already exists (case-insensitive) will return a
rest_invalid_field error.Delete Custom Font
Deletes a custom font. Built-in fonts cannot be deleted.DELETE /web-stories/v1/web-story-font/:id
Path Parameters
Unique identifier for the custom font
Response
Fonts are force-deleted (no trash). The deletion is permanent.
Built-in Fonts
The plugin includes built-in fonts from Google Fonts. These fonts:- Are loaded from
/includes/data/fonts/fonts.json - Have
service: "builtin" - Do not have numeric IDs
- Cannot be modified or deleted via the API
- Include popular fonts like Roboto, Open Sans, Lato, etc.
Font Filtering Examples
Get all fonts
Get only custom fonts
Get only built-in fonts
Search for fonts
Get specific fonts by family name
Font Sorting
Fonts are returned sorted alphabetically by family name:- Custom fonts are sorted by title (case-insensitive)
- Built-in fonts are pre-sorted
- When mixing both (
service=all), the combined list is sorted by family name
Permissions
List Fonts: Requires
read_post capability for the font post typeCreate Font: Requires
edit_web-stories capabilityDelete Font: Requires
delete_web-story or delete_others_web-stories capabilityCommon Errors
Status 403: You don’t have permission to list/create fontsRequired capability:
read_post for listing, edit_web-stories for creatingStatus 400: A font with this name already existsFont family names must be unique (case-insensitive comparison)
Status 404: Custom font with the specified ID does not exist
Font Data Storage
Custom fonts are stored as custom posts:- Post Type:
web-story-font - Post Title: Font family name
- Post Content: JSON-encoded font data (fallbacks, weights, styles, variants, metrics, url)
- Post Status: Always
publish