> ## 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.

# Quickstart

> Your first conversion with Python SDK in less than 15 lines.

# Quickstart

## Convert a local file

```python theme={null}
import markpdf

client = markpdf.Client(api_key="YOUR_API_KEY")

markdown = client.convert_file("report.pdf", mode="fast")
print(markdown)
```

`convert_file` uploads the document, waits for the response and returns the Markdown as `str`. Detects the input format by the file extension unless you pass `input_format`.

## Convert from URL

```python theme={null}
markdown = client.convert_from_url(
    "https://bucket.example.com/report.pdf?sig=...",
    mode="fast",
)
```

## Asynchronous client

```python theme={null}
import asyncio
import markpdf

async def main():
    async with markpdf.AsyncClient(api_key="YOUR_API_KEY") as client:
        markdown = await client.convert_file("report.pdf", mode="fast")
        print(markdown)

asyncio.run(main())
```

<Tip>
  Use `AsyncClient` if you already run in an event loop (FastAPI, aiohttp, etc.) so as not to block the thread while waiting for the response.
</Tip>

## Request metadata in addition to Markdown

```python theme={null}
result = client.convert_file("report.pdf", response_format="json")

print(result.markdown)
print(result.timings.total_request_ms)
print(result.token_saved_estimate)
```

With `response_format="json"` the SDK returns a typed `ConversionResult` object instead of a `str`. See [Reference](/docs/sdks/python/reference) for all fields.

## Siguiente paso

* [Full customer reference](/docs/sdks/python/reference)
* [Streaming and asynchronous jobs (202)](/docs/sdks/python/streaming-and-async)
* [Error Handling](/docs/sdks/python/error-handling)
