← MarketplaceGet started free
Guide

How to Generate a README from a GitHub Repo via API

What You'll Build

A script that takes a GitHub repository URL, calls the Runcept readme-generator agent, and writes a README.md to disk in seconds.

Prerequisites

  • Runcept account and API key
  • Node.js 18+
  • curl Example

    # Start the job
    

    curl -sS -X POST https://www.runcept.com/api/v1/run \

    -H "Authorization: Bearer runcept_sk_YOUR_KEY" \

    -H "Content-Type: application/json" \

    -d '{"agent": "readme-generator", "input": {"repo_url": "https://github.com/owner/repo"}}'

    # Returns: {"job_id": "job_abc123", "status": "queued"}

    # Poll for result

    curl -sS https://www.runcept.com/api/v1/jobs/job_abc123 \

    -H "Authorization: Bearer runcept_sk_YOUR_KEY"

    Node.js Script

    import fs from 'fs'
    
    

    async function generateReadme(repoUrl) {

    const run = await fetch('https://www.runcept.com/api/v1/run', {

    method: 'POST',

    headers: {

    Authorization: Bearer ${process.env.RUNCEPT_API_KEY},

    'Content-Type': 'application/json',

    },

    body: JSON.stringify({ agent: 'readme-generator', input: { repo_url: repoUrl } }),

    }).then(r => r.json())

    // Poll every 3 seconds

    while (true) {

    await new Promise(r => setTimeout(r, 3000))

    const job = await fetch(https://www.runcept.com/api/v1/jobs/${run.job_id}, {

    headers: { Authorization: Bearer ${process.env.RUNCEPT_API_KEY} },

    }).then(r => r.json())

    if (job.status === 'complete') {

    fs.writeFileSync('README.md', job.output.readme)

    console.log('README.md written')

    break

    }

    if (job.status === 'failed') throw new Error('Agent failed')

    }

    }

    generateReadme('https://github.com/owner/repo')

    Batch Generation

    To generate READMEs for multiple repos:

    const repos = ['https://github.com/org/repo1', 'https://github.com/org/repo2']
    

    for (const repo of repos) await generateReadme(repo)

    Next Steps

  • Run this as a GitHub Action after significant releases
  • Combine with the commit message agent for a full automated docs pipeline
  • Publish your own documentation agent and earn per run
  • Use this agent on Runcept

    View readme-generator agent →

    Related guides

    Call an AI Agent API from Node.jsCall an AI Agent API from PythonRun an AI Agent from GitHub ActionsHow to Monetize an AI Agent as an API