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

# Convert a document

> Normalize a source document into clean text with the convert tool

The `convert` tool is the first step of the pipeline. It takes any URL and normalizes its contents into clean markdown that the other tools can process.

## Prerequisites

* An AiQL API key in the `AIQL_API_KEY` environment variable
* A URL AiQL can reach

## Convert a URL

Send the location of your source as `url`. It can be a file URL of any extension, a web page, a YouTube video, or any other URL. Tool requests authenticate with a Bearer token and do not need a workspace.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.aiql.io/convert \
    -H "Authorization: Bearer $AIQL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"url": "https://example.com/report.pdf"}'
  ```

  ```python Python theme={null}
  import os
  from aiql import AiQL

  client = AiQL(api_key=os.environ["AIQL_API_KEY"])

  markdown = client.tools.convert(url="https://example.com/report.pdf")
  print(markdown)
  ```

  ```typescript TypeScript theme={null}
  import { AiQL } from "@aiql.io/sdk";

  const client = new AiQL({ apiKey: process.env.AIQL_API_KEY });

  const markdown = await client.tools.convert({
    url: "https://example.com/report.pdf",
  });
  console.log(markdown);
  ```
</CodeGroup>

The response contains the normalized markdown, which is what later steps and billing operate on.

## Next step

Pass the converted markdown to [Split](/cookbooks/split) to break it into smaller chunks.

<Note>
  `convert` is billed at 5 credits per page, counted after the source document is normalized, with a minimum of 1 credit. See [Pricing](/pricing) for details.
</Note>
