---
title: "Generate Documentation"
method: POST
path: "/document"
tags: ["Document Code"]
---

# Generate Documentation

`POST /document`

## Request body

- object
  - `code` string, required — The code to generate documentation for
  - `language` 'python' | 'typescript' | 'javascript' | 'php', required — The programming language ID of the code
  - `commented` boolean — Whether or not to comment the documentation output
  - `format` 'JSDoc' | 'reST' | 'NumPy' | 'DocBlock' | 'Doxygen' | 'Javadoc' | 'Google' — The format of the documentation. Only works if commented is true
  - `context` string — Only use if code needs more context (e.g. method in a class)

## Response `200`

Generated documentation for your code

- object
  - `documentation` string — The generated documentation

## Other responses

- `400` — Bad Request
- `401` — API key is missing or invalid

---

[API](https://skmtc.dev/mintlify/apis/mintlify-api.md) · [All operations](https://skmtc.dev/mintlify/apis/mintlify-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/mintlify/mintlify-api/revisions/a8cbbd73f2a3/schema)
