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

# Fine-Grained Token

> Connect Parable to GitHub using fine-grained personal access tokens

export const platform_0 = "GitHub"

export const limit_0 = "5,000 requests/hour for authenticated requests"

export const tokenName_0 = "personal access token"

<Tabs>
  <Tab title="Setup">
    <Card title="What You'll Need" icon="key">
      | Credential | What it is                         |
      | ---------- | ---------------------------------- |
      | **Token**  | Fine-grained personal access token |
      | **Org ID** | Your GitHub organization name      |
    </Card>

    ## Overview

    Connect Parable to GitHub using fine-grained personal access tokens for granular, organization-scoped access to repositories and organization data.

    <CardGroup cols={2}>
      <Card title="Repositories" icon="code-branch">
        Commits, branches, pull requests, issues
      </Card>

      <Card title="Organization" icon="building">
        Members, teams, projects, events
      </Card>
    </CardGroup>

    ## Prerequisites

    * **Admin access** to the GitHub organization
    * A GitHub account that is a **member of the organization** with admin privileges

    ## Setup Guide

    <Steps>
      <Step title="Access Developer Settings">
        1. Log in to <a href="https://github.com" target="_blank" rel="noopener noreferrer">GitHub</a>
        2. Click your profile picture → **Settings**
        3. Scroll to the bottom → **Developer settings**
      </Step>

      <Step title="Create Fine-Grained Token">
        1. Select **Personal access tokens** → **Fine-grained tokens**
        2. Click **Generate new token**
        3. If you have 2FA enabled, enter your code
      </Step>

      <Step title="Configure Token Settings">
        | Setting               | Value                                 |
        | --------------------- | ------------------------------------- |
        | **Token name**        | `Parable GitHub Integration`          |
        | **Description**       | Integration for Parable analytics     |
        | **Resource owner**    | Select your organization              |
        | **Expiration**        | 360 days (recommended)                |
        | **Repository access** | All repositories (or select specific) |
      </Step>

      <Step title="Set Organization Permissions">
        Under **Organization permissions**, set these to **Read**:

        * ✅ Members
        * ✅ Organization administration
        * ✅ Organization events
        * ✅ Organization projects
        * ✅ Team discussions
      </Step>

      <Step title="Set Repository Permissions">
        Under **Repository permissions**, set these to **Read**:

        * ✅ Pull requests
        * ✅ Issues
        * ✅ Discussions
        * ✅ Commit statuses
        * ✅ Contents
        * ✅ Code (if available)
        * ✅ Metadata
      </Step>

      <Step title="Generate and Save">
        1. Click **Generate token**
        2. Copy the token immediately

        <Warning>
          **Copy your {tokenName_0} now!**

          This is the only time it will be displayed. Store it in a secure password manager before closing this page.
        </Warning>
      </Step>

      <Step title="Enter values in the form">
        1. **Token** and **Org ID**: Paste your fine-grained token and GitHub organization name.
        2. Click **Save & test connection**.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Reference">
    ## Verify Your Setup

    <CodeGroup>
      ```bash Verify User theme={null}
      curl -H "Authorization: Bearer YOUR_TOKEN" \
        https://api.github.com/user
      ```

      ```bash Verify Organization Access theme={null}
      curl -H "Authorization: Bearer YOUR_TOKEN" \
        https://api.github.com/orgs/YOUR_ORGANIZATION/members
      ```
    </CodeGroup>

    <Check>
      **Success!** If you received a `200 OK` response with valid data, your credentials are configured correctly. You can now proceed to configure this connector in Parable.
    </Check>

    <Tip>
      **Rate Limits:** {platform_0} enforces rate limits of **{limit_0}**.

      Parable handles rate limiting automatically with exponential backoff, but initial syncs of large datasets may take longer due to these limits.
    </Tip>

    ## Troubleshooting

    | Error                | Meaning                             | Solution                                          |
    | -------------------- | ----------------------------------- | ------------------------------------------------- |
    | **401 Unauthorized** | Invalid or expired token            | Regenerate token                                  |
    | **403 Forbidden**    | Missing permissions                 | Check token has required permissions              |
    | **404 Not Found**    | Resource doesn't exist or no access | Verify organization name and permissions          |
    | **429 Rate Limited** | Rate limit exceeded                 | Wait for reset (check `X-RateLimit-Reset` header) |

    <Accordion title="Common Issues">
      ### Token not working for organization

      Ensure you selected the correct **Resource owner** (organization) when creating the token, not your personal account.

      ### Can't see private repositories

      For private repos, ensure **Repository access** is set to "All repositories" or the specific repos are selected.
    </Accordion>

    ## Additional Resources

    <CardGroup cols={2}>
      <Card title="GitHub REST API" icon="book" href="https://docs.github.com/en/rest">
        Official API documentation
      </Card>

      <Card title="Personal Access Tokens" icon="key" href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token">
        Token creation guide
      </Card>
    </CardGroup>
  </Tab>
</Tabs>
