---
title: "Infer Enrichment"
method: POST
path: "/public/infer-enrichment"
tags: ["Enrich"]
---

# Infer Enrichment

`POST /public/infer-enrichment`

## Request

- Base URL: `https://catalogapi.rastro.ai/api`
- URL: `https://catalogapi.rastro.ai/api/public/infer-enrichment`
- Auth: HTTP bearer

Analyze sample data and infer schema, taxonomy, and web enrichment fields.

Pass sample items and a description, get back:
- **suggested_schema**: JSON Schema ready for catalog creation
- **suggested_taxonomy**: Taxonomy ready for catalog creation
- **web_enrichment_fields**: Fields to use with /public/enrich endpoint

**Example request:**
```json
{
  "prompt": "Audio products catalog - headphones and earbuds",
  "items": [
    {"name": "Sony WH-1000XM5", "sku": "WH1000XM5-B", "price": "$399.99"},
    {"name": "Apple AirPods Pro 2", "sku": "AIRPODS-PRO-2", "price": "$249.00"}
  ]
}
```

## Headers

- `X-Organization-Id` string, nullable

## Request body

- InferEnrichmentRequest: Request to infer schema, taxonomy, and enrichment fields from sample data.
  - `prompt` string, required: Description of the data (e.g., 'Audio products catalog - headphones and earbuds')
  - `items` object[], required: Sample items to analyze (5-20 items recommended)

## Response `200`

Successful Response

- InferEnrichmentResponse: Response with inferred schema, taxonomy, and web enrichment fields.
  - `suggested_schema` object, required: JSON Schema for catalog creation with properties dict. Ready to use with catalog creation endpoint.
  - `suggested_taxonomy` object, required: Taxonomy in TaxonomyInput format (name, description, hierarchy_levels, nodes). Ready to use with catalog creation endpoint.
  - `web_enrichment_fields` FieldDefinition[], required: Fields that should be enriched via web research. Ready to use as output_schema in /public/enrich endpoint.
    - `name` string, required: Field name
    - `type` string: Field type: string, number, integer, boolean, array
    - `description` string, required: Description of what to extract for this field
    - `array_element_type` string, nullable: For array fields, the type of elements: string, number, integer, image_url
    - `unit` string, nullable: Units for numeric fields (e.g., 'kg', 'USD', 'cm')
    - `enum` string[], nullable: Constrain extraction to these specific values
    - `items_enum` string[], nullable: For array fields, constrain items to these specific values
    - `sample_values` string[], nullable: Example values to guide extraction
    - `required` boolean, nullable: Whether the field is required
    - `merge` boolean, nullable: Whether to merge with existing values
    - `pattern` string, nullable: Optional regex pattern constraint for extracted text
    - `pattern_message` string, nullable: Human-readable guidance for the pattern constraint
    - `min_length` integer, nullable: Minimum string length
    - `max_length` integer, nullable: Maximum string length
    - `minimum` number, nullable: Minimum numeric value
    - `maximum` number, nullable: Maximum numeric value
    - `unique` boolean, nullable: Whether the field should be unique within the target catalog
    - `semantic_type` string, nullable: Optional semantic type hint such as image_url or document_url

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/rastro-ai/apis/rastro-public-api.md) - [All operations](https://skmtc.dev/rastro-ai/apis/rastro-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/rastro-ai/apis/rastro-public-api/revisions/57c8ed4854bb?raw)
