API Documentation v1.0.0

Complete reference for the DocForge document conversion API. All endpoints accept JSON and return JSON.

https://docforge-api.vercel.app

Authentication

Pass your API key via the X-Api-Key header. The Free tier requires no key.

TierKey PrefixRequests/DayMax InputPrice
Free none 500 100 KB $0
Pro dk_pro_* 50,000 5 MB $9/mo
Team dk_team_* 500,000 25 MB $29/mo
GET /api/index

API Directory

Returns the API name, version, operational status, and a list of all available endpoints. No authentication required.

Response Body

FieldTypeDescription
namestringAPI name
versionstringAPI version
statusstringOperational status
endpoints[]object[]Array of endpoint objects with method, path, description
Try it out
Click "Send Request" to see the response
POST /api/md-to-html

Markdown to HTML

Convert Markdown text to sanitized HTML. Supports headings (h1-h6), bold, italic, strikethrough, links, images, fenced code blocks with language annotation, ordered and unordered lists, blockquotes, and horizontal rules.

Request Body

FieldTypeDescription
markdownstringrequiredMarkdown text to convert (min 1 character)

Response Body

FieldTypeDescription
htmlstringRendered HTML output
meta.wordCountintegerNumber of words in the input
meta.headingsstring[]Extracted heading text
Try it out
Click "Send Request" to see the response
POST /api/csv-to-json

CSV to JSON

Parse CSV (or TSV) data into a JSON array of objects. The first row is treated as column headers. Supports quoted fields with escaped double-quotes and a configurable single-character delimiter.

Request Body

FieldTypeDescription
csvstringrequiredCSV text to parse (min 1 character)
delimiterstringoptionalSingle-character delimiter. Default: ,

Response Body

FieldTypeDescription
dataobject[]Array of row objects keyed by column headers
meta.rowCountintegerNumber of data rows (excluding header)
meta.columnsstring[]Column names from the header row
Try it out
Click "Send Request" to see the response
POST /api/json-to-csv

JSON to CSV

Convert an array of JSON objects to CSV format. Columns are automatically detected from all keys across all rows. Fields containing the delimiter, double quotes, or newlines are properly escaped. Supports a configurable delimiter.

Request Body

FieldTypeDescription
dataobject[]requiredNon-empty array of JSON objects to convert
delimiterstringoptionalSingle-character delimiter. Default: ,

Response Body

FieldTypeDescription
csvstringCSV output with header row and data rows
meta.rowCountintegerNumber of data rows
meta.columnsstring[]Column names (union of all keys)
Try it out
Click "Send Request" to see the response
POST /api/yaml-json

YAML / JSON Conversion

Bidirectional conversion between YAML and JSON. Set direction to yaml-to-json or json-to-yaml. The YAML parser supports scalars, nested objects, and arrays.

Request Body

FieldTypeDescription
inputstringrequiredThe YAML or JSON string to convert (min 1 character)
direction enum required yaml-to-json or json-to-yaml

Response Body

FieldTypeDescription
outputstringThe converted output (JSON string or YAML string)
meta.keysintegerNumber of top-level keys in the parsed object
Try it out
Click "Send Request" to see the response

Error Codes

All errors return a consistent JSON structure. The code field is machine-readable and stable across versions.

HTTP StatusCodeDescription
400INVALID_INPUTRequest body is missing required fields, has invalid types, or fails Zod validation
400PARSE_ERRORThe input could not be parsed (malformed JSON, invalid YAML, etc.)
405INVALID_INPUTHTTP method not allowed (only POST is accepted on conversion endpoints)
413INPUT_TOO_LARGERequest body exceeds the tier's maximum input size
429RATE_LIMITEDDaily request limit exceeded for the current tier
500INTERNAL_ERRORUnexpected server error during processing

Error Response Shape

{
  "error": "Human-readable error message",
  "code": "INVALID_INPUT",
  "details": "Optional additional context"
}

Download the full OpenAPI 3.0 spec (JSON) for code generation, Postman import, or CI integration.