REST API reference

All endpoints are under /wp-json/typost/v1/. The plugin’s own admin screen uses the same endpoints.

What is required on every request?

  • Authentication: Send a nonce in the standard X-WP-Nonce header.
  • Capability: Each route needs edit_posts, upload_files, or manage_options. The tables show which. Most read routes need edit_posts.
  • Rate limiting: Each user can send 50 write requests (POST, PUT, PATCH, DELETE) per minute to all typost/v1 routes together. Read requests are not limited. Above the limit, a route returns HTTP 429 with the code rate_limit_exceeded.

Authors can pick and adopt fonts. To add, change, or delete uploaded kits and Adobe Fonts projects, a user needs upload_files. Site-wide settings need manage_options.

Presets and features

MethodRouteCapability
GET/presetsedit_posts
POST/presetsedit_posts
DELETE/presets/{id}edit_posts
GET/featuresedit_posts

Fonts

Uploaded kits

MethodRouteCapability
GET/fontsedit_posts
POST/fontsupload_files
DELETE/fonts/{id}upload_files
PATCH/fonts/{id}/fallback, /fonts/{id}/load-on-all-pagesupload_files
POST/fonts/detect-weights/bulkupload_files

Adobe Fonts

MethodRouteCapability
GET/adobe-fontsedit_posts
POST/adobe-fontsupload_files
DELETE/adobe-fonts/{id}upload_files
PATCH/adobe-fonts/{id}/fallback, /adobe-fonts/{id}/load-on-all-pagesupload_files

Custom definitions

MethodRouteCapability
GET/manual-fontsedit_posts
POST/manual-fontsedit_posts
PATCH, DELETE/manual-fonts/{id}edit_posts

Font order, feature visibility, and replacements

MethodRouteCapability
GET/font-order, /font-feature-visibilityedit_posts
POST/font-order, /font-feature-visibility/{font_id}edit_posts
GET/font-replacements, /font-replacements/orphansedit_posts
POST/font-replacementsedit_posts
PATCH, DELETE/font-replacements/{id}edit_posts

WordPress Font Library

These routes need WordPress 6.5 or later.

MethodRouteCapability
POST, DELETE/fonts/{id}/wp-librarymanage_options
POST/fonts/wp-library/bulk, /fonts/wp-library/dismiss-noticemanage_options
POST/wp-fonts/adoptedit_posts

Adoption is idempotent. If you adopt a font two times, you get the same numeric ID. The plugin does not allocate a second ID.

Admin settings

MethodRouteCapability
GET/admin/refreshmanage_options
POST/admin/options, /admin/accessibility, /admin/clear-cachemanage_options

Export and import

MethodRouteCapability
POST/exportedit_posts, plus the capability of each section, and manage_options for allFonts
POST/import/previewmanage_options
POST/importmanage_options

/export takes sections, allFonts, and sectionArgs, and returns the file. /import/preview takes fileText and saves nothing. /import takes fileText and choices. The client sends the file again with the import, so the server keeps nothing between the two requests. Since 2.3.5. Extensions add their own sections with the typost_export_sections filter.

Variable font axes

MethodRouteCapability
GET/variable-font-axesmanage_options
GET, POST, DELETE/variable-font-axes/{id}manage_options
POST/variable-font-axes/{id}/redetectmanage_options

Re-detection reads the axes from the font’s own files and returns them without saving. The admin form then shows what it found, and you decide. Only uploaded kits have files on the server. For Adobe fonts and custom font definitions, the browser reads the axes.

To save axes, send the full axes array. A partial array replaces the stored array. It does not merge. So read before you write.

Send isVariable: true with the axes. If you leave it out, the plugin stores no axes and marks the font as not variable. You can also send hideWeights.

Paragraph styles

MethodRouteCapability
GET, POST/paragraph-stylesedit_posts
PATCH, DELETE/paragraph-styles/{id}edit_posts
GET/paragraph-styles/{id}/admin-cardedit_posts

The admin-card route returns the details and the preview HTML of the style’s card on the Paragraph Styles tab, and the style CSS made again. The tab calls it after the Edit form saves. It is available since 2.3.4.

Where is the data stored?

The data is in wp_options, not in custom tables:

  • typost_presets
  • typost_custom_fonts
  • typost_adobe_fonts
  • typost_manual_fonts
  • typost_adopted_wp_fonts
  • typost_font_replacements
  • typost_paragraph_styles
  • typost_paragraph_styles_next_id
  • typost_variable_font_axes
  • typost_variable_font_flags
  • typost_block_enter_line_break
  • typost_glyphs_toolbar_button
  • typost_ps_toolbar_button
  • typost_new_font_sizes_px
  • typost_font_face_version

Applied typography is inline in the post content. So it goes with an export and needs no migration.