# Quickstart

> Create an API key in the dashboard and convert your first document with curl, JavaScript or Python.

## 1. Create an API key

Sign in at [md.tlelabs.com](https://md.tlelabs.com/login) with Google, open [API keys](https://md.tlelabs.com/keys) and create a key. The key (`mdw_live_…`) is shown once: store it in a secret manager or an environment variable.

New accounts start with 0 credits. Credits are added by the operator: write to <md@tlelabs.com>.

## 2. Convert a file

`POST /v1/convert` with `multipart/form-data`; the file goes in the `file` field. Replace `<YOUR_API_KEY>` with your key.

**curl**

```sh
curl -X POST 'https://api.md.tlelabs.com/v1/convert' \
  -H 'Authorization: Bearer <YOUR_API_KEY>' \
  -F 'file=@document.pdf' \
  -F 'ocr=auto'
```

**JavaScript**

```js
import { readFile } from "node:fs/promises";

const form = new FormData();
form.append("file", new Blob([await readFile("document.pdf")]), "document.pdf");
form.append("ocr", "auto");

const response = await fetch("https://api.md.tlelabs.com/v1/convert", {
  method: "POST",
  headers: { Authorization: "Bearer <YOUR_API_KEY>" },
  body: form,
});
const result = await response.json();
console.log(result.markdown);
```

**Python**

```py
import requests

with open("document.pdf", "rb") as file:
    response = requests.post(
        "https://api.md.tlelabs.com/v1/convert",
        headers={"Authorization": "Bearer <YOUR_API_KEY>"},
        files={"file": file},
        data={"ocr": "auto"},
    )
print(response.json()["markdown"])
```

## 3. Read the result

The JSON response holds the Markdown and what the conversion cost:

```json
{
  "markdown": "# Quarterly report\n\nRevenue grew 12%…",
  "format": "pdf",
  "usage": { "pages": 10, "ocr_pages": 3, "credits_charged": 16, "credits_remaining": 9984, "ocr_page_credits": 3 },
  "metadata": { "byte_size": 524288, "duration_ms": 1842, "ocr_model": "auto", "ocr_models_used": ["openparser/paddleocr-vl-1.6"] },
  "warnings": []
}
```

## Next steps

- [Convert a file](https://md.tlelabs.com/docs/convert/): OCR options and the plain Markdown response.
- [Quote before converting](https://md.tlelabs.com/docs/quote/): know the price before you spend credits.
- [Errors](https://md.tlelabs.com/docs/errors/): what to retry and what to fix.
