# Stack Exchange on boxd

> Stack Exchange is a network of Q&A communities where users ask questions, share knowledge, and collaborate on topics like coding, math, and more.

- Page: https://boxd.sh/integrations/stack-exchange/
- CLI: `run stack-exchange` (121 commands, 34 marked common)
- SDK: `import { stackExchange } from "@boxd/run"`; every parameter and response type is at `@boxd/run/stack-exchange`
- Triggers: none
- Connect: `run auth stack-exchange` (Sign in with Stack Exchange), or https://app.boxd.sh/integrations/detail/stack_exchange
- All integrations: https://boxd.sh/integrations/ (Markdown: https://boxd.sh/integrations/index.md)

## From the shell

```sh
run auth stack-exchange      # once: prints a link to connect your account
run stack-exchange           # list its commands
run stack-exchange get-sites
```

Parameters are flags (`--flag value`); object and array parameters take a JSON string. Output is YAML, or JSON with `--json`. Calls use your own connection; `--scope <name>` uses a connection shared with your team.

## From a script

```ts
import { every, stackExchange } from "@boxd/run";

every("1 hour", async () => {
  const result = await stackExchange.getSites({});
  console.log(result);
});
```

Run it with `run stack-exchange.run.ts`. Stack Exchange has no triggers; `every()` polls on a schedule, keeps the script running as a job, and wakes the machine when it is due.

## Commands

Required flags are listed; `run stack-exchange <command> --help` lists the optional ones. "common" marks what `run stack-exchange` shows without `--all`.

