Use
MarkItDown Python API reference
This is the lookup table for the library's public API. Signatures were read from the installed 0.1.9 package, so they are what the code accepts; examples that we ran are on the Python API page.
Short answer
Create one MarkItDown() and reuse it: it loads its file-type model at construction. Call convert(source), where source is a path, a URL or a file object, and read .markdown from the result.
Tested with markitdown 0.1.9 · Python 3.13 · markitdown 0.1.9; signatures read with `inspect`; first-appearance versions from the upstream git history (T09) · 2026-11-16 · evidence: api-surface.json
Classes and methods
MarkItDown
class · since 0.1.0
The converter. Create one and reuse it: it loads the file-type model at construction.
MarkItDown(self, *, enable_builtins: Optional[bool] = None, enable_plugins: Optional[bool] = None, **kwargs) MarkItDown.__init__
constructor · since 0.1.0
Keyword-only options: enable_builtins (default on), enable_plugins (default off) and converter options passed as keyword arguments (see the kwargs table).
MarkItDown.__init__(self, *, enable_builtins: Optional[bool] = None, enable_plugins: Optional[bool] = None, **kwargs) MarkItDown.convert
method · since 0.1.0
Dispatcher: takes a path (str or Path), a URL or file:/data: URI string, a requests.Response or a binary stream and calls the matching convert_* method.
MarkItDown.convert(self, source: Union[str, Response, pathlib.Path, BinaryIO], *, stream_info: Optional[StreamInfo] = None, **kwargs: Any) -> DocumentConverterResult MarkItDown.convert_local
method · since 0.1.0
Convert a file on disk. Missing files raise FileNotFoundError, folders IsADirectoryError.
MarkItDown.convert_local(self, path: Union[str, pathlib.Path], *, stream_info: Optional[StreamInfo] = None, file_extension: Optional[str] = None, url: Optional[str] = None, **kwargs: Any) -> DocumentConverterResult MarkItDown.convert_response
method · since 0.1.0
Convert a requests.Response you fetched yourself (headers and file name are used as hints).
MarkItDown.convert_response(self, response: Response, *, stream_info: Optional[StreamInfo] = None, file_extension: Optional[str] = None, url: Optional[str] = None, **kwargs: Any) -> DocumentConverterResult MarkItDown.convert_stream
method · since 0.1.0
Convert a binary stream. Non-seekable streams are copied into memory first. file_extension and url are deprecated in favour of stream_info.
MarkItDown.convert_stream(self, stream: BinaryIO, *, stream_info: Optional[StreamInfo] = None, file_extension: Optional[str] = None, url: Optional[str] = None, **kwargs: Any) -> DocumentConverterResult MarkItDown.convert_uri
method · since 0.1.1
Convert an http, https, file or data URI. http(s) fetches use the instance's requests session.
MarkItDown.convert_uri(self, uri: str, *, stream_info: Optional[StreamInfo] = None, file_extension: Optional[str] = None, mock_url: Optional[str] = None, **kwargs: Any) -> DocumentConverterResult MarkItDown.convert_url
method · since 0.1.0
Alias of convert_uri kept for older code.
MarkItDown.convert_url(self, url: str, *, stream_info: Optional[StreamInfo] = None, file_extension: Optional[str] = None, mock_url: Optional[str] = None, **kwargs: Any) -> DocumentConverterResult MarkItDown.enable_builtins
method · since 0.1.0
Register the built-in converters (called automatically unless enable_builtins=False).
MarkItDown.enable_builtins(self, **kwargs) -> None MarkItDown.enable_plugins
method · since 0.1.0
Load third-party converters from the 'markitdown.plugin' entry-point group.
MarkItDown.enable_plugins(self, **kwargs) -> None MarkItDown.register_converter
method · since 0.1.0
Add a converter. Lower priority numbers run first; at equal priority the most recently registered runs first.
MarkItDown.register_converter(self, converter: DocumentConverter, *, priority: float = 0.0) -> None MarkItDown.register_page_converter
method · since 0.1.0
Older name of register_converter (deprecated).
MarkItDown.register_page_converter(self, converter: DocumentConverter) -> None DocumentConverter
class · since 0.1.0
Base class for converters: implement accepts() and convert().
DocumentConverter(self, /, *args, **kwargs) DocumentConverterResult
class · since 0.1.0
The return value: .markdown (str), .title (str or None). .text_content is a soft-deprecated alias; str(result) gives the Markdown.
DocumentConverterResult(self, markdown: str, *, title: Optional[str] = None) StreamInfo
dataclass · since 0.1.0
Hints about a stream: mimetype, extension, charset, filename, local_path, url. Frozen; use copy_and_update.
StreamInfo(*, mimetype: Optional[str] = None, extension: Optional[str] = None, charset: Optional[str] = None, filename: Optional[str] = None, local_path: Optional[str] = None, url: Optional[str] = None) -> None FailedConversionAttempt
class · since 0.1.0
One failed attempt: .converter and .exc_info (a plain object, not an exception).
FailedConversionAttempt(self, converter: Any, exc_info: Optional[tuple] = None) Exceptions
MarkItDownException
exception · since 0.1.0
Base class of the library's exceptions.
MarkItDownException(self, /, *args, **kwargs) MissingDependencyException
exception · since 0.1.0
A converter recognised the file but its extra is not installed.
MissingDependencyException(self, /, *args, **kwargs) UnsupportedFormatException
exception · since 0.1.0
No converter attempted the file.
UnsupportedFormatException(self, /, *args, **kwargs) FileConversionException
exception · since 0.1.0
At least one converter tried and failed; .attempts lists each failure.
FileConversionException(self, message: Optional[str] = None, attempts: Optional[List[FailedConversionAttempt]] = None) Keyword arguments
| Argument | Where | What it does | Since |
|---|---|---|---|
requests_session | constructor | Your own requests.Session for http(s) fetches (default: a new session sending Accept: text/markdown, text/html;q=0.9, text/plain;q=0.8, */*;q=0.1). | 0.1.0 |
llm_client | constructor | An OpenAI-style client used to describe images (JPEG/PNG and pictures in PPTX). | 0.1.0 |
llm_model | constructor | Model name passed to the client. | 0.1.0 |
llm_prompt | constructor | Prompt used for image descriptions. | 0.1.0 |
exiftool_path | constructor | Path to ExifTool. A wrong path raises instead of being ignored. | 0.1.0 |
style_map | constructor | Mammoth style map for DOCX. | 0.1.0 |
keep_data_uris | per call | Keep base64 data URIs instead of truncating them. | 0.1.0 |
language | per call | Language hint for audio transcription (added in 0.1.9). | 0.1.9 |
youtube_transcript_languages | per call | Preferred transcript languages for YouTube URLs. | 0.1.0 |
docintel_endpoint | constructor | Azure Document Intelligence endpoint (not tested by us). | 0.1.0 |
docintel_credential | constructor | Azure credential (not tested by us). | 0.1.2 |
docintel_file_types | constructor | File types routed to Document Intelligence (not tested by us). | 0.1.2 |
docintel_api_version | constructor | Document Intelligence API version (not tested by us). | 0.1.2 |
cu_endpoint | constructor | Azure Content Understanding endpoint (not tested by us). | 0.1.6 |
cu_credential | constructor | (not tested by us) | 0.1.6 |
cu_analyzer_id | constructor | (not tested by us) | 0.1.6 |
cu_file_types | constructor | (not tested by us) | 0.1.6 |
mock_url | convert_uri | Pretend the content came from this URL (deprecated; use stream_info). | 0.1.0 |
file_extension | convert_stream / convert_uri | Deprecated; use stream_info. | 0.1.0 |
strict | per call | Used by the HTML and RSS converters (parsing strictness). | 0.1.6 |