---
title: "Generate Docs For Repo"
method: POST
path: "/repos/{repo_id}/generate-docs"
tags: ["repos"]
---

# Generate Docs For Repo

`POST /repos/{repo_id}/generate-docs`

Generate AI documentation for a repo's latest snapshot.

The "adopt-docs" entrypoint: a paying viewer can produce docs for a
public repo that someone else indexed without docs. Requires Pro or
Admin (free tier rejected upstream by ``_gate_docs_credit_hold``).

Behaviour:
  * Public repo + caller already in ``user_repos`` → re-uses the
    existing link.
  * Public repo + caller not yet linked → upserts a ``user_repos``
    row pointing at the latest ready snapshot before charging the
    hold; lets the new viewer see the repo on their dashboard.
  * Private repo + caller not in ``user_repos`` → 404 (adopt does
    not bypass GitHub-App access control).
  * Latest ready snapshot already has ``docs_artifact_path`` →
    short-circuit, no Modal job, no charge. Caller gets the existing
    snapshot and a fresh ``user_repos`` link.
  * Otherwise → runs the existing reindex pipeline with
    ``generate_docs=True`` (parse is fast; the LLM is the cost the
    caller is paying for).

## Path parameters

- `repo_id` string, required

## Request body

- GenerateDocsRequest — Body for POST /repos/{repo_id}/generate-docs. Generates AI documentation against a public repo's existing snapshot. Lets a paying viewer "adopt" docs for a repo someone else already indexed publicly without needing a fresh full reindex from scratch. ``wiki_style`` / ``docs_language`` = ``None`` inherits from the target snapshot (same contract as ``ReindexRequest``).
  - `docs_file_percentage` number
  - `wiki_style` 'comprehensive' | 'caveman' | 'reference' | 'tutorial', nullable
  - `docs_language` 'en' | 'ru' | 'es' | 'fr' | 'de' | 'zh' | 'ja' | 'ko' | 'it' | 'pt' | 'nl' | 'pl' | 'tr' | 'ar' | 'hi', nullable

## Response `200`

Successful Response

- IndexRepoResponse
  - `snapshot_id` string, required
  - `short_id` string, required
  - `status` 'queued' | 'indexing' | 'ready' | 'failed', required
  - `cached` boolean, required
  - `repo` RepoResponse, required
    - `id` string, required
    - `canonical_url` string, required
    - `owner` string, required
    - `name` string, required
    - `default_branch` string, required
    - `latest_known_head_sha` string, nullable
    - `is_public` boolean, required
    - `file_count` integer, nullable
    - `last_checked_at` string, date-time, nullable
    - `auto_sync_enabled` boolean
    - `github_checks_enabled` boolean
    - `last_webhook_at` string, date-time, nullable
    - `last_polled_at` string, date-time, nullable
    - `exclude_patterns` string[]
    - `max_file_pages` integer, nullable
    - `prose_refresh` string
    - `prose_daily_cap_cents` integer
    - `repowise_managed` boolean
    - `description` string, nullable
    - `primary_language` string, nullable
    - `stars` integer, nullable
    - `badge_detected_at` string, date-time, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/repowise/apis/repowise-hosted-api.md) · [All operations](https://skmtc.dev/repowise/apis/repowise-hosted-api/llms.txt) · [OpenAPI document](https://skmtc.dev/repowise/apis/repowise-hosted-api/revisions/8c05b8b9a5c4?raw)
