REST API
TubeBay registers its own REST API endpoints under the tubebay/v1 namespace. All endpoints require the manage_options capability (WordPress administrator).
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 endpoints require:
- The user to be logged in to WordPress
- The user to have the
manage_optionscapability - A valid WordPress REST API nonce (handled automatically by the admin panel)
Base URL
/wp-json/tubebay/v1/Endpoints
Authentication & Connection
Handle Connect (OAuth & Manual)
POST /wp-json/tubebay/v1/auth/connectUnified endpoint to connect a YouTube channel.
- connection_method:
oauthorapi - api_key: (Required if method is
api) - channel_id: (Required if method is
api) - refresh_token: (Required if method is
oauth)
Test Connection
POST /wp-json/tubebay/v1/youtube/test-connectionValidates credentials and returns channel metadata (title, description).
Library Management
Sync Library (Manual)
GET /wp-json/tubebay/v1/youtube/sync-libraryTriggers an immediate fetch from the YouTube API, bypassing cached transients.
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 support for searching and sorting.
- search: (Optional) Filter by title
- sort:
date_desc,date_asc,title_asc,title_desc - page_token: (Optional) For pagination
Mappings
Get Product Mappings
GET /wp-json/tubebay/v1/mappingsReturns the full list of video-to-product mappings.
Update Mapping
POST /wp-json/tubebay/v1/mappingsCreates or updates a mapping between a YouTube Video ID and a WooCommerce Product ID.
Settings
Get All Settings
GET /wp-json/tubebay/v1/settingsUpdate Settings
POST /wp-json/tubebay/v1/settingsProducts (WooCommerce Wrapper)
Search Products
GET /wp-json/tubebay/v1/productsUtility endpoint used by the mapping interface to find WooCommerce products by name or SKU.
- search: (Required) Search query