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

# Infer Enrichment

> 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"}
  ]
}
```



## OpenAPI

````yaml /api-reference/openapi.json post /public/infer-enrichment
openapi: 3.1.0
info:
  title: Rastro Public API
  description: >-
    Public API for enrichment, catalog management, workflows, activities,
    snapshots, taxonomy, and MCP integrations.
  version: 0.1.0
servers:
  - url: https://catalogapi.rastro.ai/api
security:
  - bearerAuth: []
paths:
  /public/infer-enrichment:
    post:
      tags:
        - Enrich
      summary: Infer Enrichment
      description: >-
        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"}
          ]
        }

        ```
      operationId: infer_enrichment_api_public_infer_enrichment_post
      parameters:
        - name: X-Organization-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Organization-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InferEnrichmentRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferEnrichmentResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - bearerAuth: []
components:
  schemas:
    InferEnrichmentRequest:
      properties:
        prompt:
          type: string
          title: Prompt
          description: >-
            Description of the data (e.g., 'Audio products catalog - headphones
            and earbuds')
        items:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Items
          description: Sample items to analyze (5-20 items recommended)
      type: object
      required:
        - prompt
        - items
      title: InferEnrichmentRequest
      description: >-
        Request to infer schema, taxonomy, and enrichment fields from sample
        data.
    InferEnrichmentResponse:
      properties:
        suggested_schema:
          additionalProperties: true
          type: object
          title: Suggested Schema
          description: >-
            JSON Schema for catalog creation with properties dict. Ready to use
            with catalog creation endpoint.
        suggested_taxonomy:
          additionalProperties: true
          type: object
          title: Suggested Taxonomy
          description: >-
            Taxonomy in TaxonomyInput format (name, description,
            hierarchy_levels, nodes). Ready to use with catalog creation
            endpoint.
        web_enrichment_fields:
          items:
            $ref: '#/components/schemas/FieldDefinition'
          type: array
          title: Web Enrichment Fields
          description: >-
            Fields that should be enriched via web research. Ready to use as
            output_schema in /public/enrich endpoint.
      type: object
      required:
        - suggested_schema
        - suggested_taxonomy
        - web_enrichment_fields
      title: InferEnrichmentResponse
      description: Response with inferred schema, taxonomy, and web enrichment fields.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    FieldDefinition:
      description: >-
        Definition for a single field to extract - matches attribute mapper
        field schema.
      properties:
        name:
          description: Field name
          title: Name
          type: string
        type:
          default: string
          description: 'Field type: string, number, integer, boolean, array'
          title: Type
          type: string
        description:
          description: Description of what to extract for this field
          title: Description
          type: string
        array_element_type:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            For array fields, the type of elements: string, number, integer,
            image_url
          title: Array Element Type
        unit:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Units for numeric fields (e.g., 'kg', 'USD', 'cm')
          title: Unit
        enum:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          description: Constrain extraction to these specific values
          title: Enum
        items_enum:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          description: For array fields, constrain items to these specific values
          title: Items Enum
        sample_values:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          description: Example values to guide extraction
          title: Sample Values
        required:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          description: Whether the field is required
          title: Required
        merge:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          description: Whether to merge with existing values
          title: Merge
        pattern:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Optional regex pattern constraint for extracted text
          title: Pattern
        pattern_message:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Human-readable guidance for the pattern constraint
          title: Pattern Message
        min_length:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          description: Minimum string length
          title: Min Length
        max_length:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          description: Maximum string length
          title: Max Length
        minimum:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          description: Minimum numeric value
          title: Minimum
        maximum:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          description: Maximum numeric value
          title: Maximum
        unique:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          description: Whether the field should be unique within the target catalog
          title: Unique
        semantic_type:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Optional semantic type hint such as image_url or document_url
          title: Semantic Type
      required:
        - name
        - description
      title: FieldDefinition
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Rastro API key or user token

````