> ## 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 a Markdown document according to a JSON schema, with character-span grounding into the source Markdown. Runs synchronously and returns the result inline.



## OpenAPI

````yaml /dpt3/openapi-adev2.json post /v2/extract
openapi: 3.1.0
info:
  title: >-
    LandingAI Agentic Document Extraction (ADE) API v2: Parse and Extract
    Documents with DPT-3
  description: >-
    Parse and extract data from documents with DPT-3, a document parsing model
    from LandingAI, using the Agentic Document Extraction (ADE) v2 endpoints.
    Parse converts PDFs and images into structured Markdown and elements with
    per-element grounding (page numbers and coordinates) for RAG, search, and
    extraction pipelines. Extract pulls specific fields from parsed Markdown
    using a JSON schema. Documentation: https://docs.landing.ai
  version: 1.0.0
servers:
  - url: https://api.ade.landing.ai
    description: Production vision tools API
security: []
paths:
  /v2/extract:
    post:
      tags:
        - Extract
      summary: ADE Extract
      description: >-
        Extract structured data from a Markdown document according to a JSON
        schema, with character-span grounding into the source Markdown. Runs
        synchronously and returns the result inline.
      operationId: v2-extract_run_sync
      requestBody:
        required: true
        content:
          application/json:
            schema:
              description: >-
                Input to V2ExtractOperationWorkflow.


                Provide the markdown as an inline ``markdown`` string, as a
                multipart file

                part named ``markdown`` (for large inputs — the gateway stages
                the upload

                internally), or via a public ``markdown_url``. Exactly one
                source must be

                supplied.
              properties:
                schema:
                  additionalProperties: true
                  description: >-
                    JSON Schema describing the fields to extract. The schema
                    must be an object type with a ``properties`` map of field
                    names to their types and descriptions.
                  example:
                    properties:
                      revenue:
                        description: Q1 revenue figure
                        type: string
                      summary:
                        description: Executive summary
                        type: string
                    type: object
                  title: Schema
                  type: object
                markdown:
                  anyOf:
                    - type: string
                    - type: 'null'
                  default: null
                  description: >-
                    Markdown string to extract from, or a multipart FILE part
                    carrying the markdown (large inputs — uploads are staged by
                    the gateway). Can come from any source — LandingAI parse
                    output, a third-party parser, or hand-authored text. When
                    the markdown was produced by ``POST /v2/parse``, it ends
                    with a ``<!-- doc_id=<id> -->`` comment that the service
                    reads automatically and echoes as ``metadata.doc_id``.
                  title: Markdown
                markdown_url:
                  anyOf:
                    - type: string
                    - type: 'null'
                  default: null
                  description: >-
                    URL to fetch the markdown from. Must be a public http(s)
                    URL; private/loopback IPs are rejected at submit time.
                  title: Markdown Url
                model:
                  anyOf:
                    - type: string
                    - type: 'null'
                  default: null
                  description: >-
                    The version of the model to use for extraction. Use
                    ``extract-latest`` to use the latest version.
                  title: Model
                options:
                  anyOf:
                    - $ref: '#/components/schemas/V2ExtractOptions'
                    - type: 'null'
                  default: null
                  description: Extraction options (``strict``). Omit for defaults.
              required:
                - schema
              title: V2ExtractRequest
              type: object
          multipart/form-data:
            schema:
              type: object
              properties:
                schema:
                  additionalProperties: true
                  description: >-
                    JSON Schema describing the fields to extract. The schema
                    must be an object type with a ``properties`` map of field
                    names to their types and descriptions. JSON-serialized
                    string in form data.
                  example:
                    properties:
                      revenue:
                        description: Q1 revenue figure
                        type: string
                      summary:
                        description: Executive summary
                        type: string
                    type: object
                  title: Schema
                  type: object
                markdown:
                  anyOf:
                    - type: string
                      description: >-
                        Markdown string to extract from, or a multipart FILE
                        part carrying the markdown (large inputs — uploads are
                        staged by the gateway). Can come from any source —
                        LandingAI parse output, a third-party parser, or
                        hand-authored text. When the markdown was produced by
                        ``POST /v2/parse``, it ends with a ``<!-- doc_id=<id>
                        -->`` comment that the service reads automatically and
                        echoes as ``metadata.doc_id``.
                    - type: string
                      format: binary
                      description: File upload.
                markdown_url:
                  anyOf:
                    - type: string
                    - type: 'null'
                  default: null
                  description: >-
                    URL to fetch the markdown from. Must be a public http(s)
                    URL; private/loopback IPs are rejected at submit time.
                    JSON-serialized string in form data.
                  title: Markdown Url
                model:
                  anyOf:
                    - type: string
                    - type: 'null'
                  default: null
                  description: >-
                    The version of the model to use for extraction. Use
                    ``extract-latest`` to use the latest version.
                    JSON-serialized string in form data.
                  title: Model
                options:
                  anyOf:
                    - $ref: '#/components/schemas/V2ExtractOptions'
                    - type: 'null'
                  default: null
                  description: >-
                    Extraction options (``strict``). Omit for defaults.
                    JSON-serialized string in form data.
              required:
                - schema
      responses:
        '200':
          description: v2-extract result
          content:
            application/json:
              schema:
                description: >-
                  Result returned by V2ExtractOperationWorkflow — the
                  ``/v2/extract``

                  response body (``docs/extract-v2-proposal.md`` → Response).


                  ``extraction`` and ``extraction_metadata`` mirror each other
                  structurally:

                  leaf values in ``extraction`` are replaced by
                  ``ExtractionFieldMetadata``

                  objects in ``extraction_metadata``.
                properties:
                  extraction:
                    additionalProperties: true
                    description: Extracted values conforming to the request ``schema``.
                    title: Extraction
                    type: object
                  extraction_metadata:
                    additionalProperties: true
                    description: >-
                      Per-field metadata, mirroring ``extraction`` with leaf
                      values replaced by ``{value, spans}`` objects.
                    title: Extraction Metadata
                    type: object
                  markdown:
                    description: Echoed input markdown.
                    title: Markdown
                    type: string
                  metadata:
                    $ref: '#/components/schemas/V2ExtractMetadata'
                    description: >-
                      Request metadata (job_id, version, duration_ms, doc_id,
                      credit_usage).
                required:
                  - extraction
                  - extraction_metadata
                  - markdown
                  - metadata
                title: V2ExtractResult
                type: object
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST 'https://api.ade.landing.ai/v2/extract' \
              -H 'Authorization: Bearer YOUR_API_KEY' \
              -F 'markdown=@parse-output.md' \
              -F 'schema={"type":"object","properties":{"revenue":{"type":"string","description":"Q1 2024 revenue"}}}'
        - lang: Python
          label: Python
          source: >-
            import json

            import requests


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

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


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

            data = {
                'schema': json.dumps({
                    'type': 'object',
                    'properties': {
                        'revenue': {'type': 'string', 'description': 'Q1 2024 revenue'}
                    }
                })
            }


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

            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('parse-output.md'));
            form.append('schema', JSON.stringify({
              type: 'object',
              properties: {
                revenue: { type: 'string', description: 'Q1 2024 revenue' }
              }
            }));

            axios.post('https://api.ade.landing.ai/v2/extract', form, {
              headers: { 'Authorization': 'Bearer YOUR_API_KEY', ...form.getHeaders() }
            })
              .then(response => console.log(response.data))
              .catch(error => console.error(error));
