✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more
Andrii Bidochko
  • Updated: January 18, 2026
  • 7 min read

Understanding GitHub IDs: Node vs Database IDs Explained

GitHub IDs are composed of two parallel identifier systems—a globally unique Base64‑encoded node ID and a simple integer database ID—each serving different API layers and URL constructions.

Understanding GitHub IDs: Node IDs vs. Database IDs, Decoding Techniques, and Real‑World Use Cases

GitHub IDs illustration
A visual breakdown of modern GitHub node IDs and their underlying components.

Why GitHub IDs Matter for Developers

Every software developer, DevOps engineer, or tech enthusiast who integrates with GitHub’s REST or GraphQL APIs must grapple with two distinct identifier formats. Misunderstanding these IDs can lead to broken links, failed migrations, and wasted engineering hours. By mastering the relationship between node IDs and database IDs, you can:

  • Generate accurate URLs for pull‑request comments, issues, and commits.
  • Perform bulk data migrations without costly round‑trips to the API.
  • Build robust automation pipelines in tools like the Workflow automation studio.
  • Leverage AI‑driven insights from platforms such as the AI marketing agents on UBOS.

Node IDs vs. Database IDs: A Clear Comparison

GitHub’s two identifier systems are mutually exclusive but complementary. Below is a MECE‑structured table that isolates their core attributes.

Aspect Node ID Database ID
Format PRRC_kwDOL4aMSs6Tkzl8 (Base64‑encoded) 2475899260 (Decimal integer)
Scope Globally unique across all GitHub objects Local to a specific object type (e.g., PR, Issue)
API Usage Returned by GraphQL queries Embedded in REST URLs and UI links
Decoding Complexity Requires Base64 + MessagePack parsing Direct integer, no decoding needed

Understanding these differences is the first step toward reliable API integration.

How to Decode Modern Node IDs (Base64 + MessagePack)

Modern GitHub node IDs follow a three‑part structure encoded with Base64 and serialized using MessagePack. The process can be broken down into three deterministic steps:

  1. Split the prefix (e.g., PRRC_) from the encoded payload.
  2. Base64‑decode the payload to obtain a binary blob.
  3. MessagePack‑unpack the binary to retrieve an array of integers and, optionally, strings.

Here’s a concise Python snippet that implements the full pipeline:

import base64, msgpack

def decode_node_id(node_id: str):
    # 1️⃣ Separate prefix and payload
    _, encoded = node_id.split('_', 1)

    # 2️⃣ Base64 decode
    binary = base64.b64decode(encoded)

    # 3️⃣ MessagePack unpack
    unpacked = msgpack.unpackb(binary, raw=False)

    return unpacked

# Example usage
node = "PRRC_kwDOL4aMSs6Tkzl8"
print(decode_node_id(node))
# Output: [0, 47954445, 2475899260]

The resulting array typically contains:

  • 0 – a version flag (currently unused).
  • The repository’s database ID (e.g., 47954445).
  • The target object’s database ID (e.g., 2475899260 for a PR comment).

“The lower 32 bits of the decoded value always hold the object’s database ID. Masking those bits gives you the exact integer you see in the UI.” – Soohoon Choi, Greptile Engineer

Legacy ID Formats and Their Quirks

Older repositories (pre‑2012) still expose a legacy format that is human‑readable after Base64 decoding. The pattern looks like:

010:Repository2325298

Where:

  • 010 – an internal enum representing the object type.
  • Repository – the object name.
  • 2325298 – the database ID.

Tree objects add a SHA hash after the repository ID, e.g.,

04:Tree2325298:7201bfb928b29e80b005da15978345f23ba0ff9b

These legacy strings are still returned for certain object types (like UBOS templates for quick start) and must be handled separately in migration scripts.

Practical Code Examples and Real‑World Use Cases

Generating Direct URLs from Node IDs

When building a code‑review tool (e.g., AI marketing agents), you often need to turn a node ID into a clickable GitHub URL. The following function extracts the database ID and formats the URL:

