API reference page
A resource overview and operation reference with request and response examples.
Rendering API reference
let viewParameter =
Parameter.create "view" "string" Body
|> Parameter.required
|> Parameter.withDescription "Typed view source to encode and render."
|> Parameter.withExample "main { h1 { \"Hello\" } }"
let contentTypeParameter =
Parameter.create "content_type" "string" Body
|> Parameter.withDescription "Response media type."
|> Parameter.withDefaultValue "text/html"
|> Parameter.withEnumValues [ "text/html"; "application/xhtml+xml" ]
let prettyParameter =
Parameter.create "pretty" "boolean" Query
|> Parameter.withDescription "Indent the returned markup for inspection."
|> Parameter.withDefaultValue "false"
let successResponse =
Response.create "200"
|> Response.withDescription "Rendered HTML and response media type."
let operation =
Operation.create POST "/v1/render"
|> Operation.withDescription "Renders typed view source into encoded HTML."
|> Operation.withAuthentication "Send a bearer token in the Authorization header."
|> Operation.withApiVersion "2026-09-01"
|> Operation.withIdempotency "Repeated requests with the same key return the original result."
|> Operation.withParameters [ viewParameter; contentTypeParameter; prettyParameter ]
|> Operation.withResponses [ successResponse ]
|> Operation.withErrors [
Error.create "invalid_view" "The supplied view could not be parsed."
Error.create "unsupported_content_type" "The requested response type is unavailable." ]
let requestExample = """curl $API_ORIGIN/v1/render \
-H "Authorization: Bearer $ACME_TOKEN" \
-H "Content-Type: application/json" \
-d '{"view":"main { h1 { \"Hello\" } }"}'"""
let responseExample = """{
"html": "<main><h1>Hello</h1></main>",
"content_type": "text/html"
}"""
let operationRail =
div {
ApiReference.codeExample "Request" "curl" requestExample
ApiReference.responseExample "200" "json" responseExample }
let apiPage =
DocumentationPage.create "render" "Render a view"
|> DocumentationPage.withDescription "Render typed HTML safely at the service boundary."
|> DocumentationPage.withLayout Reference
|> DocumentationPage.withRightRail (CustomRail operationRail)
|> DocumentationPage.withSections [
DocumentationSection.create "request" "Request" [ Operation.render operation ] ]
let overviewRail =
ApiReference.codeExample "View object" "json" responseExample
let apiOverviewPage =
DocumentationPage.create "api-overview" "Rendering API"
|> DocumentationPage.withDescription "Convert typed view source into deterministic HTML."
|> DocumentationPage.withLayout Reference
|> DocumentationPage.withRightRail (CustomRail overviewRail)
|> DocumentationPage.withSections [
DocumentationSection.create "operations" "Operations" [
nav {
_ariaLabel "Rendering operations"
_class "docs-api-operation-links"
a {
_href apiRenderPreviewPath
strong { "Render a view" }
span { _class "docs-api-operation-link-path"; span { _class "docs-http-method docs-method-post"; "POST" }; code { "/v1/render" } }
}
} ]
DocumentationSection.create "view-object" "View object" [
ApiReference.parameters [
ApiReference.parameter "html" "string" true "Encoded HTML returned by the renderer."
ApiReference.parameter "content_type" "string" true "Media type of the rendered response." ] ] ]FSharp.ViewEngine does not expose an HTTP /v1/render endpoint. This fictional operation keeps the example focused on the reference layout and reusable API components.