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

# Infer a schema

> Discover the schema of your data with the shape tool

The `shape` tool inspects your markdown content and infers a schema of the data it contains. It returns the classes, properties, and relationships so you know what is available to extract.

## Prerequisites

* An AiQL API key in the `AIQL_API_KEY` environment variable
* Markdown content from the [Convert](/cookbooks/convert) or [Split](/cookbooks/split) step

## Infer the schema

Send the markdown you want to inspect. 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/shape \
    -H "Authorization: Bearer $AIQL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"markdown": "# Report\n\nThe markdown content..."}'
  ```

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

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

  schema = client.tools.shape(markdown=markdown)
  print(schema.classes)
  ```

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

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

  const schema = await client.tools.shape({ markdown });
  console.log(schema.classes);
  ```
</CodeGroup>

The response is a schema made of `classes`, `properties`, and `relationships`:

* A **class** has a `name` and a `definition`.
* A **property** has a `name`, a `definition`, and a `domain` (the class or classes it applies to).
* A **relationship** has a `name`, a `definition`, a `domain` (the class or classes it starts from), and a `range` (the class or classes it points to).

Use it to decide what to pull in the next step.

## Next step

Pass the schema to [Extract](/cookbooks/extract) to pull its values out of the markdown.

<Note>
  `shape` is billed at 10 credits per 1,000 words, with a minimum of 1 credit. See [Pricing](/pricing) for details.
</Note>
