Skip to main content

POST /public/enrich

Enrich items with AI-powered web research. Every extracted field includes source URLs.
import requests

response = requests.post(
    "https://catalogapi.rastro.ai/api/public/enrich",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "items": [{"part_number": "6205-2RS", "name": "Deep Groove Ball Bearing"}],
        "output_schema": [
            {"name": "bore_diameter", "type": "string", "description": "Inner diameter in mm"},
            {"name": "outer_diameter", "type": "string", "description": "Outer diameter in mm"}
        ]
    }
)

Request Parameters

Core Parameters

ParameterTypeRequiredDefaultDescription
itemsarrayYes-JSON objects to enrich
output_schemaarrayYes-Fields to extract (see Output Schema)
promptstringNo""Search prompt guiding web research

Search Options

ParameterTypeDefaultDescription
speedstring"medium""fast" (~1 min), "medium" (~2 min), "slow" (10-15 min, most thorough)
allowed_domainsarrayanyRestrict sources to these domains only
web_searchbooleantrueSet false to skip web search and use input data directly

Taxonomy & Quality

ParameterTypeDefaultDescription
taxonomyobject-Taxonomy definition for category prediction
predict_taxonomybooleanfalsePredict category for each item
quality_promptstring-Prompt for quality scoring (adds 1-5 score)
validate_semanticsbooleanfalseAI validates values match field descriptions

Job Control

ParameterTypeDefaultDescription
async_modebooleanfalseReturn immediately with job_id
max_rowsinteger-Process only first N items (dry run)
source_activity_idstring-Resume from previous job to process remaining items
include_source_explanationsbooleanfalseAdd explanation for each field value

Output Schema

Define fields to extract. Each field needs a name, type, and description.
{
  "output_schema": [
    {"name": "material", "type": "string", "description": "Material composition"},
    {"name": "weight_kg", "type": "number", "description": "Weight in kilograms", "unit": "kg"},
    {"name": "certifications", "type": "array", "description": "Safety certifications"}
  ]
}

Field Options

OptionTypeDescription
namestringField name (required)
typestringstring, number, integer, boolean, array
descriptionstringWhat to extract (required)
unitstringUnits for numbers (e.g., "kg", "mm")
enumarrayConstrain to specific values
sample_valuesarrayExample values to guide extraction
array_element_typestringFor arrays: string, number, image_url

Response

{
  "job_id": "abc123-def456-...",
  "results": [{
    "original_data": {"part_number": "6205-2RS", "name": "Deep Groove Ball Bearing"},
    "enriched_fields": {
      "bore_diameter": {"value": "25 mm", "sources": ["https://skf.com/..."]},
      "outer_diameter": {"value": "52 mm", "sources": ["https://skf.com/..."]}
    },
    "all_sources": ["https://skf.com/..."]
  }],
  "total_items": 1,
  "successful": 1,
  "credits_used": 1,
  "status": "completed"
}

Response Fields

FieldTypeDescription
job_idstringJob ID for tracking
resultsarrayEnriched items (empty if async_mode=true)
total_itemsintegerItems processed
total_rowsintegerTotal items before max_rows limit
successfulintegerSuccessfully enriched items
credits_usedintegerCredits used (1 per item)
statusstring"running" or "completed"

Result Item Fields

FieldTypeDescription
original_dataobjectInput data
enriched_fieldsobject{field: {value, sources[]}}
all_sourcesarrayAll URLs scraped
errorstringError message if failed
category_idstringPredicted category (if taxonomy enabled)
category_pathstringFull path like "Bearings > Ball Bearings"
taxonomy_attributesobjectCategory-specific attributes
quality_scoreinteger1-5 score (if quality_prompt set)
quality_resultobject{score, explanation, issues, suggestions}
review_infoobjectAI reasoning and flags

GET /public/enrich/

Poll enrichment job status and retrieve results.
response = requests.get(
    f"https://catalogapi.rastro.ai/api/public/enrich/{job_id}",
    headers={"Authorization": "Bearer YOUR_API_KEY"}
)
print(response.json())

Status Values

StatusDescription
runningJob is processing
completedJob finished successfully
pending_reviewResults staged for review
failedJob failed

Source Citations

Every field includes URLs showing where data was found.
{
  "enriched_fields": {
    "bore_diameter": {
      "value": "25 mm",
      "sources": ["https://skf.com/products/bearings/6205-2RS"]
    }
  }
}
When a value comes from input data, the source shows INPUT:field_name:
{
  "part_number": {
    "value": "6205-2RS",
    "sources": ["INPUT:part_number"]
  }
}

AI Transparency

Every result includes review_info with AI reasoning:
{
  "review_info": {
    "reasoning": "Found specs on manufacturer website, cross-referenced with distributor",
    "confidence": "high",
    "flags": ["verify_tolerance_class"]
  }
}