# structuredExtractDocument

**Identifier:** `mistraldocuments_structuredExtractDocument`

**Provider:** [Mistral Document & Vision](https://kirha.com/providers/mistraldocuments.md)

Extract structured data from a document using AI-powered analysis. Define the output keys you want to extract (e.g., invoiceNumber, totalAmount, date) and the tool will automatically extract those fields from the document. These output keys can be used as inputs for other tools to enable tool chaining.

## Run it with the CLI

```bash
kirha tools run mistraldocuments_structuredExtractDocument \
  --input '{
    "documentUrl": "<documentUrl>",
    "outputKeys": [
      {
        "key": "<key>",
        "description": "<description>"
      }
    ]
  }'
```

`--input` takes a JSON object that matches the input schema. Pass `--input -` to read it from stdin.

## Call it over HTTP

```bash
curl https://api.kirha.com/tools/v1/execute \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: **********' \
  --data '{
  "tool_name": "mistraldocuments_structuredExtractDocument",
  "input": {
    "documentUrl": "<documentUrl>",
    "outputKeys": [
      {
        "key": "<key>",
        "description": "<description>"
      }
    ]
  }
}'
```

Replace the stars with an API key from https://app.kirha.com/api-keys.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "documentUrl": {
      "description": "URL of the document to extract data from (supports PDF, PNG, JPEG, AVIF, PPTX, DOCX, max 50MB)",
      "type": "string"
    },
    "outputKeys": {
      "description": "List of fields to extract from the document with their descriptions (e.g., [{ key: 'invoiceNumber', description: 'The unique invoice reference number' }]). The descriptions help the AI understand what to extract.",
      "items": {
        "properties": {
          "description": {
            "description": "Description of what this field represents and how to extract it from the document",
            "type": "string"
          },
          "key": {
            "description": "The field name to extract from the document",
            "type": "string"
          }
        },
        "required": [
          "key",
          "description"
        ],
        "type": "object"
      },
      "minItems": 1,
      "type": "array"
    }
  },
  "required": [
    "documentUrl",
    "outputKeys"
  ],
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "context": {
      "type": "string"
    },
    "data": {
      "additionalProperties": {},
      "description": "An object containing the structured data extracted from the document, with each key corresponding to the schema specified in the input.",
      "propertyNames": {
        "type": "string"
      },
      "type": "object"
    }
  },
  "required": [
    "context",
    "data"
  ],
  "type": "object"
}
```

-----

[All Mistral Document & Vision tools](https://kirha.com/providers/mistraldocuments.md) · [< Back to tools list](https://kirha.com/tools.md)