Skip to main content

Endpoint

GET /api/content/:productSlug/doc/:version/:docPath
Fetches the MDX source and associated metadata for a single documentation page. The route handler resolves the file from the content directory, parses its frontmatter, and returns both the raw markdown source and structured metadata.
The API checks two possible file locations for each request: <contentDir>/<docPath>.mdx and <contentDir>/<docPath>/index.mdx. Named files take precedence over index files.

Path parameters

productSlug
string
required
The slug identifying the product. Must match a key in the server’s product configuration.Examples: terraform-plugin-framework, terraform-enterprise, vault
version
string
required
The documentation version to retrieve. Use latest to resolve to the most recent stable version automatically.Examples: latest, v1.9.x, v20220610-01For products without versioned docs, use latest.
docPath
string
required
The path to the document, relative to the product’s content directory. Segments are joined with /.Example: plugin/framework, docs/internals/state

Example requests

curl http://localhost:8080/api/content/terraform-plugin-framework/doc/latest/plugin/framework

Response

Returns a JSON object with a meta envelope and a result object containing the document content and metadata.
200
{
  "meta": {
    "status_code": 200,
    "status_text": "OK"
  },
  "result": {
    "fullPath": "plugin/framework",
    "product": "terraform-plugin-framework",
    "version": "v1.10.x",
    "metadata": {
      "page_title": "Plugin Framework",
      "description": "Overview of the Terraform Plugin Framework."
    },
    "subpath": "docs",
    "markdownSource": "---\npage_title: Plugin Framework\n---\n\n# Plugin Framework\n...",
    "created_at": "2023-05-12T00:00:00Z",
    "last_modified": null,
    "sha": "",
    "githubFile": "content/terraform-plugin-framework/v1.10.x/website/docs/plugin/framework.mdx"
  }
}

Response fields

meta
object
required
Response envelope with HTTP status information.
result
object
required
The document data.

Response headers

HeaderDescription
content-typeAlways application/json
served-fromIndicates whether content was served from current build or production

Error responses

StatusBodyCause
404Not foundThe productSlug is not in the product configuration, the version does not exist for the product, or no content file was found at any of the expected locations.

Build docs developers (and LLMs) love