> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markpdf.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /convert

> Upload a document as multipart/form-data and receive Markdown.

# POST /convert

Converts a document uploaded as `multipart/form-data`. It is the natural route for web forms and clients that already handle attachments.

\##Request

```http theme={null}
POST /convert?mode=fast HTTP/1.1
x-api-key: YOUR_API_KEY
content-type: multipart/form-data; boundary=----xyz
```

The file field is named `file`.

## Query params

<ParamField query="input_format" type="enum" default="auto">
  `pdf`, `docx`, `csv`, `txt`, `xlsx`, `pptx`, `zip`. With `auto` it is detected by extension and then by `content-type`.
</ParamField>

<ParamField query="mode" type="enum" default="fast">
  `fast`, `balanced`, `quality` or `auto`. See [Modes](/docs/concepts/modes).
</ParamField>

<ParamField query="clean" type="boolean" default="true">
  Cleans repeated headers, control lines and Markdown noise.
</ParamField>

<ParamField query="response_format" type="enum" default="markdown">
  `markdown` (raw body) or `json` (object with embedded metadata).
</ParamField>

\##Bodysuit

<ParamField body="file" type="file" required>
  The document to convert. Format detected by file name and `content-type`.
</ParamField>

## Examples

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST "https://api.markpdf.tech/convert?mode=fast" \
    -H "x-api-key: YOUR_API_KEY" \
    -F "file=@report.pdf"
  ```

  ```python Python theme={null}
  import httpx

  with open("report.pdf", "rb") as fh:
      r = httpx.post(
          "https://api.markpdf.tech/convert",
          params={"mode": "fast"},
          headers={"x-api-key": "YOUR_API_KEY"},
          files={"file": ("report.pdf", fh, "application/pdf")},
          timeout=300,
      )
  print(r.text)
  ```

  ```javascript JavaScript theme={null}
  const form = new FormData();
  form.append("file", fileBlob, "report.pdf");

  const res = await fetch("https://api.markpdf.tech/convert?mode=fast", {
    method: "POST",
    headers: { "x-api-key": "YOUR_API_KEY" },
    body: form,
  });
  console.log(await res.text());
  ```
</CodeGroup>

## Answer

By default `text/markdown` plus billing headers. See [Response and headers](/docs/api/response).

<Note>
  For maximum network efficiency on large uploads, use [`POST /convert/raw`](/docs/api/convert-raw) with `content-encoding: gzip` or `zstd`. `multipart` doesn't compress as well.
</Note>
