REST API
All endpoints live under /wp-json/spacebay/v1/ and use standard WordPress cookie authentication with the X-WP-Nonce header.
This page is the short list of routes and who may call them. List routes take page (1 to 100000) and per_page, and a value outside the range, or a search text over 100 characters, answers 400 rest_invalid_param.
| Endpoint | Method | Who |
|---|---|---|
/me | GET | Anyone. Returns the current member or logged_in: false. |
/settings | GET, POST, PUT | Administrators. |
/auth/login | POST | Visitors, while the community login pages are on. Returns logged_in with a redirect address, or a second step when an add-on asks for one (the code step of Pro). |
/auth/signup | POST | Visitors, while signing up is on. |
/auth/forgot, /auth/reset | POST | Visitors. Forgot always gives the same answer, whether the account exists or not. |
/auth/social/{provider}, /auth/social/{provider}/callback | GET | Visitors, while that provider (google or facebook) is switched on and has its keys; otherwise the route answers 404. The first sends the browser to the provider and takes an optional redirect_to. The second is the address the provider sends the visitor back to; it logs them in (or asks for a second step) and redirects to the portal. These are browser redirects, not JSON calls. |
/me/security, /me/password | GET, PUT | Logged-in members. Changing the password needs the current one. |
/me/stats | GET | Logged-in members. Their own activity totals: posts, comments, likes received and joined spaces. |
/me/pulse | GET | Logged-in members. Unread messages and notifications, plus what add-ons add (with Pro, calls ringing for them). |
/conversations, /conversations/{id} | GET, POST, PATCH | Members in the conversation. POST starts a one-to-one chat or group within the messaging rules; PATCH renames a group or mutes it. |
/conversations/{id}/messages, /conversations/{id}/read | GET, POST | Members in the conversation. GET takes before, after and limit. |
/conversations/{id}/members, /conversations/{id}/members/{user_id} | POST, DELETE | Group owner adds and removes people; anyone can remove themselves. |
/messages/{id} | DELETE | The author, or a moderator. |
/messages/recipients, /me/blocks | GET, POST | Logged-in members. A member can block up to 500 members (since 1.1.2). With the member directory off, /messages/recipients finds only people who share a space or a chat with the caller. |
/admin/stats | GET | Administrators. |
/spaces | GET, POST | GET: anyone who can open the community (only spaces they may see). POST: administrators. |
/spaces/{id}, /spaces/slug/{slug} | GET, PATCH, DELETE | GET: people who may see the space. PATCH: space admins. DELETE: administrators. |
/spaces/{id}/join, /spaces/{id}/leave | POST | Logged-in members. |
/spaces/{id}/members | GET, POST | GET active members: logged-in members who may read the space, while the member directory is on (space admins always). Hidden profiles are left out. Other lists and POST (invite): space admins. |
/spaces/{id}/members/{user_id} | PATCH, DELETE | Space admins. |
/space-groups, /space-groups/{id} | POST, PATCH, DELETE | Administrators. |
/spaces/reorder, /space-groups/reorder | POST | Administrators. Send ids, a list of IDs in the new order. |
/members, /members/{id} | GET | Logged-in members, when the directory is on. |
/feed | GET | Anyone who can open the community. Only posts in spaces they may read. Filters: space_id, user_id, topic, hashtag, bookmarked, search, orderby. The X-WP-Total header is the exact number of posts; send count_total=false (since 1.0.0, what the portal does) to skip that count on large communities: the header then gives the posts up to this page, plus one when another page follows. |
/posts | POST | Members who may post in the space. |
/posts/{id} | GET, PATCH, DELETE | GET: readers of the space. PATCH and DELETE: the author and space moderators. |
/posts/{id}/like, /bookmark, /pin | POST | Like: space members. Save: logged-in readers. Pin: space moderators. |
/posts/{id}/comments | GET, POST | GET: readers of the space. POST: space members. |
/comments/{id}, /comments/{id}/like | PATCH, DELETE, POST | Edit and delete: the author and space moderators. Like: space members. |
/media | POST | Logged-in members. One image per request in the file field. |
/topics, /topics/{id} | GET, POST, PATCH, DELETE | GET: anyone who can open the community. Changes: administrators. |
/me/profile | GET, PATCH | Logged-in members, for their own profile. |
/me/avatar, /me/cover | POST, DELETE | Logged-in members. POST one image in the file field. |
/me/email-preferences | GET, PUT | Logged-in members. |
/notifications, /notifications/count | GET | Logged-in members, for their own notifications. Filter: unread. |
/notifications/read | POST | Logged-in members. Send ids or all: true. |
/reports | POST | Logged-in members. object_type (post, comment, member, message), object_id, reason, optional note. |
/moderation/counts, /moderation/queue | GET | Moderators. Each report in a queue item has reporter (the name) and reporter_id (the member’s ID). For an automatic hold or a reporter who no longer exists, reporter is empty and reporter_id is 0. Since 1.3.0 |
/moderation/queue/{type}/{id} | POST | Moderators. action: approve or remove. |
/moderation/members, /moderation/members/{id} | GET, POST | Moderators. List pending or suspended members; POST status: active or blocked. |
/moderation/decisions | GET | Moderators. The log of account decisions (approved, suspended, restored), newest first. Paged; before_id returns the entries older than that log ID. |
/moderators, /moderators/{id} | GET, POST, DELETE | Administrators. |
/admin/setup | GET, POST | Administrators. Setup wizard state and starter spaces. |
/leaderboard | GET | Logged-in members, while the leaderboard is on. period: week, month or all; limit up to 50. |
/me/points | GET | Logged-in members, their own points history. Paged. |
/events | GET, POST | GET: anyone who can open the community; only events in spaces they may read. Filters: space_id, when (upcoming, past, range), from and to (up to 62 days), rsvp=going, type (online or in_person, Since 1.3.0), search (text in the title or description, up to 100 characters, Since 1.3.0), page, per_page. POST: members who may add events in the space. |
/events/{id} | GET, PATCH, DELETE | GET: readers of the space. PATCH and DELETE: the organizer and space moderators. |
/events/{id}/cancel | POST | The organizer and space moderators. |
/events/{id}/rsvp | POST | Members of the space. answer: going, maybe, not_going, or empty to remove it. |
/events/{id}/attendees | GET | Readers of the space. answer: going or maybe. Paged. |
/search | GET | Anyone who can open the community. Parameters: q (2 to 100 characters), type (all, posts, spaces, members), page. |
Community home location Since 1.3.0
Section titled “Community home location Since 1.3.0”The settings route has one new setting and one new read-only field. For what they do, see Community home location.
portal_at_root(boolean, defaultfalse). Opens the community at the home address (the At the home address choice of Community home location).portal_slugholds the page address that is used when it is off. Turning it on while it is off is refused with 400spacebay_portal_root_clash, and nothing is saved, if something else already uses a community address. Sendingtruewhile it is already on is not checked again. The constantSPACEBAY_PORTAL_AT_ROOTand the filterspacebay_portal_at_rootturn the mode on without this check. An import never applies this setting.portal_root_clashes(read-only).GET /settingsreturns it for users withmanage_options: an array of rows withaddress,kind(page,post,rule,archiveorpost_type),source(a page title, a post type label or “Rewrite rule”),edit_url(empty when there is none) anddetail(for a rule its pattern and query, otherwise empty). It is not a setting, is not saved and is not accepted onPOST /settings. It is not part of an export.
The 400 error spacebay_portal_root_clash has data.params set to ["portal_at_root"]. data.pages and data.addresses hold the same list of addresses, each once, for example ["/members/", "/events/"]. data.clashes holds the rows described above, and is an empty array unless the user has manage_options. An address can have several rows.
Import and export Since 1.2.0
Section titled “Import and export Since 1.2.0”These routes serve the Import and export screen. They are internal, so they may change. The caller needs both the WordPress capability manage_options and the SpaceBay capability spacebay_manage. Download, plan, run and undo work only for the person who made the job. The rate limits count managers too. The routes are listed, with what each does, in SpaceBay Exchange Format.
| Endpoint | Method |
|---|---|
/transfers | GET |
/transfers/exports | POST |
/transfers/uploads, /transfers/uploads/{uid}/finish | POST |
/transfers/uploads/{uid}?offset= | PUT |
/transfers/{id} | GET, DELETE |
/transfers/{id}/step, /transfers/{id}/plan, /transfers/{id}/run, /transfers/{id}/undo | POST |
/transfers/{id}/preview, /transfers/{id}/download, /transfers/{id}/remaps | GET |
/transfers/{id}/redirects | GET, DELETE |
/moved | GET. Anyone who can open the community. Where an old address went after an import. |
Endpoints added by SpaceBay Pro Pro
Section titled “Endpoints added by SpaceBay Pro Pro”These endpoints exist only while SpaceBay Pro is active. They use the same /wp-json/spacebay/v1/ base.
| Endpoint | Method | Who |
|---|---|---|
/auth/two-factor, /auth/two-factor/status, /auth/two-factor/send | POST | Visitors in the code step of a login. |
/me/two-factor, /me/two-factor/app, /me/two-factor/email, /me/two-factor/confirm, /me/two-factor/backup-codes | POST, DELETE | Logged-in members, for their own account. Every change except confirm needs the current password. |
/members/{id}/two-factor | DELETE | Administrators who may edit that user. |
/conversations/{id}/calls, /calls/{id}, /calls/{id}/join|decline|leave, /calls/{id}/signals | GET, POST | People invited to the call, while calls are on. |
/profile-fields | GET, PUT | GET: logged-in members. PUT: administrators. |
/members/{id}/badges | POST | Admins and community moderators. badge (key) and on (true to give, false to take away). |
/members/{id}/points | POST | Community managers. points (−10,000 to 10,000, not 0) and an optional note. |
/shop/products, /shop/products/{id}, /shop/featured, /shop/sellers/{id} | GET | Anyone who can open the community, while shops are on. Only published products of open shops; sellers and admins also see their pending and rejected products. |
/shop/me, /shop/request | GET, POST | Logged-in members, for their own shop. |
/shop/products, /shop/products/{id}, /shop/media | POST, DELETE | Sellers with an open shop, for their own products (sellers can delete their own products when the shop is closed), and community managers. |
/shop/admin/summary, /shop/admin/sellers, /shop/admin/sellers/{id}, /shop/admin/products, /shop/admin/products/{id}/review, /shop/admin/products/{id}/placement | GET, POST | Community managers. |