Developer reference: REST API, webhooks & WP-CLI Pro

The formal integration surface: FileDeck's REST routes, signed webhooks, WP-CLI commands, and the filters that matter — in one page.

Everything a script, integration or agency build can hold onto. These surfaces are stable: route shapes, webhook payloads and command names change only with a major-version note in the changelog.

REST API

All under /wp-json/. Public routes respect the same access rules as the library UI — a restricted document behaves identically everywhere.

Route Method What it does
wp/v2/filedeck_document GET WordPress-native document listing (restricted documents excluded per visitor). Standard core parameters.
filedeck/v1/library GET One page of a library: server-rendered rows + JSON (see headless front ends for the ctx token).
filedeck/v1/download/<id> GET The download route — counts, gates (terms/form/bot/lead/quotas) and access all enforced here. Signed variant carries fdk_exp/fdk_sig.
filedeck/v1/zip POST { ids: [..] } → a zip of the permitted subset, gates applied per document.
filedeck/v1/search GET Content search (?q=), page-jump hits included.
filedeck/v1/semantic GET Semantic search (AI tier, when configured).

Webhooks

Three POST streams, all JSON, all opt-in under Documents → Settings:

  • Library eventsdocument.published, .updated, .unpublished, .deleted, .downloaded. Signed: verify X-FileDeck-Signature = sha256= + HMAC-SHA256 of timestamp.body with your signing secret. See document events for payloads and a verifier.
  • Download notifications — per-download payload (document, user, context).
  • Leads — each captured lead (name, email, document).

WP-CLI

wp filedeck status                 # counts, tier, available capabilities
wp filedeck list [--format=json] [--category=<slug>] [--per-page=<n>]
wp filedeck import <source>        # any one-click importer, headless (Pro)
wp filedeck reindex                # rebuild the content-search index (Pro)
wp filedeck event test --event=document.published --id=<id>   # webhook test (Pro)

The filters that matter

A curated set — every one is documented at its definition:

  • filedeck_download_allowed — final allow/deny for any download; return true or a WP_Error. Every Pro gate uses this same filter.
  • filedeck_doc_row — the assembled row before render/serialisation.
  • filedeck_library_data — data attributes handed to the front-end script.
  • filedeck_formgate_hooks — open the form gate from any form plugin’s completion action.
  • filedeck_event (action) — every library event, for PHP integrations.
  • filedeck_lead_captured (action) — every captured lead.
  • filedeck_retention_applied (action) — every retention action (AI tier).
  • filedeck_server_mode_threshold, filedeck_semantic_threshold, filedeck_zip_max_bytes, filedeck_max_upload_bytes — the tuning knobs.

If you need a surface that isn’t here, say so on the support page — formalising another route costs little once there’s a real consumer for it.

Still stuck? Email support@getfiledeck.com.