> ## 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 OpenAI with API Key (Admin + User) – StackOne Hub

> Link a OpenAI account in the StackOne Hub using API Key (Admin + User). End-user guide to authorize the integration and start using OpenAI actions.

<Warning>Keep your API keys secure. Never share them publicly or commit them to version control. Rotate keys regularly for enhanced security.</Warning>

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

  <p>Standard API keys provide access to most OpenAI API features including models, completions, embeddings, and more.</p>

  <Steps>
    <Step title="Access API Keys Page">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>1. Log in to your OpenAI account at <a href="https://platform.openai.com" target="_blank" rel="noopener noreferrer">[https://platform.openai.com](https://platform.openai.com)</a><br />2. Click "API keys" in the left sidebar<br />3. Or directly visit <a href="https://platform.openai.com/api-keys" target="_blank" rel="noopener noreferrer">[https://platform.openai.com/api-keys](https://platform.openai.com/api-keys)</a></p>
      </div>
    </Step>

    <Step title="Create a New API Key">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Click the "Create new secret key" button to generate a new API key. The dialog shows fields in this order: Name, Project, Permissions.</p>

        <ul>
          <li>Enter a descriptive name (e.g., "StackOne Integration")</li>
          <li>Select a Project (required — the Create button stays disabled until a project is selected)</li>
          <li>Select permissions: Choose 'All' for full access or customize based on your needs</li>
          <li>Click "Create secret key"</li>
        </ul>
      </div>
    </Step>

    <Step title="Save Your API Key">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>IMPORTANT: Copy the key immediately after creation. It will only be shown once and cannot be retrieved later.</p>

        <ul>
          <li>Store the key in a secure password manager</li>
          <li>Never expose it in client-side code or public repositories</li>
          <li>Use environment variables for application deployment</li>
        </ul>
      </div>
    </Step>
  </Steps>
</section>

<section data-guide-section data-guide-scopes="">
  <h2>Generate an Admin API Key (Optional)</h2>

  <p>Admin API keys are required for organization and project management actions. Only organization owners and admins can create these keys. They are created from a separate Admin keys page (not the standard API keys page).</p>

  <Steps>
    <Step title="Verify Admin Permissions">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Ensure you have admin or owner role in your organization. You can check this in Organization settings → People (accessible via the bottom-left user menu — the section was previously called "Team").</p>
      </div>
    </Step>

    <Step title="Access Admin Keys Page">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>1. Click your profile icon in the bottom-left menu and choose "Organization settings" (or "Profile settings")<br />2. Click "Admin keys" in the left sidebar</p>
      </div>
    </Step>

    <Step title="Create Admin API Key">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Click the "+ Create new Admin key" button. The dialog has fields: Name, Expiration, and Permissions (no Project dropdown).</p>

        <ul>
          <li>The key must be created by an organization admin or owner</li>
          <li>Enter an optional Name (e.g., "StackOne Admin Integration")</li>
          <li>Choose an Expiration (dropdown, default 'Never')</li>
          <li>Select Permissions: 'All', 'Restricted', or 'Read only' — include organization management permissions</li>
          <li>Click "Create admin key"</li>
          <li>This key will have elevated privileges - handle with extra care</li>
        </ul>
      </div>
    </Step>
  </Steps>
</section>

<section data-guide-section data-guide-scopes="">
  <h2>API Key Best Practices</h2>

  <p>Follow these security best practices to protect your API keys.</p>

  <Steps>
    <Step title="Security Recommendations">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Implement these security measures to protect your API keys.</p>

        <ul>
          <li>Scope each key to a specific Project to limit blast radius if a key is compromised</li>
          <li>Create separate keys for different applications or environments</li>
          <li>Set expiration dates on keys and rotate them regularly</li>
          <li>Monitor API key usage in the Usage dashboard</li>
          <li>Immediately revoke compromised keys</li>
        </ul>
      </div>
    </Step>

    <Step title="Rate Limits and Usage">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Be aware of rate limits and monitor your usage to avoid service interruptions.</p>

        <ul>
          <li>Check current rate limits at [https://platform.openai.com/settings/organization/limits](https://platform.openai.com/settings/organization/limits)</li>
          <li>Monitor usage at [https://platform.openai.com/usage](https://platform.openai.com/usage)</li>
          <li>Consider implementing retry logic with exponential backoff</li>
          <li>Use the most appropriate model for your use case to optimize costs</li>
        </ul>
      </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>API Key</strong></li>
        <li><strong>Admin API Key</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>
