ForHosting KIT · Developer Utilities

Document your code

Undocumented functions are the tax every team pays twice: once when the original author forgets what they wrote, and again when the next hire has to reverse-engineer it. This endpoint reads your source and produces docstrings, parameter descriptions and reference-style docs you can commit straight into the repo.

● StablePer request + per 1,000 words$0.003
Use it from WebAPIEmailApp soonTelegram soon

Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.

Who ends up needing this

The typical caller is a team that inherited a service with a hundred public functions and zero comments, or a solo maintainer who writes fast and documents never. It also shows up in CI pipelines that block a merge unless every new exported function has a docstring, and in libraries preparing a first public release where the code works but nobody would know how to call it from the outside.

What you send and what comes back

You post a source file or a function block, optionally naming the language and the docstring convention you want (Google-style, NumPy-style, JSDoc, PHPDoc, and similar are inferred from the code when you don't specify). The task returns the same code with docstrings inserted above each function, plus a separate reference block per symbol: name, parameters with inferred types, return value, and a plain-language description of what the function actually does, not just its signature restated.

Why the format choice matters

Docstring conventions exist because tooling reads them: Sphinx, JSDoc, Doxygen and IDE tooltips all parse a specific comment shape to render hover-help and generated sites. A docstring that is well-written but in the wrong format is invisible to your documentation build, so the API asks for or infers the convention rather than guessing a generic one and leaving you to reformat five hundred functions by hand.

Where it sits in your pipeline

Because every call is asynchronous, the natural place for this is a pre-merge hook or a scheduled job that diffs the last documented commit against HEAD and only submits new or changed functions. The signed webhook lands the annotated source back in your build system without a human ever opening the file, and the 24-hour signed-link fallback covers manual runs where someone just wants to paste a file and get it back.

What it won't do

It documents what the code does and how it's called, based on the logic in front of it; it does not invent behavior, guess business intent that isn't expressed in the code, or fabricate examples that weren't derivable from the function body. If a function is genuinely ambiguous, the description says so rather than making something up.

Legacy service handoff

A team taking over a five-year-old internal API runs every controller file through the endpoint to get baseline docstrings before anyone touches the logic.

Pre-release library polish

An open-source maintainer documents the public surface of a package the week before tagging 1.0, so early adopters get real parameter docs instead of reading the source.

CI documentation gate

A pipeline step submits only the functions changed in a pull request and fails the check if the returned docstrings flag a parameter with no discernible purpose.

Cross-team API reference

A platform team generates reference docs for internal SDK functions so other departments can integrate without pinging Slack every time.

What languages does the code documentation API support?

Mainstream languages including JavaScript, TypeScript, Python, PHP, Java, Go and C# are supported; the docstring convention is inferred from the language unless you specify one.

Is there a free tier to test it?

There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.

How is the request priced?

$0.003 per request plus $0.0135 per 1000 words of source processed, billed only on tasks that complete successfully.

What happens if the task fails?

It retries automatically up to three times; if it still fails you get a clear error and are never charged for that request.

Can I submit a whole file instead of one function?

Yes, you can submit a full file and the API documents every exported function or class method it finds, returning them either inline or as a separate reference block.

How do I get the result back?

Via a signed webhook to your endpoint, which is recommended for automated pipelines, or a signed link valid for 24 hours for manual or one-off runs.

Does it choose the docstring style for me?

It infers a sensible convention from the language and existing code style, or you can force one explicitly, such as Google-style Python or JSDoc.

Is my source code kept afterward?

No. Submitted code and generated docs are deleted after the retention window and are never used for training.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/dev/code-document

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.

curl -X POST https://api.kit.forhosting.com/dev/code-document \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"…"}'
{
  "text": "…"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "dev.code_document",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.003
Per 1,000 words$0.0135

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.
422task_failedThe task failed after 3 retries. You are never charged for it.

Read the full KIT documentation →