Skip to content

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.

EndpointMethodWho
/meGETAnyone. Returns the current member or logged_in: false.
/settingsGET, POST, PUTAdministrators.
/auth/loginPOSTVisitors, 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/signupPOSTVisitors, while signing up is on.
/auth/forgot, /auth/resetPOSTVisitors. Forgot always gives the same answer, whether the account exists or not.
/auth/social/{provider}, /auth/social/{provider}/callbackGETVisitors, 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/passwordGET, PUTLogged-in members. Changing the password needs the current one.
/me/statsGETLogged-in members. Their own activity totals: posts, comments, likes received and joined spaces.
/me/pulseGETLogged-in members. Unread messages and notifications, plus what add-ons add (with Pro, calls ringing for them).
/conversations, /conversations/{id}GET, POST, PATCHMembers 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}/readGET, POSTMembers in the conversation. GET takes before, after and limit.
/conversations/{id}/members, /conversations/{id}/members/{user_id}POST, DELETEGroup owner adds and removes people; anyone can remove themselves.
/messages/{id}DELETEThe author, or a moderator.
/messages/recipients, /me/blocksGET, POSTLogged-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/statsGETAdministrators.
/spacesGET, POSTGET: anyone who can open the community (only spaces they may see). POST: administrators.
/spaces/{id}, /spaces/slug/{slug}GET, PATCH, DELETEGET: people who may see the space. PATCH: space admins. DELETE: administrators.
/spaces/{id}/join, /spaces/{id}/leavePOSTLogged-in members.
/spaces/{id}/membersGET, POSTGET 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, DELETESpace admins.
/space-groups, /space-groups/{id}POST, PATCH, DELETEAdministrators.
/spaces/reorder, /space-groups/reorderPOSTAdministrators. Send ids, a list of IDs in the new order.
/members, /members/{id}GETLogged-in members, when the directory is on.
/feedGETAnyone 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.
/postsPOSTMembers who may post in the space.
/posts/{id}GET, PATCH, DELETEGET: readers of the space. PATCH and DELETE: the author and space moderators.
/posts/{id}/like, /bookmark, /pinPOSTLike: space members. Save: logged-in readers. Pin: space moderators.
/posts/{id}/commentsGET, POSTGET: readers of the space. POST: space members.
/comments/{id}, /comments/{id}/likePATCH, DELETE, POSTEdit and delete: the author and space moderators. Like: space members.
/mediaPOSTLogged-in members. One image per request in the file field.
/topics, /topics/{id}GET, POST, PATCH, DELETEGET: anyone who can open the community. Changes: administrators.
/me/profileGET, PATCHLogged-in members, for their own profile.
/me/avatar, /me/coverPOST, DELETELogged-in members. POST one image in the file field.
/me/email-preferencesGET, PUTLogged-in members.
/notifications, /notifications/countGETLogged-in members, for their own notifications. Filter: unread.
/notifications/readPOSTLogged-in members. Send ids or all: true.
/reportsPOSTLogged-in members. object_type (post, comment, member, message), object_id, reason, optional note.
/moderation/counts, /moderation/queueGETModerators. 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}POSTModerators. action: approve or remove.
/moderation/members, /moderation/members/{id}GET, POSTModerators. List pending or suspended members; POST status: active or blocked.
/moderation/decisionsGETModerators. 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, DELETEAdministrators.
/admin/setupGET, POSTAdministrators. Setup wizard state and starter spaces.
/leaderboardGETLogged-in members, while the leaderboard is on. period: week, month or all; limit up to 50.
/me/pointsGETLogged-in members, their own points history. Paged.
/eventsGET, POSTGET: 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, DELETEGET: readers of the space. PATCH and DELETE: the organizer and space moderators.
/events/{id}/cancelPOSTThe organizer and space moderators.
/events/{id}/rsvpPOSTMembers of the space. answer: going, maybe, not_going, or empty to remove it.
/events/{id}/attendeesGETReaders of the space. answer: going or maybe. Paged.
/searchGETAnyone who can open the community. Parameters: q (2 to 100 characters), type (all, posts, spaces, members), page.

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, default false). Opens the community at the home address (the At the home address choice of Community home location). portal_slug holds the page address that is used when it is off. Turning it on while it is off is refused with 400 spacebay_portal_root_clash, and nothing is saved, if something else already uses a community address. Sending true while it is already on is not checked again. The constant SPACEBAY_PORTAL_AT_ROOT and the filter spacebay_portal_at_root turn the mode on without this check. An import never applies this setting.
  • portal_root_clashes (read-only). GET /settings returns it for users with manage_options: an array of rows with address, kind (page, post, rule, archive or post_type), source (a page title, a post type label or “Rewrite rule”), edit_url (empty when there is none) and detail (for a rule its pattern and query, otherwise empty). It is not a setting, is not saved and is not accepted on POST /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.

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.

EndpointMethod
/transfersGET
/transfers/exportsPOST
/transfers/uploads, /transfers/uploads/{uid}/finishPOST
/transfers/uploads/{uid}?offset=PUT
/transfers/{id}GET, DELETE
/transfers/{id}/step, /transfers/{id}/plan, /transfers/{id}/run, /transfers/{id}/undoPOST
/transfers/{id}/preview, /transfers/{id}/download, /transfers/{id}/remapsGET
/transfers/{id}/redirectsGET, DELETE
/movedGET. Anyone who can open the community. Where an old address went after an import.

These endpoints exist only while SpaceBay Pro is active. They use the same /wp-json/spacebay/v1/ base.

EndpointMethodWho
/auth/two-factor, /auth/two-factor/status, /auth/two-factor/sendPOSTVisitors 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-codesPOST, DELETELogged-in members, for their own account. Every change except confirm needs the current password.
/members/{id}/two-factorDELETEAdministrators who may edit that user.
/conversations/{id}/calls, /calls/{id}, /calls/{id}/join|decline|leave, /calls/{id}/signalsGET, POSTPeople invited to the call, while calls are on.
/profile-fieldsGET, PUTGET: logged-in members. PUT: administrators.
/members/{id}/badgesPOSTAdmins and community moderators. badge (key) and on (true to give, false to take away).
/members/{id}/pointsPOSTCommunity managers. points (−10,000 to 10,000, not 0) and an optional note.
/shop/products, /shop/products/{id}, /shop/featured, /shop/sellers/{id}GETAnyone 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/requestGET, POSTLogged-in members, for their own shop.
/shop/products, /shop/products/{id}, /shop/mediaPOST, DELETESellers 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}/placementGET, POSTCommunity managers.