Skip to content

WP Social Ninja REST API ​

Complete REST API reference for WP Social Ninja and WP Social Ninja Pro. Endpoints are organized by module, with parameters, response shapes, and examples on each page.

Getting Started ​

Base URL: https://your-site.com/wp-json/wpsocialreviews/v2

The namespace and version come from config/app.php:

php
'rest_namespace' => 'wpsocialreviews',
'rest_version'   => 'v2',

These are admin endpoints. Every request must carry a valid WordPress REST nonce for a logged-in user, and the route group's policy authorizes the specific capability.

Authentication ​

From the admin Vue SPA — use the global $get / $post / $put / $del / $patch helpers registered in resources/admin/main.js. They attach the X-WP-Nonce header automatically.

js
const { data } = await $get('platforms/enabled')

From outside — send the nonce header with the logged-in cookie:

bash
curl -X GET "https://your-site.com/wp-json/wpsocialreviews/v2/platforms" \
  -H "X-WP-Nonce: <nonce>" \
  --cookie "wordpress_logged_in_xxx=..."

Conventions ​

  • Paths below are relative to the base URL …/wpsocialreviews/v2.
  • Path parameters like {id} are integers (routes declare ->int('id')).
  • Collection endpoints commonly accept page and per_page (default per_page=10) and sometimes search.
  • Handlers are shown as Controller@method (controllers in app/Http/Controllers/).
  • The REST namespace is wpsocialreviews/v2.

API Modules ​

Core Resources ​

ModuleGroup(s)Description
PlatformsplatformsPlatform status, statuses, dashboard notices, add-ons, and review/feed connection configs
Reviews & Testimonialsreviews, testimonialsManage custom reviews and testimonials (shared route set)
TemplatestemplatesTemplates and their reviews/feeds meta

Configuration ​

ModuleGroup(s)Description
SettingssettingsGlobal settings, license, translations, advanced settings, data reset
Chat Widgetschat-widgetsChat widgets and their chat meta

Content ​

ModuleGroup(s)Description
ShoppableshoppableShoppable posts and template settings
NotificationsnotificationsNotification popups
Pages & Onboardingpages, onboardingPage search and the setup wizard

Pro Features ​

ModuleGroup(s)Description
Pro APIpro, pro/settings, pro/review-forms, pro/custom-sourcesManagers, QR codes, WooCommerce/FluentCart imports, review forms, custom sources

TikTok

Custom Feed for TikTok registers no REST routes. It renders through the core [wp_social_ninja] shortcode (platform="tiktok"), the wp_ajax_wpsr_get_more_feeds handler, and the wpsocialreviews/render_tiktok_template filter. See Custom Feed for TikTok.


Permission System ​

Each route group is guarded by a policy class in app/Http/Policies/ that authorizes the request against a WP Social Ninja capability. The admin capability used for most checks is filterable via wpsr_admin_permission (default manage_options).

GroupPolicy
platforms/*PlatformPolicy
reviews / testimonialsReviewPolicy / TestimonialPolicy
settings, proSettingsPolicy
chat-widgetsWidgetsPolicy
shoppableShoppablePolicy
notificationsNotificationsPolicy
pages / onboardingPagesPolicy / AdminPolicy
templatesTemplatePolicy
pro/review-forms / pro/custom-sourcesReviewFormPolicy / CustomSourcesPolicy

See Policies & Authorization for how policies work and Registering Endpoints to add your own.

Error Handling ​

Responses use standard WordPress REST error envelopes. A failed policy check returns 403; validation and business-logic errors typically return 422 with a message (and sometimes errors) key.

StatusMeaning
200Success
403Forbidden — the policy denied the request
404Not Found — resource does not exist
422Unprocessable — validation or business-logic error

WP Social Ninja Developer Documentation