> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Discourse with API Key – StackOne Hub

> Link a Discourse account in the StackOne Hub using API Key. End-user guide to authorize the integration and start using Discourse actions.

<Warning>API keys grant access to your Discourse instance. Keep them secure and never share them publicly.</Warning>

<section data-guide-section data-guide-scopes="">
  <h2>Find Your Discourse Domain</h2>

  <p>Your Discourse domain is the base URL of your Discourse instance (e.g., community.example.com).</p>

  <Steps>
    <Step title="Identify your domain">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Log in to your Discourse instance and copy the domain directly from your browser's address bar (e.g., `stackone-sandbox-pro.discourse.group`). Do not include `https://` or a trailing slash.</p>
      </div>
    </Step>
  </Steps>
</section>

<section data-guide-section data-guide-scopes="">
  <h2>Generate an API Key</h2>

  <p>Create an API key from the Discourse admin panel to authenticate API requests.</p>

  <Steps>
    <Step title="Navigate to API Keys">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Log in as an admin, click <strong>Admin</strong> in the left sidebar, then go to <strong>Advanced > API keys</strong> (or navigate to `/admin/api/keys`).</p>
      </div>
    </Step>

    <Step title="Create a new key">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Click <strong>Add API key</strong>.</p>

        <ul>
          <li>Set a <strong>Description</strong> (e.g., "StackOne Integration").</li>
          <li>Set <strong>User Level</strong> to <strong>All Users</strong> for global access, or select a specific user.</li>
          <li>Set <strong>Scope</strong> to <strong>Global</strong> to allow full access to all API endpoints.</li>
          <li>Click <strong>Save</strong> to generate the key.</li>
        </ul>
      </div>
    </Step>

    <Step title="Copy the API Key">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Copy the generated API key and store it securely. It will not be shown again.</p>
      </div>
    </Step>
  </Steps>
</section>

<section data-guide-section data-guide-scopes="">
  <h2>Determine the API Username</h2>

  <p>The Api-Username header identifies which user the API requests are made on behalf of.</p>

  <Steps>
    <Step title="Choose a username">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Use your admin username — this is displayed in the welcome message on your Discourse homepage (e.g., `john_admin`). You can also use `system` for system-level admin access. The user must have permission for the actions you intend to perform.</p>
      </div>
    </Step>
  </Steps>
</section>

<div data-whitelabel-hide>
  <h2>Linking the Account from the Hub</h2>

  <Steps>
    <Step title="Navigate to the Hub">
      Use one of the three <a href="/guides/accounts-section#linking-accounts">Linking Account Methods</a> to access the Hub.
    </Step>

    <Step title="Fill out the fields">
      Fill out the following fields using details from your provider:

      <ul>
        <li><strong>Domain</strong></li>
        <li><strong>API Key</strong></li>
        <li><strong>API Username</strong></li>
      </ul>
    </Step>

    <Step title="Connect">
      <ul>
        <li>Click <strong>Connect</strong></li>
        <li>If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider's authorization flow.</li>
        <li>Once authorization is successful, you will see a confirmation popup</li>
      </ul>
    </Step>
  </Steps>

  <p>If the account linking is successful, you will see the newly linked account in your <a href="/guides/accounts-section">Accounts</a> page.</p>
</div>
