Generate API Docs From GitHub

OpenAINotionSlackGitHub

Monitors GitHub pushes, detects API route changes, and uses AI to generate and publish professional Markdown documentation to Notion, notifying the team via Slack.

GitHubAPI DocumentationNotionDeveloper Tools

The Problem With API Documentation

API documentation is often the most neglected part of software development. It rarely happens because developers prioritize shipping features and fixing bugs, pushing documentation updates to the end of the line.

New developers join and spend their first weeks reading raw source code. Integration partners wait for documentation that never arrives. Teams even duplicate work because nobody realized an endpoint already existed. Writing documentation manually is slow, repetitive, and adds little creative value. It is the perfect task to hand over to software.

What the Workflow Does

This workflow monitors a GitHub repository for code pushes and creates professional API documentation without manual effort.

When a push lands, the workflow detects which files contain API routes. It fetches the source code, uses an AI agent to parse every HTTP endpoint, and creates clean Markdown documentation. Finally, it publishes the documentation to Notion and notifies the team on Slack. From push to published documentation takes just seconds.

A Key Architecture Decision

The original version used an AI agent to classify which files were API route files. This approach failed because the AI sometimes hallucinated file paths that did not exist when triggered without a real payload, causing the GitHub fetch node to fail.

The solution was replacing the AI classifier with a deterministic code node using regex pattern matching. The code reads only real file paths from the actual push payload, ensuring complete reliability. Use AI where judgment and language understanding are needed, and use deterministic code where precision is required.

How It Works

The workflow processes events through a sequence of nine nodes:

  1. A webhook trigger receives the GitHub push payload.
  2. A code node classifies which changed files are API route files, detecting controllers, routes, and endpoint directories across various frameworks.
  3. A gate node stops the workflow immediately if no API files are found, saving resources.
  4. The GitHub connector fetches the source code of each detected file in parallel.
  5. A code node extracts the clean file content from the GitHub response format.
  6. An AI agent parses every HTTP endpoint to extract the path, method, request body, response structure, and description.
  7. A second AI agent generates professional Markdown documentation.
  8. The Notion connector publishes a new documentation page.
  9. Slack sends the team a notification with a direct link.

Information Extracted by the AI Agent

FieldDescription
PathThe exact HTTP path of the endpoint
MethodThe HTTP method (GET, POST, PUT, DELETE)
ParametersDetails on the request body and variables
ResponseThe structure of the expected output
DescriptionA plain-text explanation of what the endpoint does

Want to showcase your own workflows?

Become a Needle workflow partner and turn your expertise into recurring revenue.

Try Needle today

Streamline AI productivity at your company today

Join thousands of people who have transformed their workflows.

Agentic workflowsAutomations, meet AI agents
AI SearchAll your data, searchable
Chat widgetsDrop-in widget for your website
Developer APIMake your app talk to Needle
    Needle LogoNeedle
    Like many websites, we use cookies to enhance your experience, analyze site traffic and deliver personalized content while you are here. By clicking "Accept", you are giving us your consent to use cookies in this way. Read our more on our cookie policy .