Every endpoint spec in MarkApiDown begins with a YAML frontmatter block delimited byDocumentation Index
Fetch the complete documentation index at: https://docs.markapidown.net/llms.txt
Use this file to discover all available pages before exploring further.
--- lines. The frontmatter tells MarkApiDown what HTTP request to build, which environments the spec targets, how to authenticate, and how long to wait before giving up. Everything after the closing --- is the human-readable markdown body that documents the request, response, and test assertions.
Run
mad validate api-docs/ before executing specs to catch frontmatter errors — missing required fields, unknown auth values, or malformed retry blocks — without sending any real HTTP requests. Exit code 2 means validation failed; exit code 5 means a possible secret was detected in the file.Complete example
This example is drawn from the JSONPlaceholder sample project included with MarkApiDown. It shows every frontmatter field together. Required fields are always present; optional fields can be omitted to inherit the project default frommad.md.
Required fields
These fields must be present in every endpoint spec.mad validate reports an error for any file that is missing one.
The resource group this endpoint belongs to. MarkApiDown uses this to organise specs in the web preview sidebar and in the output of
mad_search. Use a plural noun that matches the URL resource — users, posts, orders.The transport protocol for this request. Always set to
http. MarkApiDown uses this field to select the execution engine and may support additional protocols in future versions.The HTTP verb for the request. Must be one of the standard methods shown in the table below. Use uppercase.
| Method | Typical use |
|---|---|
GET | Retrieve a resource or collection |
POST | Create a new resource |
PUT | Replace a resource entirely |
PATCH | Apply a partial update |
DELETE | Remove a resource |
HEAD | Retrieve headers only (no body) |
OPTIONS | Discover allowed methods / CORS preflight |
The URL path for the request, relative to See Path parameter syntax below for details.
baseUrl. Use :paramName syntax for path parameters. At runtime, MarkApiDown substitutes :paramName with the value of the matching variable from the active environment.The spec schema version. Always set to
1. MarkApiDown uses this to detect incompatible spec formats without breaking existing files on schema changes.Optional fields
Omitting any of these fields causes MarkApiDown to fall back to the project-level default defined inmad.md. Set them in a spec only when you need to override the project default for that one endpoint.
List of environment names this spec is intended to target. Serves as documentation and as a filter —
mad_search can use it to find specs valid for a specific environment. If omitted, the spec is considered environment-agnostic.Authentication scheme to use for this request. Overrides the
auth value in the ## Defaults block of mad.md.| Value | Behaviour |
|---|---|
none | No Authorization header added |
bearer | Injects Authorization: Bearer {{token}} |
basic | Injects Authorization: Basic <base64(user:pass)> |
Maximum number of milliseconds to wait for a response before MarkApiDown aborts the request and reports an error. Overrides
timeout in mad.md.Number of times to retry the request after a failure. Set to
0 to disable retries for this endpoint even if the project default is non-zero. Overrides retry.attempts in mad.md.The retry spacing strategy for this endpoint. Overrides
retry.backoff in mad.md.| Value | Behaviour |
|---|---|
fixed | Equal wait interval between every retry |
exponential | Doubles the wait interval after each retry |
Free-form labels for filtering and discovery. Tags power the
mad_search --tag flag and the mad_search MCP tool, making it easy for both humans and AI agents to find specs by category.Path parameter syntax
Use:paramName in the path field to declare a path parameter. MarkApiDown resolves :paramName against the active environment’s variables at execution time — the same pool that {{variableName}} references draw from.
postId must exist in _shared/env.md for the active environment, in .env.local, in a MAD_POST_ID OS environment variable, or as a --var postId=1 CLI flag.
Variable syntax in request bodies and headers
Use double-curly-brace syntax —{{variableName}} — anywhere in the request body, headers, or URL to inject a resolved variable value. MarkApiDown replaces every {{...}} token before sending the request.
Override precedence
When the same setting appears in both a spec’s frontmatter andmad.md, the spec always wins. The full precedence order from lowest to highest:
Project defaults (mad.md)
The
## Defaults block in your project’s mad.md provides the baseline for every endpoint.Endpoint spec frontmatter
Fields in the spec’s own frontmatter override the project default for that specific endpoint.
Frontmatter quick reference
| Field | Type | Required | Default |
|---|---|---|---|
resource | string | ✅ | — |
protocol | string | ✅ | — |
method | string | ✅ | — |
path | string | ✅ | — |
version | integer | ✅ | — |
env | array | — | (all environments) |
auth | string | — | project default |
timeout | integer (ms) | — | project default |
retry.attempts | integer | — | project default |
retry.backoff | string | — | project default |
tags | array | — | [] |