> ## 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 Build Extract Schema

> Generate a JSON schema from Markdown using AI.

This endpoint analyzes Markdown
    content and generates a JSON schema suitable for use with the extract endpoint.
    It can also refine an existing schema based on new documents or iterate on a schema
    based on prompt instructions.

For EU users, use this endpoint:


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



## OpenAPI

````yaml /ade/va_openapi_ade2.json post /v1/ade/extract/build-schema
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/build-schema:
    post:
      tags:
        - Tools
      summary: ADE Build Extract Schema
      description: |-
        Generate a JSON schema from Markdown using AI.

        This endpoint analyzes Markdown
            content and generates a JSON schema suitable for use with the extract endpoint.
            It can also refine an existing schema based on new documents or iterate on a schema
            based on prompt instructions.

        For EU users, use this endpoint:


            `https://api.va.eu-west-1.landing.ai/v1/ade/extract/build-schema`.
      operationId: tool_ade_build_schema_v1_ade_extract_build_schema_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/BuildSchemaRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuildSchemaResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - Basic Auth: []
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: >-
            curl -X POST 'https://api.va.landing.ai/v1/ade/extract/build-schema'
            \
              -H 'Authorization: Bearer YOUR_API_KEY' \
              -F 'markdowns=@markdown.md' \
              -F 'model=extract-latest' \
              -F 'prompt=Extract invoice fields including vendor, date, and total amount'
        - lang: Python
          label: Python
          source: >-
            import requests


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


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


            # Prepare files and data

            files = [('markdowns', open('markdown.md', 'rb'))]

            data = {
                'model': 'extract-latest',
                'prompt': 'Extract invoice fields including vendor, date, and total amount'
            }


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

            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('markdowns', fs.createReadStream('markdown.md'));

            form.append('model', 'extract-latest');

            form.append('prompt', 'Extract invoice fields including vendor,
            date, and total amount');


            axios.post('https://api.va.landing.ai/v1/ade/extract/build-schema',
            form, {
              headers: {
                'Authorization': 'Bearer YOUR_API_KEY',
                ...form.getHeaders()
              }
            })

            .then(response => console.log(response.data))

            .catch(error => console.error(error));
components:
  schemas:
    BuildSchemaRequest:
      properties:
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: >-
            The version of the model to use for schema generation. Use
            `extract-latest` to use the latest version.
        markdowns:
          anyOf:
            - items:
                anyOf:
                  - type: string
                    format: binary
                  - type: string
              type: array
            - type: 'null'
          title: Markdowns
          description: >-
            Markdown files or inline content strings to analyze for schema
            generation. Multiple documents can be provided for better schema
            coverage.
        markdown_urls:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Markdown Urls
          description: URLs to Markdown files to analyze for schema generation.
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
          description: Instructions for how to generate or modify the schema.
        schema:
          anyOf:
            - type: string
            - type: 'null'
          title: Schema
          description: Existing JSON schema to iterate on or refine.
      type: object
      title: BuildSchemaRequest
    BuildSchemaResponse:
      properties:
        extraction_schema:
          type: string
          title: Extraction Schema
          description: The generated JSON schema as a string.
        metadata:
          $ref: '#/components/schemas/BuildSchemaMetadata'
          description: The metadata for the schema generation process.
      type: object
      required:
        - extraction_schema
        - metadata
      title: BuildSchemaResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BuildSchemaMetadata:
      properties:
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
        org_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Org Id
        duration_ms:
          type: integer
          title: Duration Ms
          default: 0
        credit_usage:
          type: number
          title: Credit Usage
          default: 0
        job_id:
          type: string
          title: Job Id
          default: ''
        version:
          anyOf:
            - type: string
            - type: 'null'
          title: 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
      title: BuildSchemaMetadata
    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

````