Skip to content

Community API URL Builders

Mehrdad Pajuhaan edited this page Oct 23, 2026 · 1 revision

Community API URL Builders

window.CAPI is the catalog of community API URL builders defined in apis/CAPI.ts. Each builder returns a full URL (the selldone-capi base URL, for example https://capi.selldone.com, plus a route). Apart from community info and post search, which have typed methods on window.$community, you call these URLs directly with window.axios. This page lists all 60 builders, grouped by area, with request examples taken from the Selldone community UI in Components.

How to use a builder

const { data } = await window.axios.get(window.CAPI.GET_COMMUNITY_FEED(communityId), {
  params: { offset: 0, limit: 10 },
});
if (data.error) throw new Error(data.error_msg);
  • The name prefix (GET_, POST_, PUT_, DELETE_) is the HTTP method used by the Selldone community UI.
  • Responses follow the usual Selldone pattern: on failure the body contains error: true and a displayable error_msg.
  • Routes marked admin are labeled as admin routes in the source and are meant for community owners and moderators.
  • Write actions are made as the user whose Authorization header is set on window.axios.

Community and shop

URL builder Method Route
POST_COMMUNITY_CREATE(shop_id) POST /shops/{shop_id}/community
GET_CHECK_COMMUNITY_NAME_AVAILABLE() GET /community/name
GET_COMMUNITY_INFO(community_id) GET /communities/{community_id}
GET_COMMUNITY_DATA(community_id) GET /communities/{community_id}/data
POST_COMMUNITY_EDIT(community_id) POST /communities/{community_id}
POST_COMMUNITY_BOTS_EDIT(community_id, driver) POST /communities/{community_id}/bots/{driver} (driver: telegram)
POST_COMMUNITY_ANALYTIC(community_id) POST /communities/{community_id}/analytic
POST_COMMUNITY_NOMINATE(community_id) POST /communities/{community_id}/nominate

GET_COMMUNITY_INFO is wrapped by window.$community.getInfo().

Feed, search and profiles

URL builder Method Route
GET_COMMUNITY_FEED(community_id) GET /communities/{community_id}/feed
GET_COMMUNITY_POSTS_SEARCH(community_id) GET /communities/{community_id}/search
GET_COMMUNITY_MY_COMMENTS(community_id) GET /communities/{community_id}/my-comments
GET_COMMUNITY_PROFILE_FULL(user_id) GET /community/profiles/{user_id}
GET_FOLLOWERS_REQUEST(community_id) GET /communities/{community_id}/follower/suggestion
POST_FOLLOW(community_id) POST /communities/{community_id}/followers

GET_COMMUNITY_POSTS_SEARCH is wrapped by window.$community.post.searchPosts().

// Follow or unfollow a member
await window.axios.post(window.CAPI.POST_FOLLOW(communityId), {
  user_id: profile.user_id,
  follow: true,
});

Moderators

URL builder Method Route
GET_COMMUNITY_MODERATORS(community_id) GET /communities/{community_id}/moderators
POST_COMMUNITY_MODERATORS_ADD(community_id) POST /communities/{community_id}/moderators
DELETE_COMMUNITY_MODERATOR(community_id, user_id) DELETE /communities/{community_id}/moderators/{user_id}

Categories

URL builder Method Route
GET_COMMUNITY_CATEGORIES(community_id) GET /communities/{community_id}/categories
POST_COMMUNITY_NEW_CATEGORY(community_id) POST /communities/{community_id}/categories
GET_COMMUNITY_CATEGORY_INFO(community_id, category_id) GET /communities/{community_id}/categories/{category_id}
GET_COMMUNITY_CATEGORY_DATA(community_id, category_id) GET /communities/{community_id}/categories/{category_id}/data
POST_COMMUNITY_EDIT_CATEGORY(community_id, category_id) POST /communities/{community_id}/categories/{category_id}
DELETE_COMMUNITY_EDIT_CATEGORY(community_id, category_id) DELETE /communities/{community_id}/categories/{category_id}
POST_COMMUNITY_RESTORE_CATEGORY(community_id, category_id) POST /communities/{community_id}/categories/{category_id}/restore
GET_COMMUNITY_CATEGORY_TOPICS(community_id, category_id) GET /communities/{community_id}/categories/{category_id}/topics
POST_COMMUNITY_TOPIC_CROSS(community_id) POST /communities/{community_id}/cross
// Topics of a category, newest activity first
const { data } = await window.axios.get(
  window.CAPI.GET_COMMUNITY_CATEGORY_TOPICS(communityId, categoryId),
  { params: { offset: 0, limit: 20, sortBy: "updated_at", sortDesc: true, search: "" } },
);

Topics

URL builder Method Route
GET_COMMUNITY_TOPICS(community_id) GET /communities/{community_id}/topics
POST_COMMUNITY_TOPIC_CREATE(community_id) POST /communities/{community_id}/topics
GET_COMMUNITY_TOPIC_INFO(community_id, topic_id) GET /communities/{community_id}/topics/{topic_id}
GET_COMMUNITY_TOPIC_DATA(community_id, topic_id) GET /communities/{community_id}/topics/{topic_id}/data
GET_COMMUNITY_TOPIC_PREVIEW(community_id, topic_id) GET /communities/{community_id}/topics/{topic_id}/preview
POST_COMMUNITY_TOPIC_EDIT(community_id, topic_id) POST /communities/{community_id}/topics/{topic_id}
DELETE_COMMUNITY_TOPIC(community_id, topic_id) DELETE /communities/{community_id}/topics/{topic_id}
POST_COMMUNITY_TOPIC_RESTORE(community_id, topic_id) POST /communities/{community_id}/topics/{topic_id}/restore
POST_COMMUNITY_TOPIC_NOTIFY(community_id, topic_id) POST /communities/{community_id}/topics/{topic_id}/notify
POST_COMMUNITY_TOPIC_POLL(community_id, topic_id) POST /communities/{community_id}/topics/{topic_id}/poll
GET_COMMUNITY_TOPIC_POSTS(community_id, topic_id) GET /communities/{community_id}/topics/{topic_id}/posts
// Posts of a topic
const { data } = await window.axios.get(
  window.CAPI.GET_COMMUNITY_TOPIC_POSTS(communityId, topicId),
  {
    params: {
      offset: 0,
      limit: 10,
      sortBy: null,
      sortDesc: null,
      search: null,
      // Optional: open the page around a specific post or comment
      post_id: null,
      comment_id: null,
    },
  },
);

// Vote in a topic poll
await window.axios.post(window.CAPI.POST_COMMUNITY_TOPIC_POLL(communityId, topicId), {
  poll: pollItemId,
});

The Components topic page also sends filter and, for moderators, deletes (show deleted posts).

Posts

URL builder Method Route
POST_COMMUNITY_TOPIC_POST_CREATE(community_id, topic_id) POST /communities/{community_id}/topics/{topic_id}/posts
POST_COMMUNITY_TOPIC_POST_EDIT(community_id, topic_id, post_id) POST /communities/{community_id}/topics/{topic_id}/posts/{post_id}
DELETE_COMMUNITY_TOPIC_POST(community_id, topic_id, post_id) DELETE /communities/{community_id}/topics/{topic_id}/posts/{post_id}
POST_COMMUNITY_TOPIC_POST_REACTION(community_id, topic_id, post_id) POST /communities/{community_id}/topics/{topic_id}/posts/{post_id}/reaction
GET_COMMUNITY_TOPIC_POST_REACTIONS(community_id, topic_id, post_id) GET /communities/{community_id}/topics/{topic_id}/posts/{post_id}/reactions
POST_COMMUNITY_TOPIC_POST_SAVE(community_id, topic_id, post_id) POST /communities/{community_id}/topics/{topic_id}/posts/{post_id}/save
POST_COMMUNITY_TOPIC_POST_REPORT(community_id, topic_id, post_id) POST /communities/{community_id}/topics/{topic_id}/posts/{post_id}/report
GET_COMMUNITY_TOPIC_POST_REPORTS(community_id, topic_id, post_id) GET /communities/{community_id}/topics/{topic_id}/posts/{post_id}/reports
POST_COMMUNITY_TOPIC_POST_APPROVED(community_id, topic_id, post_id) POST /communities/{community_id}/topics/{topic_id}/posts/{post_id}/approved
GET_COMMUNITY_POSTS(community_id) GET /communities/{community_id}/posts (admin)
DELETE_COMMUNITY_POST(community_id, post_id) DELETE /communities/{community_id}/posts/{post_id} (admin)
POST_COMMUNITY_POST_RESTORE(community_id, post_id) POST /communities/{community_id}/posts/{post_id}/restore (admin)
POST_COMMUNITY_BAN_USER(community_id, user_id) POST /communities/{community_id}/users/{user_id}/ban (admin)
POST_GENERATE_DOWNLOAD_ATTACHMENT_URL(community_id, post_id, file_id) POST /communities/{community_id}/posts/{post_id}/attachments/{file_id} (returns a temporary download URL)
// React to a post; the response contains the updated post counters and the user's action
const { data } = await window.axios.post(
  window.CAPI.POST_COMMUNITY_TOPIC_POST_REACTION(communityId, topicId, postId),
  { reaction },
);

Comments

URL builder Method Route
GET_COMMUNITY_TOPIC_POST_COMMENTS(community_id, topic_id, post_id) GET /communities/{community_id}/topics/{topic_id}/posts/{post_id}/comments
POST_COMMUNITY_TOPIC_POST_COMMENT_CREATE(community_id, topic_id, post_id) POST /communities/{community_id}/topics/{topic_id}/posts/{post_id}/comments
PUT_COMMUNITY_TOPIC_POST_COMMENT_EDIT(community_id, topic_id, post_id, comment_id) PUT /communities/{community_id}/topics/{topic_id}/posts/{post_id}/comments/{comment_id}
DELETE_COMMUNITY_TOPIC_POST_COMMENT(community_id, topic_id, post_id, comment_id) DELETE /communities/{community_id}/topics/{topic_id}/posts/{post_id}/comments/{comment_id}
POST_COMMUNITY_TOPIC_POST_COMMENT_REACTION(community_id, topic_id, post_id, comment_id) POST /communities/{community_id}/topics/{topic_id}/posts/{post_id}/comments/{comment_id}/reaction
POST_COMMUNITY_TOPIC_POST_COMMENT_REPORT(community_id, topic_id, post_id, comment_id) POST /communities/{community_id}/topics/{topic_id}/posts/{post_id}/comments/{comment_id}/report
GET_COMMUNITY_COMMENT_REPORTS(community_id, comment_id) GET /communities/{community_id}/comments/{comment_id}/reports
GET_COMMUNITY_COMMENTS(community_id) GET /communities/{community_id}/comments (admin)
DELETE_COMMUNITY_COMMENT(community_id, comment_id) DELETE /communities/{community_id}/comments/{comment_id} (admin)
// Comments of a post (pass parent_id to load replies to a comment)
const { data } = await window.axios.get(
  window.CAPI.GET_COMMUNITY_TOPIC_POST_COMMENTS(communityId, topicId, postId),
  { params: { parent_id: null, offset: 0, limit: 10 } },
);

New comments are sent as multipart/form-data with a body field, an optional parent_id (to reply to a comment) and an optional image file:

const form = new FormData();
form.append("body", "Thanks, that solved it!");
// form.append("parent_id", parentCommentId);
// form.append("image", file, file.name);

const { data } = await window.axios.post(
  window.CAPI.POST_COMMUNITY_TOPIC_POST_COMMENT_CREATE(communityId, topicId, postId),
  form,
);

Posting a comment requires a signed-in user.

Related