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

# extract

Extracts structured data from the page based on a natural language instruction and a JSON schema.
This uses AI to understand the instruction and locate the relevant information.
Example: `extract(instruction: "Extract the product name and price", schema: { type: "object", properties: { name: { type: "string" }, price: { type: "number" } } })`
Returns the extracted data as a JSON object.

## Definition

```graphql theme={null}
extract(
  instruction: String!
  schema: JSONObject!
  options: ExtractOptions
): JSON!
```

## Arguments

### `instruction`

[String!](/reference/graphql/scalars/string)

A natural language instruction describing what data to extract.
Example: `"Get the user's name and email from the profile page."`

### `schema`

[JSONObject!](/reference/graphql/scalars/jsonobject)

A JSON schema defining the structure of the data to be extracted.
Example: `{ "type": "object", "properties": { "productName": { "type": "string" }, "price": { "type": "number" } } }`

### `options`

[ExtractOptions](/reference/graphql/inputs/extract-options)

Options for the extraction process, like specifying a root selector or timeout.

## Returns

[JSON!](/reference/graphql/scalars/json)

The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
