The mdmin REST API lets you compress markdown and extract relevant context from your applications. All endpoints require a Bearer API key. Get yours free at mdmin.dev/settings.
https://mdmin.devAuthorization: Bearer mdmin_sk_...application/json/api/v1/compressCompress markdown using the rule-based engine. Removes verbose patterns, compacts tables, strips filler phrases. Returns the compressed text and token stats.
| Field | Type | Description |
|---|---|---|
markdownrequired | string | The markdown text to compress |
level | string | light | medium | aggressive — default: medium |
source | string | Client identifier for dashboard tracking (cli, vscode, etc.) |
curl -X POST https://mdmin.dev/api/v1/compress \
-H "Authorization: Bearer mdmin_sk_..." \
-H "Content-Type: application/json" \
-d '{
"markdown": "# Hello\n\nIn order to get started...",
"level": "medium"
}'{
"output": "# Hello\n\nTo get started...",
"stats": {
"inputTokens": 120,
"outputTokens": 94,
"saved": 26,
"pct": 21.7
},
"mode": "rule:medium"
}| Field | Type | Description |
|---|---|---|
output | string | Compressed markdown text |
stats.inputTokens | number | Token count before compression |
stats.outputTokens | number | Token count after compression |
stats.saved | number | Tokens saved |
stats.pct | number | Percentage reduction |
mode | string | Compression mode used (e.g. rule:medium) |
/api/v1/extractGiven a large document and a query, returns only the most relevant chunks within a token budget. Uses TF-IDF cosine similarity — no LLM, no external API, runs in milliseconds. Achieves 70–95% reduction on targeted queries.
| Field | Type | Description |
|---|---|---|
documentrequired | string | The full markdown document to extract from |
queryrequired | string | Question or topic to find relevant sections for |
max_tokens | number | Token budget for result — default: 2000, Pro max: 16000 |
curl -X POST https://mdmin.dev/api/v1/extract \
-H "Authorization: Bearer mdmin_sk_..." \
-H "Content-Type: application/json" \
-d '{
"document": "# Large Doc\n\n...",
"query": "how does auth work",
"max_tokens": 2000
}'{
"text": "## Authentication\n\nThe auth system uses...",
"stats": {
"totalDocTokens": 8400,
"extractedTokens": 610,
"chunksTotal": 24,
"chunksExtracted": 3,
"reduction": 92.7
},
"tier_limit": {
"tier": "free",
"max_tokens": 2000,
"max_doc_bytes": 100000,
"at_token_limit": false
}
}| Field | Type | Description |
|---|---|---|
text | string | Extracted relevant chunks in original document order |
stats.totalDocTokens | number | Total tokens in the input document |
stats.extractedTokens | number | Tokens in the extracted result |
stats.chunksTotal | number | Total chunks the document was split into |
stats.chunksExtracted | number | Chunks included in the result |
stats.reduction | number | Percentage reduction vs full document |
tier_limit.tier | string | Your current tier (free | pro) |
tier_limit.max_tokens | number | Max token budget for your tier |
tier_limit.max_doc_bytes | number | Max document size for your tier (bytes) |
tier_limit.at_token_limit | boolean | True if result hit the token budget ceiling |
/api/v1/statsReturns your aggregate usage statistics for the last 90 days — total compressions, tokens saved, estimated cost savings, and a 7-day daily breakdown.
curl https://mdmin.dev/api/v1/stats \ -H "Authorization: Bearer mdmin_sk_..."
{
"totalTokensSaved": 48200,
"totalCompressions": 37,
"estimatedUsdSaved": 0.0386,
"extensionCompressions": 12,
"last7Days": [
{ "date": "2026-03-04", "tokensSaved": 0 },
{ "date": "2026-03-05", "tokensSaved": 1840 },
...
]
}| Status | Code | Meaning |
|---|---|---|
401 | — | Missing or invalid API key |
400 | — | Invalid request body or missing required field |
413 | DOC_TOO_LARGE | Input exceeds size limit for your tier |
429 | — | Rate limit exceeded — check Retry-After header |
402 | PRO_REQUIRED | Feature requires Pro subscription |
402 | DEEP_COMING_SOON | Deep compress via API not yet available |
500 | — | Server error — retry after a moment |