MarkApiDown resolves everyDocumentation Index
Fetch the complete documentation index at: https://docs.markapidown.net/llms.txt
Use this file to discover all available pages before exploring further.
{{variable}} reference in your endpoint specs at execution time through a layered variable system. Define base URLs and shared values in api-docs/_shared/env.md, store secrets safely outside of version control in .env.local, and override anything on the fly with MAD_* OS environment variables or --var CLI flags. All four layers stack on top of each other — higher layers win without modifying the underlying file.
Defining environments in env.md
The file api-docs/_shared/env.md holds your named environment definitions. Each environment is a second-level heading (## <name>) followed by a fenced yaml code block containing key-value pairs.
Here is the real _shared/env.md from the JSONPlaceholder example project:
dev values are never mixed into staging runs:
{{variable}} you can use in any spec under api-docs/.
Variable resolution order
Whenmad resolves a {{variable}} reference, it searches four sources in order from lowest to highest priority. A value found in a higher-priority source overrides the same key from any lower-priority source.
_shared/env.md (chosen environment)
The baseline values for the environment you pass with
--env. This is where
non-sensitive, team-shared configuration lives — base URLs, IDs, version
strings..env.local
A file at your project root, next to
api-docs/. It is gitignored
automatically by mad init. Put API keys, tokens, passwords, and any other
secret here. Values defined in .env.local override those in env.md.MAD_* OS environment variables
Any OS environment variable whose name starts with
MAD_ is injected after
stripping the prefix and converting to camelCase. For example,
MAD_API_TOKEN becomes {{apiToken}}. Use this layer in CI pipelines and
Docker containers.Referencing variables in specs
Use{{variableName}} anywhere in the ## Request section — URL, headers, or body:
{{variable}} cannot be resolved in the active layer stack.
Switching environments
Pass--env=<name> to any mad command to select a different environment section from env.md:
--env, MarkApiDown uses the default-env value from api-docs/mad.md (set to dev by mad init).
In the browser UI (mad serve), use the environment switcher dropdown in the top navigation bar to change environments globally for all requests made from that session.
Adding a new environment
Openapi-docs/_shared/env.md and add a new ## <name> section with its yaml block:
mad exec ... --env=qa immediately — no restarts or rebuilds required.
Keeping secrets out of markdown
.env.local format
Create .env.local at your project root (the directory that contains api-docs/). Each line is a KEY=VALUE pair. Lines starting with # are comments.
mad init automatically adds .env.local to your .gitignore. Verify this with mad doctor.
MAD_* environment variables
Set MAD_-prefixed variables in your shell, CI secrets store, or container environment. MarkApiDown strips the prefix and converts SCREAMING_SNAKE_CASE to camelCase automatically:
| Environment variable | Template variable |
|---|---|
MAD_API_TOKEN | {{apiToken}} |
MAD_BASE_URL | {{baseUrl}} |
MAD_STRIPE_SECRET_KEY | {{stripeSecretKey}} |
One-off variable overrides
Use--var for a single run without touching any file:
--var multiple times to inject several values in one command.