API reference

Build a pipeline once in the visual builder, then call it programmatically by id. Every API run produces the same full Trace you see in the app — per-step changes, warnings, provenance, duration. Nothing hidden.

Base URL https://markdown4ai.com/api

Authentication

All requests authenticate with an API key passed as a Bearer token in the Authorization header.

Authorization: Bearer <your-api-key>

Generate keys in the app under Settings → developer. Each key is shown once at creation and stored only as a hash; keys are scoped to your account’s data and can be revoked at any time. A key works only on these /v1 endpoints — it can never read or change account settings. Never expose a key in client-side code.

Endpoints

GET /v1/pipelines

List your saved pipelines.

Returns every pipeline you own, so a client can discover the id it needs to run. Scoped to the caller — you only ever see your own pipelines.

Example response
[
  {
    "id": "8f14e45fceea167a",
    "name": "Standard conversion",
    "steps": [
      { "kind": "parse.builtin", "config": {} },
      { "kind": "structure.lists", "config": {} },
      { "kind": "clean.passes", "config": {} },
      { "kind": "export.markdown", "config": {} }
    ],
    "created_at": "2026-01-15T09:24:00+00:00",
    "updated_at": "2026-01-15T09:24:00+00:00"
  }
]
POST /v1/pipelines/{pipeline_id}/run

Run a saved pipeline against a document (PDF, EPUB, HTML, TXT/LOG, or CSV).

Uploads a document (PDF, EPUB, HTML, TXT/LOG, or CSV), runs it through the saved pipeline, records the full Trace, and returns the rendered output. The run is priced per page (one EPUB chapter, 60 lines of plain text, 50 CSV rows, or 4,000 characters of HTML text count as one page) and charged before processing — an empty balance answers 402 and costs nothing. Fetch the complete per-step Trace from GET /v1/runs/{run_id}.

parameter in type notes
pipeline_id path string Id of a pipeline you own (from GET /v1/pipelines). required
file form (multipart) file The document to process (PDF, EPUB, HTML, TXT/LOG, or CSV). Max 100 MB. required
Example response
{
  "run_id": "3c59dc048e885024",
  "markdown": "# Sample Title\n\nHello world.\n",
  "warnings": []
}
GET /v1/runs/{run_id}

Fetch a run's full Trace.

Returns the complete, per-step Trace: each step's config, change log, warnings, duration, and document snapshot — exactly what the app's run view shows. The Trace is owned by your account; another tenant's run id answers 404.

parameterintypenotes
run_id path string Id returned in the run response. required
Example response (abbreviated)
{
  "id": "3c59dc048e885024",
  "source_name": "document.pdf",
  "created_at": "2026-01-15T09:24:31+00:00",
  "trace": {
    "steps": [
      {
        "position": 0,
        "kind": "parse.builtin",
        "config": {},
        "changes": [],
        "warnings": [],
        "duration_ms": 41.2,
        "rendered": null
      },
      {
        "position": 1,
        "kind": "export.markdown",
        "config": {},
        "changes": [],
        "warnings": [],
        "duration_ms": 3.6,
        "rendered": "# Sample Title\n\nHello world.\n"
      }
    ],
    "rendered": "# Sample Title\n\nHello world.\n"
  }
}

Errors

Errors return a JSON body {"detail": "…"} with a user-facing message. Failures are fail-secure — no stack traces, no document content, no internal details.

statusmeaning
400Bad request — unsupported file type, empty file, or an invalid pipeline step.
401Not authenticated — sign in or supply a valid API key.
402Out of credits — this document costs more than your current balance.
404Not found — no pipeline or run with that id that you own.
413Payload too large — the file exceeds the 100 MB maximum.
422Unprocessable — the document could not be read (corrupt or password-protected).

Build a pipeline in the visual builder, then run it via the API — same Trace, same provenance, headlessly.

sign in to get started