Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Stack Exchange

Scalekit connector
Open markdown

The Stack Exchange connector lets your AI agent act in each user's Stack Exchange account. Each user signs in to Stack Exchange once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 113 tools.

Tools
113
What they doRead · write · destructive
90 · 20 · 390 read20 write3 destructive
Users sign in with
OAuth app
Your own Stack Exchange app

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Stack Exchange connection

    In AgentKit > Connections, create a Stack Exchange connection and copy its redirect URI. The name you give it is the connection_name your code passes. See Configure connections.

  4. Register an OAuth app

    Stack Exchange connections use your own OAuth app. Register one with Stack Exchange and add the redirect URI you copied.

    Then enter the app's Client ID and Client Secret on the Stack Exchange connection.

  5. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'stackexchange'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Stack Exchange:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'stackexchange_filter_create',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user signs in once. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • stackexchange_answer_comments_listList the comments posted on one or more answers.Read-only

    List Answer Comments

    List the comments posted on one or more answers. Returns comment_id, post_id, score, owner and creation_date; pass filter=withbody to include the comment text. Use this for comments on answers. Use stackexchange_question_comments_list for comments on questions.

    Inputs

    answer_idsstringrequired
    Semicolon-separated answer IDs, up to 100, e.g. 11227809;927358.
    sitestringrequired
    Stack Exchange site to use, as its api_site_parameter (for example stackoverflow, superuser, serverfault, askubuntu, math) or full domain (stackoverflow.com). Get the values from stackexchange_sites_list.
    filterstring
    Response filter: a built-in name (default, withbody to add body fields, none, total for just the count) or a custom filter id from stackexchange_filter_create. Leave empty for the default filter.
    fromdateinteger
    Only include items dated on or after this time, as Unix epoch seconds, e.g. 1704067200 for 2024-01-01.
    maxstring
    Upper bound for the chosen sort field, inclusive: Unix epoch seconds or a number depending on the sort (see sort). Ignored by sorts without min/max.
    minstring
    Lower bound for the chosen sort field, inclusive: Unix epoch seconds or a number depending on the sort (see sort). Ignored by sorts without min/max.
    orderstring
    Sort direction: desc (default) or asc.one of descasc
    pageinteger
    Page of results to return, starting at 1 (default 1). The response's has_more tells you whether another page exists.
    pagesizeinteger
    Number of items per page, 0 to 100 (default 30).
    sortstring
    Field to sort by (default creation): creation (creation date; min/max are Unix epoch seconds), votes (score; min/max are a number).one of creationvotes
    todateinteger
    Only include items dated on or before this time, as Unix epoch seconds, e.g. 1735689599 for 2024-12-31.
  • stackexchange_answer_questions_listGet the questions that one or more answers belong to.Read-only

    List Questions For Answers

    Get the questions that one or more answers belong to. Returns question_id, title, tags, score and link for each parent question. Use this to go from answer IDs to their questions.

    Inputs

    answer_idsstringrequired
    Semicolon-separated answer IDs, up to 100, e.g. 11227809;927358.
    sitestringrequired
    Stack Exchange site to use, as its api_site_parameter (for example stackoverflow, superuser, serverfault, askubuntu, math) or full domain (stackoverflow.com). Get the values from stackexchange_sites_list.
    filterstring
    Response filter: a built-in name (default, withbody to add body fields, none, total for just the count) or a custom filter id from stackexchange_filter_create. Leave empty for the default filter.
    fromdateinteger
    Only include items dated on or after this time, as Unix epoch seconds, e.g. 1704067200 for 2024-01-01.
    maxstring
    Upper bound for the chosen sort field, inclusive: Unix epoch seconds or a number depending on the sort (see sort). Ignored by sorts without min/max.
    minstring
    Lower bound for the chosen sort field, inclusive: Unix epoch seconds or a number depending on the sort (see sort). Ignored by sorts without min/max.
    orderstring
    Sort direction: desc (default) or asc.one of descasc
    pageinteger
    Page of results to return, starting at 1 (default 1). The response's has_more tells you whether another page exists.
    pagesizeinteger
    Number of items per page, 0 to 100 (default 30).
    sortstring
    Field to sort by (default activity): activity (last activity date; min/max are Unix epoch seconds), votes (score; min/max are a number), creation (creation date; min/max are Unix epoch seconds).one of activityvotescreation
    todateinteger
    Only include items dated on or before this time, as Unix epoch seconds, e.g. 1735689599 for 2024-12-31.
  • stackexchange_answers_getGet one or more answers by ID.Read-only

    Get Answers

    Get one or more answers by ID. Returns answer_id, question_id, score, is_accepted and owner; pass filter=withbody to include the body. Use stackexchange_answers_get when you already have answer IDs. Use stackexchange_question_answers_list to read every answer on a question.

    Inputs

    answer_idsstringrequired
    Semicolon-separated answer IDs, up to 100, e.g. 11227809;927358.
    sitestringrequired
    Stack Exchange site to use, as its api_site_parameter (for example stackoverflow, superuser, serverfault, askubuntu, math) or full domain (stackoverflow.com). Get the values from stackexchange_sites_list.
    filterstring
    Response filter: a built-in name (default, withbody to add body fields, none, total for just the count) or a custom filter id from stackexchange_filter_create. Leave empty for the default filter.
    fromdateinteger
    Only include items dated on or after this time, as Unix epoch seconds, e.g. 1704067200 for 2024-01-01.
    maxstring
    Upper bound for the chosen sort field, inclusive: Unix epoch seconds or a number depending on the sort (see sort). Ignored by sorts without min/max.
    minstring
    Lower bound for the chosen sort field, inclusive: Unix epoch seconds or a number depending on the sort (see sort). Ignored by sorts without min/max.
    orderstring
    Sort direction: desc (default) or asc.one of descasc
    pageinteger
    Page of results to return, starting at 1 (default 1). The response's has_more tells you whether another page exists.
    pagesizeinteger
    Number of items per page, 0 to 100 (default 30).
    sortstring
    Field to sort by (default activity): activity (last activity date; min/max are Unix epoch seconds), creation (creation date; min/max are Unix epoch seconds), votes (score; min/max are a number).one of activitycreationvotes
    todateinteger
    Only include items dated on or before this time, as Unix epoch seconds, e.g. 1735689599 for 2024-12-31.
  • stackexchange_answers_listList answers posted on a site, newest activity first by default.Read-only

    List Answers

    List answers posted on a site, newest activity first by default. Returns answer_id, question_id, score, is_accepted and owner. Use stackexchange_answers_list to browse recent or top answers across a site. Use stackexchange_question_answers_list for one question's answers.

    Inputs

    sitestringrequired
    Stack Exchange site to use, as its api_site_parameter (for example stackoverflow, superuser, serverfault, askubuntu, math) or full domain (stackoverflow.com). Get the values from stackexchange_sites_list.
    filterstring
    Response filter: a built-in name (default, withbody to add body fields, none, total for just the count) or a custom filter id from stackexchange_filter_create. Leave empty for the default filter.
    fromdateinteger
    Only include items dated on or after this time, as Unix epoch seconds, e.g. 1704067200 for 2024-01-01.
    maxstring
    Upper bound for the chosen sort field, inclusive: Unix epoch seconds or a number depending on the sort (see sort). Ignored by sorts without min/max.
    minstring
    Lower bound for the chosen sort field, inclusive: Unix epoch seconds or a number depending on the sort (see sort). Ignored by sorts without min/max.
    orderstring
    Sort direction: desc (default) or asc.one of descasc
    pageinteger
    Page of results to return, starting at 1 (default 1). The response's has_more tells you whether another page exists.
    pagesizeinteger
    Number of items per page, 0 to 100 (default 30).
    sortstring
    Field to sort by (default activity): activity (last activity date; min/max are Unix epoch seconds), creation (creation date; min/max are Unix epoch seconds), votes (score; min/max are a number).one of activitycreationvotes
    todateinteger
    Only include items dated on or before this time, as Unix epoch seconds, e.g. 1735689599 for 2024-12-31.
  • stackexchange_badge_recipients_listList recent recipients of one or more badges.Read-only

    List Badge Recipients

    List recent recipients of one or more badges. Returns badge_id, name, rank and user for each award. Use this for specific badges. Use stackexchange_badges_recent_recipients_list for every recent award on a site.

    Inputs

    badge_idsstringrequired
    Semicolon-separated badge IDs, up to 100, e.g. 11227809;927358.
    sitestringrequired
    Stack Exchange site to use, as its api_site_parameter (for example stackoverflow, superuser, serverfault, askubuntu, math) or full domain (stackoverflow.com). Get the values from stackexchange_sites_list.
    filterstring
    Response filter: a built-in name (default, withbody to add body fields, none, total for just the count) or a custom filter id from stackexchange_filter_create. Leave empty for the default filter.
    fromdateinteger
    Only include items dated on or after this time, as Unix epoch seconds, e.g. 1704067200 for 2024-01-01.
    pageinteger
    Page of results to return, starting at 1 (default 1). The response's has_more tells you whether another page exists.
    pagesizeinteger
    Number of items per page, 0 to 100 (default 30).
    todateinteger
    Only include items dated on or before this time, as Unix epoch seconds, e.g. 1735689599 for 2024-12-31.
  • stackexchange_badges_getGet one or more badges by ID.Read-only

    Get Badges

    Get one or more badges by ID. Returns badge_id, name, badge_type, rank and award_count; pass filter=withbody for descriptions. Use stackexchange_badges_get when you already have badge IDs.

    Inputs

    badge_idsstringrequired
    Semicolon-separated badge IDs, up to 100, e.g. 11227809;927358.
    sitestringrequired
    Stack Exchange site to use, as its api_site_parameter (for example stackoverflow, superuser, serverfault, askubuntu, math) or full domain (stackoverflow.com). Get the values from stackexchange_sites_list.
    filterstring
    Response filter: a built-in name (default, withbody to add body fields, none, total for just the count) or a custom filter id from stackexchange_filter_create. Leave empty for the default filter.
    fromdateinteger
    Only include items dated on or after this time, as Unix epoch seconds, e.g. 1704067200 for 2024-01-01.
    maxstring
    Upper bound for the chosen sort field, inclusive. With sort=rank use gold, silver or bronze (e.g. max=gold for gold badges only); with sort=type use named or tag_based; with sort=name use text.
    minstring
    Lower bound for the chosen sort field, inclusive. With sort=rank use gold, silver or bronze (e.g. max=gold for gold badges only); with sort=type use named or tag_based; with sort=name use text.
    orderstring
    Sort direction: desc (default) or asc.one of descasc
    pageinteger
    Page of results to return, starting at 1 (default 1). The response's has_more tells you whether another page exists.
    pagesizeinteger
    Number of items per page, 0 to 100 (default 30).
    sortstring
    Field to sort by (default rank): rank (badge rank; min/max are gold, silver or bronze (bronze sorts highest)), name (name; min/max are text), type (badge type; min/max are named or tag_based (tag_based sorts highest)).one of ranknametype
    todateinteger
    Only include items dated on or before this time, as Unix epoch seconds, e.g. 1735689599 for 2024-12-31.
  • stackexchange_badges_listList all badges on a site, optionally filtered to names containing a substring.Read-only

    List Badges

    List all badges on a site, optionally filtered to names containing a substring. Returns badge_id, name, badge_type (named or tag_based), rank (gold, silver, bronze) and award_count. Use stackexchange_badges_list to browse or look up badges. Use stackexchange_badges_get when you have badge IDs.

    Inputs

    sitestringrequired
    Stack Exchange site to use, as its api_site_parameter (for example stackoverflow, superuser, serverfault, askubuntu, math) or full domain (stackoverflow.com). Get the values from stackexchange_sites_list.
    filterstring
    Response filter: a built-in name (default, withbody to add body fields, none, total for just the count) or a custom filter id from stackexchange_filter_create. Leave empty for the default filter.
    fromdateinteger
    Only include items dated on or after this time, as Unix epoch seconds, e.g. 1704067200 for 2024-01-01.
    innamestring
    Only return items whose name contains this text.
    maxstring
    Upper bound for the chosen sort field, inclusive. With sort=rank use gold, silver or bronze (e.g. max=gold for gold badges only); with sort=type use named or tag_based; with sort=name use text.
    minstring
    Lower bound for the chosen sort field, inclusive. With sort=rank use gold, silver or bronze (e.g. max=gold for gold badges only); with sort=type use named or tag_based; with sort=name use text.
    orderstring
    Sort direction: desc (default) or asc.one of descasc
    pageinteger
    Page of results to return, starting at 1 (default 1). The response's has_more tells you whether another page exists.
    pagesizeinteger
    Number of items per page, 0 to 100 (default 30).
    sortstring
    Field to sort by (default rank): rank (badge rank; min/max are gold, silver or bronze (bronze sorts highest)), name (name; min/max are text), type (badge type; min/max are named or tag_based (tag_based sorts highest)).one of ranknametype
    todateinteger
    Only include items dated on or before this time, as Unix epoch seconds, e.g. 1735689599 for 2024-12-31.
  • stackexchange_badges_recent_recipients_listList badges recently awarded on a site.Read-only

    List Recent Badge Awards

    List badges recently awarded on a site. Returns badge_id, name, rank and the user who earned it. Use this for a site-wide award feed. Use stackexchange_badge_recipients_list for specific badges.

    Inputs

    sitestringrequired
    Stack Exchange site to use, as its api_site_parameter (for example stackoverflow, superuser, serverfault, askubuntu, math) or full domain (stackoverflow.com). Get the values from stackexchange_sites_list.
    filterstring
    Response filter: a built-in name (default, withbody to add body fields, none, total for just the count) or a custom filter id from stackexchange_filter_create. Leave empty for the default filter.
    fromdateinteger
    Only include items dated on or after this time, as Unix epoch seconds, e.g. 1704067200 for 2024-01-01.
    pageinteger
    Page of results to return, starting at 1 (default 1). The response's has_more tells you whether another page exists.
    pagesizeinteger
    Number of items per page, 0 to 100 (default 30).
    todateinteger
    Only include items dated on or before this time, as Unix epoch seconds, e.g. 1735689599 for 2024-12-31.