Skip to content

REST API

Pedro de Carvalho edited this page Jul 29, 2026 · 1 revision

REST API

Saltus Framework registers REST API routes under the saltus-framework/v1/ namespace. These routes power both direct REST access and the MCP/Abilities tools.

Route Overview

Route Method Controller Description
/health GET HealthController Framework health, version, error rate, latency
/models GET ModelsController List all registered CPTs and taxonomies
/models/{slug} GET ModelsController Get details of a specific model
/duplicate/{post_id} POST DuplicateController Duplicate a post
/export/{post_id} GET ExportController Export a post as WXR
/settings/{post_type} GET SettingsController Get settings for a post type
/settings/{post_type} PUT SettingsController Update settings for a post type
/meta GET MetaController List meta field definitions for all CPTs
/meta/{post_type} GET MetaController Get meta field definitions for a CPT
/meta/{post_type}/{post_id} PUT MetaController Update meta fields for a specific post
/reorder POST ReorderController Batch update post menu order

Authentication & Permissions

All routes use WordPress cookie authentication for admin users and REST API nonce for anonymous/application access. Permission callbacks check current_user_can() against the appropriate capability for each operation.

Default permission checks:

Route Capability
/health edit_posts
/models edit_posts
/duplicate/{post_id} edit_post for target post
/export/{post_id} export
/settings/{post_type} manage_options
/meta edit_posts
/meta/{post_type}/{post_id} edit_post for target post
/reorder Model-specific edit capability

Feature Gating

Routes can be enabled or disabled per model using the show_in_rest option and per-feature config gating. See Feature Gating for details.

Metadata Responses

Meta field endpoints return both raw and normalized data:

{
  "meta": {
    "ts_info": {
      "id": "information_metabox",
      "title": "Information",
      "sections": { ... }
    }
  },
  "normalized": {
    "fields": [
      {
        "path": "ts_info.release_date",
        "label": "Release Date",
        "type": "string",
        "meta_key": "ts_info"
      }
    ],
    "rest_meta_keys": {
      "ts_info": {
        "meta_key": "ts_info",
        "serialized": true,
        "writable": true
      }
    }
  }
}

This lets clients reason about nested meta while preserving the original Saltus/Codestar shape for advanced integrations.

Clone this wiki locally