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

# ADE Extract

> Extract structured data from Markdown using a JSON schema.

This endpoint
    processes Markdown content and extracts structured data according to the provided
    JSON schema.

For EU users, use this endpoint:


    `https://api.va.eu-west-1.landing.ai/v1/ade/extract`.



## OpenAPI

````yaml /ade/va_openapi_ade2.json post /v1/ade/extract
openapi: 3.1.0
info:
  title: Vision Tools API
  version: 0.1.0
servers:
  - url: https://api.va.landing.ai
    description: Production vision tools API
security: []
paths:
  /v1/ade/extract:
    post:
      tags:
        - Tools
      summary: ADE Extract
      description: |-
        Extract structured data from Markdown using a JSON schema.

        This endpoint
            processes Markdown content and extracts structured data according to the provided
            JSON schema.

        For EU users, use this endpoint:


            `https://api.va.eu-west-1.landing.ai/v1/ade/extract`.
      operationId: tool_ade_extract_v1_ade_extract_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ExtractRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtractResponse'
        '206':
          description: >-
            Extraction completed with success but there was a schema validation
            error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtractResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit exceeded
      security:
        - Basic Auth: []
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST 'https://api.va.landing.ai/v1/ade/extract' \
              -H 'Authorization: Bearer YOUR_API_KEY' \
              -F 'schema={"type": "object", "properties": {"field1": {"type": "string"}, "field2": {"type": "string"}}}' \
              -F 'markdown=@markdown.md' \
              -F 'model=extract-latest'
        - lang: Python
          label: Python
          source: >-
            import requests


            headers = {
                'Authorization': 'Bearer YOUR_API_KEY'
            }


            url = 'https://api.va.landing.ai/v1/ade/extract'


            # Read the schema file as a string

            with open('schema.json', 'r') as f:
                schema_content = f.read()

            # Prepare files and data

            files = {'markdown': open('markdown.md', 'rb')}

            data = {
                'schema': schema_content,
                'model': 'extract-latest'
            }


            # Run extraction

            response = requests.post(url, files=files, data=data,
            headers=headers)


            # Return the results

            print(response.json())
        - lang: JavaScript
          label: Node.js
          source: |-
            const axios = require('axios');
            const FormData = require('form-data');
            const fs = require('fs');

            const form = new FormData();
            form.append('markdown', fs.createReadStream('markdown.md'));
            form.append('schema', fs.readFileSync('schema.json', 'utf8'));
            form.append('model', 'extract-latest');

            axios.post('https://api.va.landing.ai/v1/ade/extract', form, {
              headers: {
                'Authorization': 'Bearer YOUR_API_KEY',
                ...form.getHeaders()
              }
            })
            .then(response => console.log(response.data))
            .catch(error => console.error(error));
components:
  schemas:
    ExtractRequest:
      properties:
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: >-
            The version of the model to use for extraction. Use `extract-latest`
            to use the latest version.
        markdown:
          anyOf:
            - type: string
              format: binary
            - type: string
            - type: 'null'
          title: Markdown
          description: The Markdown file or Markdown content to extract data from.
        markdown_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Markdown Url
          description: The URL to the Markdown file to extract data from.
        schema:
          type: string
          title: Schema
          description: >-
            JSON schema for field extraction. This schema determines what
            key-values pairs are extracted from the Markdown. The schema must be
            a valid JSON object and will be validated before processing the
            document.
        strict:
          type: boolean
          title: Strict
          description: >-
            If True, reject schemas with unsupported fields (HTTP 422). If
            False, prune unsupported fields and continue. Only applies to
            extract versions that support schema validation.
          default: false
      type: object
      required:
        - schema
      title: ExtractRequest
    ExtractResponse:
      properties:
        extraction:
          type: object
          title: Extraction
          description: The extracted key-value pairs.
        extraction_metadata:
          type: object
          title: Extraction Metadata
          description: The extracted key-value pairs and the chunk_reference for each one.
        metadata:
          $ref: '#/components/schemas/ExtractMetadata'
          description: The metadata for the extraction process.
      type: object
      required:
        - extraction
        - extraction_metadata
        - metadata
      title: ExtractResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ExtractMetadata:
      properties:
        filename:
          type: string
          title: Filename
        org_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Org Id
        duration_ms:
          type: integer
          title: Duration Ms
        credit_usage:
          type: number
          title: Credit Usage
        job_id:
          type: string
          title: Job Id
        version:
          anyOf:
            - type: string
            - type: 'null'
          title: Version
        schema_violation_error:
          anyOf:
            - type: string
            - type: 'null'
          title: Schema Violation Error
          description: >-
            A detailed error message shows why the extracted data does not fully
            conform to the input schema. Null means the extraction result is
            consistent with the input schema.
        fallback_model_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Fallback Model Version
          description: >-
            The extract model that was actually used to extract the data when
            the initial extraction attempt failed with the requested version.
        warnings:
          items:
            $ref: '#/components/schemas/ExtractWarning'
          type: array
          title: Warnings
          description: >-
            Structured warnings from the extraction process. Each warning is an
            instance of ExtractWarning with 'code' (e.g. 'nonconformant_schema')
            and 'msg' (human-readable description). Present only for extract
            versions from extract-20260314 and above that support structured
            warnings.
      type: object
      required:
        - filename
        - org_id
        - duration_ms
        - credit_usage
        - job_id
        - version
      title: ExtractMetadata
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ExtractWarning:
      properties:
        code:
          $ref: '#/components/schemas/ExtractWarningCode'
          description: The type of warning, used to translate to a status code downstream
        msg:
          type: string
          title: Msg
          description: Human-readable description of the warning with more details
      type: object
      required:
        - code
        - msg
      title: ExtractWarning
    ExtractWarningCode:
      type: string
      enum:
        - nonconformant_schema
        - nonconformant_output
      title: ExtractWarningCode
  securitySchemes:
    Basic Auth:
      type: http
      description: >-
        Your unique API key for authentication.


        Get your API key here: https://va.landing.ai/settings/api-key.


        If using the EU endpoint, get your API key here:
        https://va.eu-west-1.landing.ai/settings/api-key.
      scheme: bearer
      bearerFormat: Basic

````