| Command | SDK method | Required flags | Optional | Description |
|---|---|---|---|---|
| `create-filter` ·common | `stackExchange.createFilter()` | — | 4 | Create a custom filter for Stack Exchange API responses |
| `find-similar-questions` ·common | `stackExchange.findSimilarQuestions()` | `--site` `--title` | 12 | Find questions similar to a hypothetical one based on a title and optional tag combination |
| `get-access-tokens` | `stackExchange.getAccessTokens()` | `--access-tokens` | 4 | Read the properties for a set of access tokens obtained via OAuth 2.0 |
| `get-answer-comments` | `stackExchange.getAnswerComments()` | `--ids` `--site` | 10 | Retrieve comments on a set of answers from Stack Exchange |
| `get-answer-flag-options` | `stackExchange.getAnswerFlagOptions()` | `--id` `--site` | 4 | Fetch valid flag options for a specific answer |
| `get-answers-by-ids` ·common | `stackExchange.getAnswersByIds()` | `--ids` `--site` | 10 | Retrieve a set of answers by their IDs from a Stack Exchange site |
| `get-badge-recipients-by-ids` | `stackExchange.getBadgeRecipientsByIds()` | `--ids` `--site` | 6 | Retrieve recently awarded badges constrained to a specific set of badge IDs |
| `get-badges-by-ids` | `stackExchange.getBadgesByIds()` | `--ids` `--site` | 10 | Retrieve badges by their IDs on a Stack Exchange site |
| `get-collective-answers` | `stackExchange.getCollectiveAnswers()` | `--site` `--slugs` | 9 | Retrieve answers belonging to the specified collective(s) on a Stack Exchange site |
| `get-collective-questions` ·common | `stackExchange.getCollectiveQuestions()` | `--id` `--site` | 9 | Retrieve questions associated with the specified collective |
| `get-collective-tags` ·common | `stackExchange.getCollectiveTags()` | `--collective-slugs` `--site` | 5 | Retrieve tags associated with specified Stack Overflow collectives |
| `get-collective-users` | `stackExchange.getCollectiveUsers()` | `--site` `--slugs` | 8 | Retrieve users who are members of the specified Collectives on Stack Exchange |
| `get-collectives` ·common | `stackExchange.getCollectives()` | `--site` | 8 | Retrieve all collectives on a Stack Exchange site in alphabetical order |
| `get-collectives-by-slugs` | `stackExchange.getCollectivesBySlugs()` | `--site` `--slugs` | 7 | Retrieve Collective objects by their slugs from a Stack Exchange site |
| `get-comment-flag-options` ·common | `stackExchange.getCommentFlagOptions()` | `--ids` `--site` | 4 | Fetch valid flag options for a given comment |
| `get-comments` ·common | `stackExchange.getComments()` | `--site` | 9 | Retrieves comments from a Stack Exchange site (e.g., Stack Overflow, Super User, Server Fault) |
| `get-comments-by-ids` | `stackExchange.getCommentsByIds()` | `--ids` `--site` | 10 | Retrieve specific comments by their IDs from a Stack Exchange site |
| `get-events` | `stackExchange.getEvents()` | `--site` | 5 | Retrieves a stream of recent events that occurred on a Stack Exchange site |
| `get-filters-by-ids` | `stackExchange.getFiltersByIds()` | `--filters` | 0 | Retrieve the fields included by the given filters and the safeness of those filters |
| `get-linked-questions` | `stackExchange.getLinkedQuestions()` | `--ids` `--site` | 10 | Get questions which link to those questions identified in the ids parameter |
| `get-me` ·common | `stackExchange.getMe()` | `--site` | 10 | Retrieve the authenticated user's profile information from Stack Exchange |
| `get-my-achievements` | `stackExchange.getMyAchievements()` | — | 2 | Retrieves the authenticated user's recent network-wide achievements across all Stack Exchange sites |
| `get-my-associated-accounts` | `stackExchange.getMyAssociatedAccounts()` | — | 4 | Retrieve all Stack Exchange accounts associated with the authenticated user |
| `get-my-featured-questions` | `stackExchange.getMyFeaturedQuestions()` | `--site` | 10 | Retrieve questions with active bounties offered by the authenticated user |
| `get-my-mentions` ·common | `stackExchange.getMyMentions()` | `--site` | 10 | Retrieve comments mentioning the authenticated user on a Stack Exchange site |
| `get-my-merge-history` | `stackExchange.getMyMergeHistory()` | — | 4 | Retrieve account merge history for the authenticated user |
| `get-my-network-activity` | `stackExchange.getMyNetworkActivity()` | — | 3 | Retrieve a summary of the authenticated user's activity across the Stack Exchange network |
| `get-my-no-answer-questions` | `stackExchange.getMyNoAnswerQuestions()` | `--site` | 10 | Retrieve questions owned by the authenticated user that have no answers |
| `get-my-posts` ·common | `stackExchange.getMyPosts()` | `--site` | 6 | Retrieve posts (questions and answers) owned by the authenticated user from a Stack Exchange site |
| `get-my-privileges` | `stackExchange.getMyPrivileges()` | `--site` | 4 | Retrieve privileges for the authenticated user on a Stack Exchange site |
| `get-my-questions` ·common | `stackExchange.getMyQuestions()` | `--site` | 10 | Retrieve questions owned by the authenticated user on a Stack Exchange site |
| `get-my-reputation` ·common | `stackExchange.getMyReputation()` | `--site` | 6 | Retrieve reputation changes for the authenticated user on a Stack Exchange site |
| `get-my-reputation-history` | `stackExchange.getMyReputationHistory()` | `--site` | 4 | Retrieve the authenticated user's public reputation history on a Stack Exchange site |
| `get-my-suggested-edits` | `stackExchange.getMySuggestedEdits()` | `--site` | 10 | Retrieve suggested edits submitted by the authenticated user on a Stack Exchange site |
| `get-my-tag-preferences` | `stackExchange.getMyTagPreferences()` | `--site` | 4 | Retrieve tag preferences for the authenticated user on a Stack Exchange site |
| `get-my-tags` | `stackExchange.getMyTags()` | `--site` | 10 | Retrieve tags the authenticated user is active in on a Stack Exchange site |
| `get-my-timeline` | `stackExchange.getMyTimeline()` | `--site` | 6 | Retrieve a timeline of actions the authenticated user has taken on a Stack Exchange site |
| `get-my-top-answer-tags` | `stackExchange.getMyTopAnswerTags()` | `--site` | 4 | Retrieve the authenticated user's top 30 tags by answer score on a Stack Exchange site |
| `get-my-top-answers-in-tags` | `stackExchange.getMyTopAnswersInTags()` | `--site` `--tags` | 10 | Retrieve the top 30 answers the authenticated user has posted in response to questions with specific tags |
| `get-my-top-question-tags` | `stackExchange.getMyTopQuestionTags()` | `--site` | 4 | Retrieve the authenticated user's top 30 tags by question score on a Stack Exchange site |
| `get-my-top-questions-in-tags` | `stackExchange.getMyTopQuestionsInTags()` | `--site` `--tags` | 10 | Retrieve the top 30 questions the authenticated user has posted in response to questions with the given tags |
| `get-my-top-tags` | `stackExchange.getMyTopTags()` | `--site` | 4 | Retrieve the authenticated user's top 30 tags by combined question and answer score on a Stack Exchange site |
| `get-my-unaccepted-questions` | `stackExchange.getMyUnacceptedQuestions()` | `--site` | 10 | Retrieve questions owned by the authenticated user that have no accepted answer |
| `get-my-unanswered-questions` | `stackExchange.getMyUnansweredQuestions()` | `--site` | 10 | Retrieve questions owned by the authenticated user that are not considered answered |
| `get-post-comments` | `stackExchange.getPostComments()` | `--ids` `--site` | 10 | Retrieve comments on posts identified by IDs, regardless of post type (question or answer) |
| `get-post-suggested-edits` | `stackExchange.getPostSuggestedEdits()` | `--ids` `--site` | 10 | Retrieve suggested edits on posts from a Stack Exchange site |
| `get-posts-by-ids` ·common | `stackExchange.getPostsByIds()` | `--ids` `--site` | 10 | Retrieve a set of posts by their IDs from a Stack Exchange site |
| `get-question-answers` ·common | `stackExchange.getQuestionAnswers()` | `--ids` `--site` | 10 | Retrieve all answers for a set of questions identified by their IDs |
| `get-question-close-options` | `stackExchange.getQuestionCloseOptions()` | `--id` `--site` | 4 | Fetch flag options that make up close reasons for a specific question |
| `get-question-comments` ·common | `stackExchange.getQuestionComments()` | `--ids` `--site` | 10 | Retrieve comments on a set of questions from Stack Exchange |
| `get-question-flag-options` | `stackExchange.getQuestionFlagOptions()` | `--id` `--site` | 4 | Fetch valid flag options, including close reasons, for a specific question |
| `get-question-timeline` | `stackExchange.getQuestionTimeline()` | `--ids` `--site` | 6 | Retrieve timeline events for specified questions on a Stack Exchange site |
| `get-questions` ·common | `stackExchange.getQuestions()` | `--site` | 8 | Retrieve a list of questions from a Stack Exchange site without requiring tags or keywords |
| `get-questions-by-answer-ids` | `stackExchange.getQuestionsByAnswerIds()` | `--ids` `--site` | 10 | Retrieve questions that specific answers belong to on a Stack Exchange site |
| `get-questions-by-ids` ·common | `stackExchange.getQuestionsByIds()` | `--ids` `--site` | 10 | Retrieve a set of questions by their IDs from a Stack Exchange site |
| `get-related-tags` | `stackExchange.getRelatedTags()` | `--site` `--tags` | 4 | Retrieve tags most related to the specified tags on a Stack Exchange site |
| `get-revisions-by-ids` ·common | `stackExchange.getRevisionsByIds()` | `--ids` `--site` | 5 | Retrieve revisions for specific posts by their IDs |
| `get-search-results` ·common | `stackExchange.getSearchResults()` | `--site` | 14 | Search the site for questions meeting certain criteria |
| `get-site-info` | `stackExchange.getSiteInfo()` | `--site` | 0 | Retrieve comprehensive statistics and information about a Stack Exchange site |
| `get-sites` ·common | `stackExchange.getSites()` | — | 3 | Retrieves a comprehensive list of all Stack Exchange network sites with detailed information including site names, URLs, styling, and api_site_parameter values needed for other API calls |
| `get-suggested-edits-by-ids` | `stackExchange.getSuggestedEditsByIds()` | `--ids` `--site` | 10 | Retrieve suggested edits by their IDs from a Stack Exchange site |
| `get-tag-faq` | `stackExchange.getTagFaq()` | `--site` `--tags` | 4 | Retrieve frequently asked questions for a set of tags on Stack Exchange |
| `get-tag-info` ·common | `stackExchange.getTagInfo()` | `--site` `--tags` | 10 | Retrieve tag objects representing specified tags on a Stack Exchange site |
| `get-tag-synonyms` | `stackExchange.getTagSynonyms()` | `--site` `--tags` | 10 | Retrieve all synonyms that point to the specified tags on a Stack Exchange site |
| `get-tag-top-answerers` | `stackExchange.getTagTopAnswerers()` | `--period` `--site` `--tag` | 4 | Retrieve the top 30 answerers active in a single tag, of either all-time or the last 30 days |
| `get-tag-top-askers` | `stackExchange.getTagTopAskers()` | `--period` `--site` `--tag` | 4 | Retrieve the top askers active in a single tag |
| `get-tag-wikis` | `stackExchange.getTagWikis()` | `--site` `--tags` | 4 | Retrieve wiki content for specified tags on a Stack Exchange site |
| `get-user-answers` | `stackExchange.getUserAnswers()` | `--ids` `--site` | 10 | Retrieve answers posted by specific users on a Stack Exchange site |
| `get-user-associated-accounts` | `stackExchange.getUserAssociatedAccounts()` | `--ids` | 4 | Retrieve all Stack Exchange accounts associated with specified users by their account IDs |
| `get-user-badges` | `stackExchange.getUserBadges()` | `--ids` `--site` | 10 | Retrieve badges earned by specified users on a Stack Exchange site |
| `get-user-comments` | `stackExchange.getUserComments()` | `--ids` `--site` | 10 | Retrieve comments posted by specified users on a Stack Exchange site |
| `get-user-comments-to-user` | `stackExchange.getUserCommentsToUser()` | `--ids` `--site` `--toid` | 10 | Retrieve comments that specific users have posted in reply to a single user |
| `get-user-favorites` | `stackExchange.getUserFavorites()` | `--ids` `--site` | 10 | Retrieve the questions that users have favorited/bookmarked |
| `get-user-featured-questions` | `stackExchange.getUserFeaturedQuestions()` | `--ids` `--site` | 10 | Retrieve questions with active bounties offered by specified users |
| `get-user-full-reputation-history` | `stackExchange.getUserFullReputationHistory()` | `--id` `--site` | 4 | Retrieve a user's full reputation history on a Stack Exchange site, including private events |
| `get-user-inbox` | `stackExchange.getUserInbox()` | `--id` `--site` | 4 | Retrieve a user's inbox from Stack Exchange |
| `get-user-mentions` | `stackExchange.getUserMentions()` | `--ids` `--site` | 10 | Retrieve comments that mention specific users on a Stack Exchange site |
| `get-user-merge-history` | `stackExchange.getUserMergeHistory()` | `--ids` | 4 | Retrieve account merge history for specified user account IDs across the Stack Exchange network |
| `get-user-no-answer-questions` | `stackExchange.getUserNoAnswerQuestions()` | `--ids` `--site` | 10 | Retrieve questions asked by specified users that have zero undeleted answers |
| `get-user-notifications` | `stackExchange.getUserNotifications()` | `--id` `--site` | 4 | Retrieve notifications for a specific Stack Exchange user by ID |
| `get-user-posts` | `stackExchange.getUserPosts()` | `--ids` `--site` | 6 | Retrieve posts (questions and answers) posted by specific users on a Stack Exchange site |
| `get-user-privileges` | `stackExchange.getUserPrivileges()` | `--id` `--site` | 4 | Retrieve privileges a specific user has on a Stack Exchange site |
| `get-user-questions` | `stackExchange.getUserQuestions()` | `--ids` `--site` | 10 | Retrieve questions asked by specific users on a Stack Exchange site |
| `get-user-reputation` | `stackExchange.getUserReputation()` | `--ids` `--site` | 6 | Retrieve reputation changes for users on a Stack Exchange site |
| `get-user-reputation-history` | `stackExchange.getUserReputationHistory()` | `--ids` `--site` | 4 | Retrieve public reputation history for specified Stack Exchange users |
| `get-user-suggested-edits` | `stackExchange.getUserSuggestedEdits()` | `--ids` `--site` | 10 | Retrieve suggested edits submitted by specified users on a Stack Exchange site |
| `get-user-tags` | `stackExchange.getUserTags()` | `--ids` `--site` | 10 | Retrieve tags that specified users are active in on a Stack Exchange site |
| `get-user-timeline` | `stackExchange.getUserTimeline()` | `--ids` `--site` | 6 | Retrieve a timeline of actions taken by specified users on a Stack Exchange site |
| `get-user-top-answer-tags` | `stackExchange.getUserTopAnswerTags()` | `--id` `--site` | 4 | Retrieve a single user's top tags by answer score on Stack Exchange |
| `get-user-top-answers-in-tags` | `stackExchange.getUserTopAnswersInTags()` | `--id` `--site` `--tags` | 10 | Retrieve the top 30 answers a specific user has posted in response to questions with given tags |
| `get-user-top-question-tags` | `stackExchange.getUserTopQuestionTags()` | `--id` `--site` | 4 | Retrieve a single user's top tags by question score on a Stack Exchange site |
| `get-user-top-questions-in-tags` | `stackExchange.getUserTopQuestionsInTags()` | `--id` `--site` `--tags` | 10 | Retrieve the top 30 questions a user has asked with the given tags |
| `get-user-top-tags` | `stackExchange.getUserTopTags()` | `--id` `--site` | 4 | Retrieve a single user's top tags by combined question and answer score on a Stack Exchange site |
| `get-user-unaccepted-questions` | `stackExchange.getUserUnacceptedQuestions()` | `--ids` `--site` | 10 | Retrieve questions asked by specified users that have at least one answer but no accepted answer |
| `get-user-unanswered-questions` | `stackExchange.getUserUnansweredQuestions()` | `--ids` `--site` | 10 | Retrieve questions asked by specific users that the site considers unanswered |
| `get-user-unread-inbox` | `stackExchange.getUserUnreadInbox()` | `--id` `--site` | 5 | Retrieve unread items in a specific user's Stack Exchange inbox |
| `get-user-unread-notifications` | `stackExchange.getUserUnreadNotifications()` | `--id` `--site` | 4 | Retrieve unread notifications for a specific user on Stack Exchange |
| `get-users-by-ids` ·common | `stackExchange.getUsersByIds()` | `--ids` `--site` | 10 | Retrieve user profiles by their IDs from a Stack Exchange site |
| `list-answers` ·common | `stackExchange.listAnswers()` | `--site` | 10 | Retrieve all undeleted answers from a Stack Exchange site |
| `list-badge-recipients` | `stackExchange.listBadgeRecipients()` | `--site` | 6 | Retrieve recently awarded badges from a Stack Exchange site |
| `list-badges` ·common | `stackExchange.listBadges()` | `--site` | 10 | Retrieve all badges available in a Stack Exchange site |
| `list-elected-moderators` | `stackExchange.listElectedModerators()` | `--site` | 10 | Retrieve users who have moderator powers and were actually elected on a Stack Exchange site |
| `list-errors` | `stackExchange.listErrors()` | — | 4 | Retrieve the various error codes that can be produced by the Stack Exchange API |
| `list-featured-questions` ·common | `stackExchange.listFeaturedQuestions()` | `--site` | 11 | Retrieve all questions with active bounties in the system |
| `list-moderator-only-tags` | `stackExchange.listModeratorOnlyTags()` | `--site` | 11 | Retrieve tags that only moderators can use on a Stack Exchange site |
| `list-moderators` | `stackExchange.listModerators()` | `--site` | 10 | Retrieve users who can exercise moderation powers on a Stack Exchange site |
| `list-named-badges` | `stackExchange.listNamedBadges()` | `--site` | 11 | Retrieve all explicitly named badges from a Stack Exchange site |
| `list-no-answer-questions` ·common | `stackExchange.listNoAnswerQuestions()` | `--site` | 11 | Retrieve questions that have received no answers from a Stack Exchange site |
| `list-posts` | `stackExchange.listPosts()` | `--site` | 10 | Retrieve all posts (questions and answers) from a Stack Exchange site |
| `list-privileges` | `stackExchange.listPrivileges()` | `--site` | 4 | Retrieve all earnable privileges on a Stack Exchange site |
| `list-required-tags` | `stackExchange.listRequiredTags()` | `--site` | 11 | Retrieve tags found on a site that fulfill required tag constraints on questions |
| `list-suggested-edits` | `stackExchange.listSuggestedEdits()` | `--site` | 10 | Retrieve all suggested edits in a Stack Exchange site |
| `list-tag-badges` | `stackExchange.listTagBadges()` | `--site` | 11 | Returns badges awarded for participation in specific tags on Stack Exchange sites |
| `list-tag-synonyms` | `stackExchange.listTagSynonyms()` | `--site` | 10 | Retrieve all tag synonyms found on a Stack Exchange site |
| `list-tags` ·common | `stackExchange.listTags()` | `--site` | 11 | Retrieve tags found on a Stack Exchange site |
| `list-unanswered-questions` ·common | `stackExchange.listUnansweredQuestions()` | `--site` | 11 | Retrieve questions the site considers to be unanswered |
| `list-unanswered-questions-my-tags` ·common | `stackExchange.listUnansweredQuestionsMyTags()` | `--site` | 10 | Retrieve unanswered questions within the authenticated user's favorite or frequented tags |
| `list-users` ·common | `stackExchange.listUsers()` | `--site` | 11 | Retrieve all users on a Stack Exchange site |
| `render-answer` ·common | `stackExchange.renderAnswer()` | `--body` `--id` `--site` | 2 | Render a preview of an answer given its body and the question it's on |
| `search-advanced` ·common | `stackExchange.searchAdvanced()` | `--site` | 26 | Search a Stack Exchange site for questions matching advanced criteria |
| `search-excerpts` ·common | `stackExchange.searchExcerpts()` | `--site` | 23 | Search a Stack Exchange site for items matching given criteria with excerpt snippets |

## Docs

- [run CLI](https://docs.boxd.sh/cli/run): Call connected integrations from the shell, connect new ones, and run automations.
- [Quickstart](https://docs.boxd.sh/guides/integrations/quickstart): Connect an integration, call it from the shell, and turn a script into an automation.
- [Connections](https://docs.boxd.sh/guides/integrations/connections): Connect an account once, for yourself or for your whole organization.
- [Scripts](https://docs.boxd.sh/guides/automations/scripts): Typed integrations, triggers, schedules and state in a .run.ts file.
- [Jobs](https://docs.boxd.sh/guides/automations/jobs): How a script becomes a background job: states, retries, sleep and wake.
- [Beyond the catalog](https://docs.boxd.sh/guides/automations/beyond-the-catalog): Reach your own APIs, databases and cloud accounts from a script.
