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

# Get Started with FileRouter in Minutes

> Install the TypeScript SDK, authenticate with your API key, and parse your first document through the hosted FileRouter service in under five minutes.

This guide walks you through parsing a document using the hosted `FileRouterClient` from `@file_router/sdk`. By the end you will have called `parse()` against a live URL and seen structured markdown output, then run `compare()` to benchmark the same file across multiple providers.

## Prerequisites

* **Node.js ≥ 22.14.0** installed on your machine.
* **A FileRouter API key** — see [Authentication](/authentication) if you do not have one yet.

<Steps>
  ### Install the SDK

  Add `@file_router/sdk` to your project using your preferred package manager.

  <CodeGroup>
    ```bash npm theme={null}
    npm install @file_router/sdk
    ```

    ```bash yarn theme={null}
    yarn add @file_router/sdk
    ```

    ```bash pnpm theme={null}
    pnpm add @file_router/sdk
    ```
  </CodeGroup>

  ### Set your API key

  Store your FileRouter API key in an environment variable. The client reads `FILEROUTER_API_KEY` automatically, so you never have to hard-code a secret.

  ```bash .env theme={null}
  FILEROUTER_API_KEY=your_api_key_here
  ```

  ### Create a client

  Import `FileRouterClient` and instantiate it. Because you set `FILEROUTER_API_KEY` in the previous step, you can construct the client with no arguments — it reads the environment variable automatically.

  ```ts index.ts theme={null}
  import { FileRouterClient } from "@file_router/sdk"

  const client = new FileRouterClient()
  ```

  ### Parse a document

  Call `client.parse()` with a URL and an `outputs` array. Here you request `markdown` output using LlamaParse.

  ```ts index.ts theme={null}
  const result = await client.parse("https://example.com/report.pdf", {
    provider: "llamaparse",
    outputs: ["markdown"],
  })

  console.log(result.outputs.markdown) // Full document as a markdown string
  console.log(result.pageCount)        // Number of pages processed
  console.log(result.provider)         // "llamaparse"
  ```

  <Note>
    `client.parse()` accepts more than just URLs. You can also pass a local file path, a `File`, `Blob`, `ArrayBuffer`, a typed array view, or a web stream — the SDK resolves whatever form your data is already in.
  </Note>

  The client submits a job to the hosted API, polls until the result is ready, and returns the completed `ParseResult`. You do not need to manage polling or job IDs yourself.

  ### Compare providers

  Use `client.compare()` to send the same document to several providers at once. This is useful when you want to evaluate output quality before committing to a single provider.

  ```ts index.ts theme={null}
  const comparison = await client.compare("https://example.com/report.pdf", {
    providers: ["llamaparse", "mistral-ocr", "datalab"],
    outputs: ["markdown"],
  })

  for (const entry of comparison.providers) {
    console.log(`\n--- ${entry.provider} (${entry.status}) ---`)
    if (entry.result) {
      console.log(entry.result.outputs.markdown)
    } else if (entry.error) {
      console.error(entry.error.message)
    }
  }
  ```

  `compare()` returns a `CompareResult` whose `providers` array contains one `CompareProviderResult` per provider. Each entry has a `provider` string, a `status` of `"parsed"`, `"failed"`, or `"unsupported"`, an optional `result` with the full `ParseResult`, and an optional `error` if the provider failed.
</Steps>

## What to do next

<CardGroup cols={2}>
  <Card title="Authentication" icon="lock" href="/authentication">
    Learn all the ways to supply your API key, including the CLI login flow.
  </Card>

  <Card title="SDK Installation" icon="cube" href="/sdk/installation">
    Explore advanced parse options, provider-specific settings, and BYOK mode.
  </Card>
</CardGroup>
