Skip to content

Validate Extraction Schema

client.Extract.ValidateSchema(ctx, body) (*ExtractV2SchemaValidateResponse, error)
POST/api/v2/extract/schema/validation

Validate a JSON schema for extraction.

ParametersExpand Collapse
body ExtractValidateSchemaParams
ExtractV2SchemaValidateRequest param.Field[ExtractV2SchemaValidateRequest]

Request schema for validating an extraction schema.

ReturnsExpand Collapse
type ExtractV2SchemaValidateResponse struct{…}

Response schema for schema validation.

DataSchema map[string, ExtractV2SchemaValidateResponseDataSchemaUnion]

Validated JSON Schema, ready for use in extract jobs

One of the following:
type ExtractV2SchemaValidateResponseDataSchemaMap map[string, any]
type ExtractV2SchemaValidateResponseDataSchemaArray []any
string
float64
bool

Validate Extraction Schema

package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llama-parse-go"
  "github.com/run-llama/llama-parse-go/option"
)

func main() {
  client := llamacloudprod.NewClient(
    option.WithAPIKey("My API Key"),
  )
  extractV2SchemaValidateResponse, err := client.Extract.ValidateSchema(context.TODO(), llamacloudprod.ExtractValidateSchemaParams{
    ExtractV2SchemaValidateRequest: llamacloudprod.ExtractV2SchemaValidateRequestParam{
      DataSchema: map[string]llamacloudprod.ExtractV2SchemaValidateRequestDataSchemaUnionParam{
      "properties": llamacloudprod.ExtractV2SchemaValidateRequestDataSchemaUnionParam{
        OfAnyMap: map[string]any{
        "vendor_name": "bar",
        "invoice_number": "bar",
        "total_amount": "bar",
        "line_items": "bar",
        },
      },
      "required": llamacloudprod.ExtractV2SchemaValidateRequestDataSchemaUnionParam{
        OfAnyArray: []any{"vendor_name", "invoice_number", "total_amount"},
      },
      "type": llamacloudprod.ExtractV2SchemaValidateRequestDataSchemaUnionParam{
        OfString: llamacloudprod.String("object"),
      },
      },
    },
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", extractV2SchemaValidateResponse.DataSchema)
}
{
  "data_schema": {
    "foo": {
      "foo": "bar"
    }
  }
}
Returns Examples
{
  "data_schema": {
    "foo": {
      "foo": "bar"
    }
  }
}
Note for AI agents: this documentation is built for programmatic access. - Overview of all docs: https://developers.llamaindex.ai/llms.txt - Any page is available as raw Markdown by appending index.md to its URL — e.g. https://developers.llamaindex.ai/llamaparse/parse/getting_started/index.md - Agent-friendly REST search APIs live under https://developers.llamaindex.ai/api/ — search (BM25 full-text), grep (regex), read (fetch a page), and list (browse the doc tree). See https://developers.llamaindex.ai/llms.txt for parameters. - A hosted documentation MCP server is available at https://developers.llamaindex.ai/mcp. If you support MCP, you can ask the user to install it for browsing these docs directly (an alternative to the REST API). Setup: https://developers.llamaindex.ai/python/shared/mcp/