---
title: "Distill"
method: POST
path: "/v2/distill"
tags: ["v2", "v2-distill"]
---

# Distill

`POST /v2/distill`

## Request

- Base URL: `https://api.enconvert.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.enconvert.com/v2/distill`
- Auth: none declared

Schema-driven structured extraction (CSS-first, LLM fallback).

## Headers

- `X-API-Key` string, nullable
- `authorization` string, nullable

## Request body

- DistillRequest: One /v2/distill request (plan section 4 / section 8 Task H.5).
  - `urls` string[], nullable: Explicit URLs to distill. Mutually exclusive with discover_from; exactly one is required.
  - `discover_from` DiscoverFrom: Crawl-then-distill source: discover a site's URLs, then distill each.
    - `url` string, required
    - `mode` 'sitemap' | 'crawl' | 'hybrid'
    - `max_pages` integer: Cap on URLs discovered AND distilled. Each is a full render, so this is bounded by MAX_DISTILL_URLS.
  - `schema` object, nullable: Output shape: a JSON-Schema object or a flat {field: description} map. The response data is guaranteed to match this shape. Optional when 'prompt' is supplied — the schema is then synthesized from the prompt.
  - `prompt` string, nullable: Natural-language description of what to extract. When given without a 'schema', the extraction schema is synthesized from this prompt (single-model LLM). Ignored when 'schema' is present.
  - `css_schema` CssSchema: A Crawl4AI CSS extraction schema (no-LLM, free first pass). ``base_selector`` matches the repeating container (one extracted record per match); ``fields`` are read out of each. ``target_field`` names the top-level output-schema property the records fill — an array property receives the full list, a scalar/object property the first record. When omitted, the flow infers the single array property if there is exactly one.
    - `baseSelector` string, required
    - `fields` CssField[], required
      - `name` string, required
      - `type` 'text' | 'attribute' | 'html' | 'regex' | 'nested' | 'list' | 'nested_list', required
      - `selector` string, nullable
      - `attribute` string, nullable
      - `pattern` string, nullable
      - `default` unknown
      - `transform` string, nullable
      - `fields` CssField[], nullable
    - `name` string, nullable
    - `target_field` string, nullable: Top-level output-schema property the CSS records fill. Array property -> full list; scalar/object property -> first record. Inferred when omitted and the schema has one array property.
  - `wait_for` string, nullable
  - `wait_timeout_ms` integer
  - `headers` object, nullable
  - `cookies` object[], nullable
  - `respect_robots` boolean

## Response `200`

Successful Response

- DistillResponse: Schema-driven extraction results for one /v2/distill call.
  - `operation_id` string, required
  - `total` integer
  - `completed` integer
  - `failed` integer
  - `results` DistillItemResult[]
  - `total_cost_cents` number
  - `synthesized_schema` object, nullable: When 'prompt' was used without a 'schema', the schema that was synthesized from the prompt and used for extraction.
  - `warnings` string[]

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/enconvert/apis/conversion-api.md) · [All operations](https://skmtc.dev/enconvert/apis/conversion-api/llms.txt) · [OpenAPI document](https://skmtc.dev/enconvert/apis/conversion-api/revisions/b8c820393569?raw)