components:
  schemas:
    V2ExtractOptions:
      description: Extraction options (``docs/extract-v2-proposal.md`` → Options).
      properties:
        strict:
          default: false
          description: >-
            When ``true``, returns HTTP 422 if the schema contains fields the
            model cannot extract. When ``false`` (default), unsupported fields
            are skipped and extraction continues.
          title: Strict
          type: boolean
      title: V2ExtractOptions
      type: object
    V2ExtractMetadata:
      description: Response metadata for a v2 extract call.
      properties:
        job_id:
          description: >-
            Gateway job id (workflow id). Matches the ``x-request-id`` the
            gateway minted for this request and the billing row id in
            vision-agent.
          title: Job Id
          type: string
        version:
          description: Resolved model version.
          title: Version
          type: string
        duration_ms:
          description: End-to-end request duration in milliseconds.
          title: Duration Ms
          type: integer
        doc_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Present when the input markdown contained a ``<!-- doc_id=<id> -->``
            comment (embedded by ``POST /v2/parse``). Links this extract call to
            the originating parse job.
          title: Doc Id
        credit_usage:
          default: 0
          description: Credits billed for this request.
          title: Credit Usage
          type: number
        billing:
          anyOf:
            - $ref: '#/components/schemas/V2Billing'
            - type: 'null'
          description: >-
            Billing summary: the service tier the request ran in and the credits
            charged.
      required:
        - job_id
        - version
        - duration_ms
      title: V2ExtractMetadata
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    V2Billing:
      description: |-
        Billing summary: the service tier the request ran in and the credits
        charged.
      properties:
        service_tier:
          anyOf:
            - enum:
                - standard
                - priority
              type: string
            - type: 'null'
          default: null
          description: >-
            The service tier the request ran in: `standard` or `priority`. A
            sync request reports `priority` (same lane, same price).
          title: Service Tier
        total_credits:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          description: Credits charged for this request.
          title: Total Credits
      title: V2Billing
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````