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

# Extract structured data from URLs

> Pull schema-shaped JSON out of one or many pages in a single call. An LLM maps each page onto your schema and/or prompt. Point at a single page, a list, or a crawl scope with a trailing `/*` wildcard; optionally let web search find extra source pages, return per-field confidence with the source passage behind each value, and merge everything into one deduplicated collection of entities. Charged per page that returns data.



## OpenAPI

````yaml https://api.hydrafetch.com/openapi.json post /v1/web/extract
openapi: 3.0.0
info:
  title: Hydrafetch API
  description: >-
    Hydrafetch turns any URL into clean, LLM-ready data through one API.


    Give us a link and get back Markdown, the page's own structured data,
    extracted JSON, links, a

    summary, or a screenshot. Point us at a whole site and get every page. Ask a
    question and get

    answers with per-field confidence and the passage each value came from. You
    describe the outcome

    you want — the pipeline decides how to get it.


    ## Authentication


    Every request is authenticated with your API key in the `X-API-Key` header.
    Keys are scoped to a

    workspace and carry its credit balance.


    ## Credits


    Calls are billed in credits and charged only on success. A standard scrape
    is one credit; richer

    formats and the extraction tier cost more. Each response reports what it
    consumed.


    ## Conventions


    All timestamps are UTC ISO 8601. Long-running jobs (crawl, batch) return a
    job id you poll, or a

    webhook you register. Errors return a structured body with a stable `code`
    and an HTTP status.
  version: '1.0'
  contact:
    name: Hydrafetch
    url: https://hydrafetch.com
    email: team@hydrafetch.com
servers:
  - url: https://api.hydrafetch.com
    description: Production
security:
  - apiKey: []
tags:
  - name: Web Scraping
    description: >-
      Turn URLs into clean, LLM-ready content: scrape a single page, crawl or
      batch-scrape a whole site, map its URLs, search the web, and capture
      screenshots or images.
  - name: Web Extraction
    description: >-
      Pull schema-shaped JSON out of one or many pages, with optional per-field
      confidence and the source passage behind each value.
paths:
  /v1/web/extract:
    post:
      tags:
        - Web Extraction
      summary: Extract structured data from URLs
      description: >-
        Pull schema-shaped JSON out of one or many pages in a single call. An
        LLM maps each page onto your schema and/or prompt. Point at a single
        page, a list, or a crawl scope with a trailing `/*` wildcard; optionally
        let web search find extra source pages, return per-field confidence with
        the source passage behind each value, and merge everything into one
        deduplicated collection of entities. Charged per page that returns data.
      operationId: run
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExtractRequestDto'
      responses:
        '200':
          description: The extracted data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtractResponseDto'
components:
  schemas:
    ExtractRequestDto:
      type: object
      properties:
        urls:
          maxItems: 10
          example:
            - https://example.com/products/widget
            - https://example.com/products/*
          description: >-
            The pages to extract from. Each must be an http(s) URL. A trailing
            `/*` marks a crawl scope: every page discovered under that path is
            extracted and merged into the result.
          type: array
          items:
            type: string
        schema:
          type: object
          additionalProperties: true
          description: >-
            JSON Schema describing the shape you want back. Optional if `prompt`
            is given; when both are present the schema fixes the field names and
            types while the prompt guides what to pull.
        prompt:
          type: string
          maxLength: 2000
          example: Pull the product name, price in USD, and whether it is in stock.
          description: >-
            Natural-language instruction for what to extract. Use with or
            instead of a schema.
        preferStructure:
          type: boolean
          description: >-
            Preserve document structure (headings, lists, tables) over prose
            density when reading the page — good for listing and catalog pages.
            Default off.
        enableWebSearch:
          type: boolean
          description: >-
            Pull in extra source pages by web-searching your prompt, to fill
            fields your URLs do not cover. Requires a `prompt`.
        showSources:
          type: boolean
          description: >-
            Return the concrete list of URLs that were actually extracted, after
            any wildcard and web-search expansion. Default off.
        showConfidence:
          type: boolean
          description: >-
            For each field, return a confidence score and the exact source
            passage the value was drawn from. Default off.
        mergeEntities:
          type: boolean
          description: >-
            Merge the per-page results into one deduplicated collection — one
            row per entity, with its contributing source URLs — instead of a
            separate result per page. Default off.
        maxAge:
          type: number
          minimum: 0
          maximum: 604800000
          description: >-
            Reuse a recent capture of each page if it is younger than this many
            milliseconds. Omit or 0 to always fetch fresh. Capped at 7 days.
      required:
        - urls
    ExtractResponseDto:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/ExtractResultDto'
      required:
        - data
    ExtractResultDto:
      type: object
      properties:
        results:
          description: One result per extracted page.
          type: array
          items:
            $ref: '#/components/schemas/ExtractItemResultDto'
        sources:
          description: >-
            The concrete URLs actually extracted, after wildcard and web-search
            expansion. Present only when `showSources` is set.
          type: array
          items:
            type: string
        collection:
          description: >-
            The deduplicated collection, one row per entity. Present only when
            `mergeEntities` is set.
          type: array
          items:
            $ref: '#/components/schemas/MergedEntityDto'
      required:
        - results
    ExtractItemResultDto:
      type: object
      properties:
        url:
          type: string
          example: https://example.com/products/widget
          description: The page this result came from.
        data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            The extracted data, shaped by your schema and/or prompt. Null when
            nothing matched.
        fields:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/FieldProvenanceDto'
          description: >-
            Per-field confidence and source passage, keyed by field name.
            Present only when `showConfidence` is set.
        error:
          type: object
          nullable: true
          example: null
          description: Set when this page could not be extracted; null on success.
      required:
        - url
        - data
        - error
    MergedEntityDto:
      type: object
      properties:
        data:
          type: object
          additionalProperties: true
          description: >-
            The unioned data for one entity, filled across every contributing
            page.
        sources:
          description: Every source URL that contributed to this entity.
          type: array
          items:
            type: string
      required:
        - data
        - sources
    FieldProvenanceDto:
      type: object
      properties:
        confidence:
          type: number
          minimum: 0
          maximum: 1
          example: 0.92
          description: How certain the value is correct given the page, from 0 to 1.
        evidence:
          type: string
          example: Priced at $49.00 with free shipping.
          description: >-
            The exact short passage the value was drawn from, or an empty string
            if none.
      required:
        - confidence
        - evidence
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key

````