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

# Quickstart

> Go from an API key to your first query in a few minutes

This guide walks you through creating a workspace, ingesting a document, and running your first query against it.

## Prerequisites

Before you begin, you need:

* An AiQL API key from the [Dashboard](https://app.aiql.io)
* A source document to ingest (a URL or storage path AiQL can reach)
* `curl`, or the [Python](/sdks/python) or [TypeScript](/sdks/typescript) SDK installed

<Tip>
  Store your API key in an environment variable rather than pasting it into commands. The examples below read from `AIQL_API_KEY`.
</Tip>

## Get started

<Steps>
  <Step title="Set your API key">
    Export your key so the following commands can use it.

    ```bash theme={null}
    export AIQL_API_KEY="your_api_key"
    ```
  </Step>

  <Step title="Create a workspace">
    A workspace holds your ingested data. Create one and note the `id` in the response.

    <CodeGroup>
      ```bash curl theme={null}
      curl -X POST https://api.aiql.io/workspaces \
        -H "Authorization: Bearer $AIQL_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{"name": "Quickstart"}'
      ```

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

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

      workspace = client.workspaces.create(name="Quickstart")
      print(workspace.id)
      ```

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

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

      const workspace = await client.workspaces.create({ name: "Quickstart" });
      console.log(workspace.id);
      ```
    </CodeGroup>
  </Step>

  <Step title="Ingest a document">
    Start an ingestion to run the full `convert → split → shape → extract` pipeline and load the result into your workspace. Pass the workspace ID in the `AiQL-Workspace` header.

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

      ```python Python theme={null}
      ingestion = client.ingestions.create(
          workspace_id=workspace.id,
          url="https://example.com/report.pdf",
      )
      print(ingestion.id)
      ```

      ```typescript TypeScript theme={null}
      const ingestion = await client.ingestions.create({
        workspaceId: workspace.id,
        url: "https://example.com/report.pdf",
      });
      console.log(ingestion.id);
      ```
    </CodeGroup>
  </Step>

  <Step title="Check ingestion status">
    Ingestions run asynchronously. Poll the ingestion until it finishes.

    <CodeGroup>
      ```bash curl theme={null}
      curl https://api.aiql.io/ingestions/YOUR_INGESTION_ID \
        -H "Authorization: Bearer $AIQL_API_KEY" \
        -H "AiQL-Workspace: YOUR_WORKSPACE_ID"
      ```

      ```python Python theme={null}
      ingestion = client.ingestions.get(ingestion.id)
      print(ingestion.status)
      ```

      ```typescript TypeScript theme={null}
      const status = await client.ingestions.get(ingestion.id);
      console.log(status.status);
      ```
    </CodeGroup>
  </Step>

  <Step title="Run a query">
    Once the ingestion finishes, query your data in natural language.

    <CodeGroup>
      ```bash curl theme={null}
      curl -X POST https://api.aiql.io/queries \
        -H "Authorization: Bearer $AIQL_API_KEY" \
        -H "AiQL-Workspace: YOUR_WORKSPACE_ID" \
        -H "Content-Type: application/json" \
        -d '{"content": "summarize the key findings"}'
      ```

      ```python Python theme={null}
      query = client.queries.create(
          workspace_id=workspace.id,
          content="summarize the key findings",
      )
      result = client.queries.get(query.id)
      print(result)
      ```

      ```typescript TypeScript theme={null}
      const query = await client.queries.create({
        workspaceId: workspace.id,
        content: "summarize the key findings",
      });
      const result = await client.queries.get(query.id);
      console.log(result);
      ```
    </CodeGroup>
  </Step>
</Steps>

## Next steps

<Columns cols={2}>
  <Card title="Authentication" icon="key" href="/authentication">
    Learn how Bearer tokens and the workspace header secure your requests.
  </Card>

  <Card title="SDKs" icon="code" href="/sdks/overview">
    Use the typed Python and TypeScript clients in your application.
  </Card>

  <Card title="Pricing" icon="credit-card" href="/pricing">
    See how credits are billed across tools, ingestions, and queries.
  </Card>

  <Card title="Tools" icon="wrench" href="/sdks/overview">
    Run individual pipeline steps with `convert`, `split`, `shape`, and `extract`.
  </Card>
</Columns>

<Tip>
  Need help? Reach out at [support@aiql.io](mailto:support@aiql.io).
</Tip>
