REST API
TubeBay registers its own REST API endpoints under the tubebay/v1 namespace. TubeBay Pro adds a tubebay-pro/v1 namespace for license management.
Internal API
These REST API endpoints are used internally by the TubeBay admin panel and Setup Wizard. They are not intended as a public API and may change in future versions.
Authentication
All tubebay/v1 endpoints require:
- The user to be logged in to WordPress
- The user to have the
manage_tubebaycapability (granted to the Administrator role on activation — see Architecture; grant it to another role with a capabilities plugin if you want Shop Managers to have access) - A valid WordPress REST API nonce (handled automatically by the admin panel)
Base URL
/wp-json/tubebay/v1/Endpoints
Authentication & Connection
Connect (OAuth & Manual)
POST /wp-json/tubebay/v1/auth/connectSaves connection credentials and tests them. Body:
connection_method(required):oauthorapiapi_key,channel_id: required ifconnection_methodisapirefresh_token: required ifconnection_methodisoauth
Start OAuth Flow
GET /wp-json/tubebay/v1/youtube/oauth-connectRedirects the browser to the WPAnchorBay OAuth proxy to begin the Google consent flow. This is the URL behind the Sign in with YouTube button on the Connection tab.
Test Connection
POST /wp-json/tubebay/v1/youtube/test-connectionValidates credentials (without saving them) and returns channel metadata.
Disconnect
DELETE /wp-json/tubebay/v1/youtube/disconnectClears the connection status and channel name (does not delete stored credentials).
Library Management
Sync Library (Manual)
GET /wp-json/tubebay/v1/youtube/sync-libraryTriggers an immediate fetch from the YouTube API, bypassing the cached transient.
Sync Status
GET /wp-json/tubebay/v1/youtube/sync-library-statusReturns the current sync status and the timestamp of the last successful update.
Get Synced Videos
GET /wp-json/tubebay/v1/youtube/videosFetch synced videos from the local cache, with search and sort support.
search(optional): filter by titlesort:date_desc,date_asc,title_asc,title_desc,view_countpage_token(optional): for pagination
Product Mapping
Search Products
GET /wp-json/tubebay/v1/productsSearch WooCommerce products by name (used by the mapping UI). Params: search, page.
Bulk Assign Videos
POST /wp-json/tubebay/v1/products/bulk-assignAssigns or removes videos across multiple products at once (used by the Manager view).
Save Video Order
POST /wp-json/tubebay/v1/products/video-orderPersists the drag-and-drop order of a product's assigned videos.
Settings
Get All Settings
GET /wp-json/tubebay/v1/settingsUpdate Settings
POST /wp-json/tubebay/v1/settingsAccepts any of the saveable setting keys. Changing connection credentials (api_key, channel_id, refresh_token, connection_method) automatically re-tests the connection. Add-ons can register additional saveable keys via the tubebay_settings_saveable_keys filter.
Delete All Data
DELETE /wp-json/tubebay/v1/settings/delete-all-dataWipes every tubebay_* option, all TubeBay product meta, and all cached transients, then restores default settings. Used by the Delete All Data button on the Advanced tab.
Logs
Clear Debug Logs
DELETE /wp-json/tubebay/v1/logsDeletes all files under wp-content/uploads/tubebay-logs/. There is no GET endpoint for reading log contents over the API — inspect the log files directly on the filesystem.
TubeBay Pro: License Endpoints
Namespace: tubebay-pro/v1. Same manage_tubebay capability requirement.
Activate License
POST /wp-json/tubebay-pro/v1/license/activateBody: license_key. Calls the remote license server and, on success, sets tubebay_license_status to active.
Deactivate License
POST /wp-json/tubebay-pro/v1/license/deactivate