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

# Fill a schema from a document by URL

> Fill an arbitrary user JSON schema from a document URL, with citations.



## OpenAPI

````yaml /openapi.json post /v1/extract/schema
openapi: 3.1.0
info:
  title: Hanji
  summary: Parse documents into structured data. Text, tables, and figures in one call.
  version: 0.1.0
servers:
  - url: https://api.hanji.dev
    description: production
security:
  - APIKeyHeader: []
paths:
  /v1/extract/schema:
    post:
      tags:
        - v1
      summary: Fill a schema from a document by URL
      description: Fill an arbitrary user JSON schema from a document URL, with citations.
      operationId: extract_schema_v1
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SchemaExtractRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SchemaExtractResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    SchemaExtractRequest:
      properties:
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        schema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Schema
        strict:
          type: boolean
          title: Strict
          default: true
        auto_schema:
          type: boolean
          title: Auto Schema
          default: false
        extract_images:
          type: boolean
          title: Extract Images
          default: true
      type: object
      title: SchemaExtractRequest
      description: |-
        Input to a schema-extraction request.

        Given a document and an arbitrary user JSON schema, fill the schema's
        fields from the document and cite where each value came from.
    SchemaExtractResponse:
      properties:
        values:
          additionalProperties: true
          type: object
          title: Values
        evidence:
          additionalProperties:
            items:
              $ref: '#/components/schemas/FieldEvidence'
            type: array
          type: object
          title: Evidence
        ungrounded_fields:
          items:
            type: string
          type: array
          title: Ungrounded Fields
        page_count:
          type: integer
          title: Page Count
        generated_schema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Generated Schema
      type: object
      required:
        - values
        - evidence
        - page_count
      title: SchemaExtractResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    FieldEvidence:
      properties:
        page:
          type: integer
          title: Page
        bbox:
          anyOf:
            - items:
                type: number
              type: array
            - type: 'null'
          title: Bbox
        text:
          type: string
          title: Text
        confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence
        needs_review:
          type: boolean
          title: Needs Review
          default: false
        suggested_value:
          anyOf:
            - type: string
            - type: 'null'
          title: Suggested Value
      type: object
      required:
        - page
        - text
      title: FieldEvidence
      description: One grounding citation for an extracted value.
    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
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-KEY

````