def node_to_url(node_id: str, object_type: str) -> str:
    db_id = decode_node_id(node_id)[-1]  # Grab the last element
    base = "https://github.com"
    if object_type == "pull_request":
        return f"{base}/pull/{db_id}"
    elif object_type == "issue":
        return f"{base}/issues/{db_id}"
    elif object_type == "comment":
        # Comments need the parent PR/Issue ID; assume you have it
        parent_id = ...  # retrieve from context
        return f"{base}/pull/{parent_id}#discussion_r{db_id}"
    else:
        raise ValueError("Unsupported object type")

Bulk Migration without API Calls

Suppose you have millions of stored node IDs and need to back‑populate a relational table with their integer IDs. Instead of hitting the API for each record, you can decode locally:

import csv

def bulk_decode(csv_path: str, out_path: str):
    with open(csv_path, newline='') as src, open(out_path, 'w', newline='') as dst:
        reader = csv.DictReader(src)
        writer = csv.DictWriter(dst, fieldnames=['node_id', 'db_id'])
        writer.writeheader()
        for row in reader:
            db_id = decode_node_id(row['node_id'])[-1]
            writer.writerow({'node_id': row['node_id'], 'db_id': db_id})

# Run once for a 2 GB export
bulk_decode('github_nodes.csv', 'github_db_ids.csv')

This approach saved over 48 hours of API latency for a recent client project that used the Web app editor on UBOS to visualize the data.

Integrating with AI‑Powered Tools

Many AI services (e.g., OpenAI ChatGPT integration) accept raw IDs for context injection. By feeding the decoded integer, you improve token efficiency and reduce prompt length.

{
  "model": "gpt-4o",
  "messages": [
    {"role": "system", "content": "You are a GitHub assistant."},
    {"role": "user", "content": "Explain the changes in PR #2475899260."}
  ]
}

Notice the use of the plain integer 2475899260 instead of the bulky Base64 string.

Benefits of Understanding GitHub IDs for Developers

Mastering the ID system unlocks several strategic advantages:

  • Performance Gains: Local decoding eliminates network round‑trips.
  • Data Consistency: Guarantees that URLs and stored references never diverge.
  • Future‑Proofing: As GitHub evolves, the opaque node ID remains stable, while the integer part stays backward compatible.
  • Cross‑Platform Compatibility: Enables seamless integration with Telegram integration on UBOS, ElevenLabs AI voice integration, and other AI services.

These benefits translate directly into faster release cycles, lower operational costs, and higher developer satisfaction.

Take the Next Step with UBOS

If you’re building a SaaS product, a DevOps dashboard, or an AI‑enhanced workflow, UBOS offers a suite of tools that can accelerate your development:

Explore a ready‑made AI SEO Analyzer to audit your own documentation, or try the AI Article Copywriter for generating technical guides like this one.

Ready to prototype? Use the Talk with Claude AI app template to experiment with natural‑language queries on GitHub data.

Further Reading

For a deep dive into the original research and the author’s personal notes, consult the original Greptile article. It provides the raw data sets and additional edge‑case analysis that informed the decoding logic presented here.

Conclusion

GitHub’s dual‑ID system—node IDs and database IDs—may initially appear confusing, but with the decoding steps outlined above, developers can reliably translate between them, generate accurate URLs, and streamline large‑scale data operations. By integrating these techniques into your CI/CD pipelines, AI assistants, or custom dashboards, you’ll unlock performance gains and future‑proof your integrations.

Stay ahead of the curve by leveraging UBOS’s AI‑centric ecosystem, from the About UBOS page to the extensive UBOS homepage. Whether you’re a solo developer or part of an enterprise team, mastering GitHub IDs is a foundational skill that pays dividends across every layer of the software development lifecycle.

Happy coding, and may your IDs always decode cleanly!


Andrii Bidochko

CTO UBOS

Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.