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), "cheap" (fastest, uses lighter model)
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
catalog_idstring-Catalog ID from the dashboard — automatically applies its schema, taxonomy, and settings
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
webhook_urlstring-HTTPS URL to receive a POST when the job completes (see Webhooks)

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
items_enumarrayFor array-type fields, constrains array items to specific values
requiredbooleanMarks whether this field is required in the output
mergebooleanMerge enriched values with existing values instead of overwriting

Response

{
  "job_id": "abc123-def456-...",
  "results": [{
    "original_data": {"part_number": "6205-2RS", "name": "Deep Groove Ball Bearing"},
    "after_data": {
      "part_number": "6205-2RS",
      "name": "Deep Groove Ball Bearing",
      "bore_diameter": "25 mm",
      "outer_diameter": "52 mm",
      "sources": {
        "bore_diameter": ["https://skf.com/products/bearings/6205-2RS"],
        "outer_diameter": ["https://skf.com/products/bearings/6205-2RS"]
      },
      "source_explanations": {
        "bore_diameter": "Found on manufacturer product page",
        "outer_diameter": "Found on manufacturer product page"
      }
    },
    "all_sources": ["https://skf.com/products/bearings/6205-2RS"]
  }],
  "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_itemsintegerTotal items submitted
total_rowsintegerTotal items before max_rows limit
successfulintegerSuccessfully enriched items
credits_usedintegerCredits used (1 per item)
statusstring"running", "completed", or "failed"

Result Item Fields

FieldTypeDescription
original_dataobjectInput data
after_dataobjectComplete enriched record. Contains original fields, enriched values, sources (per-field URL citations), and source_explanations (per-field derivation explanations)
all_sourcesarrayDeduplicated list of all URLs used across all fields
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}
taxonomy_attribute_explanationsobjectPer-attribute explanations of how taxonomy values were derived
review_infoobjectAI reasoning and flags (see below)

GET /public/enrich/

Poll enrichment job status and retrieve results. Results are returned progressively — partial results are available while the job is still running, as each batch of items completes processing.

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number (1-indexed)
page_sizeinteger1000Results per page
# Basic poll
response = requests.get(
    f"https://catalogapi.rastro.ai/api/public/enrich/{job_id}",
    headers={"Authorization": "Bearer YOUR_API_KEY"}
)

# With pagination
response = requests.get(
    f"https://catalogapi.rastro.ai/api/public/enrich/{job_id}",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    params={"page": 1, "page_size": 50}
)

Poll Response

{
  "job_id": "abc123-def456-...",
  "status": "running",
  "results": [
    {
      "original_data": {"part_number": "6205-2RS"},
      "after_data": {
        "part_number": "6205-2RS",
        "bore_diameter": "25 mm",
        "sources": {
          "bore_diameter": ["https://skf.com/products/bearings/6205-2RS"]
        }
      },
      "all_sources": ["https://skf.com/products/bearings/6205-2RS"]
    }
  ],
  "total_items": 500,
  "completed_items": 200,
  "successful": 0,
  "credits_used": 0,
  "page": 1,
  "page_size": 50,
  "total_pages": 4
}

Poll Response Fields

FieldTypeDescription
job_idstringJob ID
statusstringCurrent status (see below)
resultsarrayEnriched items for the current page
total_itemsintegerTotal items submitted
completed_itemsintegerItems with results available so far (grows while running)
successfulintegerFinalized success count (set when job finishes)
credits_usedintegerCredits charged (0 while running)
pageintegerCurrent page number
page_sizeintegerResults per page
total_pagesintegerTotal pages based on completed_items
service_usageobjectCost details (only present when job finishes)
While status is running, completed_items reflects how many items have finished so far. Use completed_items and total_items to show progress. credits_used remains 0 until the job finishes.

Status Values

StatusDescriptionResults available?
runningJob is still processingYes — partial results from completed batches
completedJob finished, all results readyYes — all results
failedJob failed or was cancelledYes — partial results from completed batches
Cancelled jobs are reported as failed. Partial results and credits for completed items are preserved.

Source Citations

Each result includes all_sources — the URLs used during enrichment.
{
  "all_sources": [
    "https://skf.com/products/bearings/6205-2RS",
    "https://mcmaster.com/6205-2RS"
  ]
}
When web_search is false, the AI uses only the input data (INPUT_DATA) to derive field values.

AI Transparency

Every result includes review_info with AI reasoning:
{
  "review_info": {
    "reasoning": "Found specs on manufacturer website, cross-referenced with distributor",
    "flags": ["verify_tolerance_class"],
    "field_issues": [
      {"field": "tolerance", "severity": "warning", "message": "Value not found in sources"}
    ],
    "flag_record": true
  }
}
FieldTypeDescription
reasoningstringAI explanation of how values were extracted
flagsarrayGeneral flags or warnings about the extraction
field_issuesarrayPer-field issues with field, severity (error/warning/info), message, and validator
flag_recordbooleanWhether this record needs human attention

Webhooks

Instead of polling GET /public/enrich/{job_id}, you can provide a webhook_url to receive a POST when the job finishes. The URL must use HTTPS.
{
  "items": [...],
  "output_schema": [...],
  "async_mode": true,
  "webhook_url": "https://yourserver.com/hooks/enrich"
}

Webhook Payload

When the job completes, we POST a JSON body to your URL:
{
  "job_id": "abc123-def456-...",
  "status": "completed",
  "successful": 150,
  "failed": 5,
  "total": 155,
  "credits_used": 150
}
FieldTypeDescription
job_idstringUse with GET /public/enrich/{job_id} to fetch full results
statusstringAlways "completed"
successfulintegerItems enriched successfully
failedintegerItems that failed
totalintegersuccessful + failed
credits_usedintegerCredits charged
Webhook delivery is best-effort with a single attempt and a 30-second timeout. If delivery fails the job is unaffected — use polling as a fallback.

Job Management

GET /public/enrich/jobs

List enrichment jobs for your organization, with optional status filtering and pagination.

Query Parameters

ParameterTypeDefaultDescription
statusstring(all)Filter by status: running, completed, failed, cancelled
limitinteger20Results per page (1–100)
offsetinteger0Pagination offset
import requests

# List running jobs
response = requests.get(
    "https://catalogapi.rastro.ai/api/public/enrich/jobs",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    params={"status": "running"}
)
jobs = response.json()

Response

{
  "jobs": [
    {
      "job_id": "abc123-def456-...",
      "status": "running",
      "total_items": 500,
      "completed_items": 200,
      "failed_items": 3,
      "created_at": "2026-02-11T10:00:00+00:00",
      "started_at": "2026-02-11T10:00:01+00:00",
      "finished_at": null
    }
  ],
  "total": 12
}
FieldTypeDescription
jobsarrayList of job summaries
totalintegerTotal jobs matching the filter
Each job object:
FieldTypeDescription
job_idstringJob ID (use with other endpoints)
statusstringrunning, completed, failed, or cancelled
total_itemsintegerItems submitted
completed_itemsintegerItems processed so far
failed_itemsintegerItems that failed
created_atstringISO 8601 timestamp
started_atstringISO 8601 timestamp (null if not yet started)
finished_atstringISO 8601 timestamp (null if still running)

POST /public/enrich//cancel

Cancel a running enrichment job. Items already processed are kept and credits are charged only for completed items.
import requests

response = requests.post(
    f"https://catalogapi.rastro.ai/api/public/enrich/{job_id}/cancel",
    headers={"Authorization": "Bearer YOUR_API_KEY"}
)
result = response.json()
print(f"Cancelled — {result['completed_items']} items kept, {result['credits_used']} credits charged")

Response

{
  "success": true,
  "message": "Activity abc123-def456 cancelled",
  "completed_items": 200,
  "credits_used": 200
}
FieldTypeDescription
successbooleanWhether cancellation succeeded
messagestringHuman-readable status
completed_itemsintegerItems that finished before cancellation
credits_usedintegerCredits charged for completed items
You can only cancel jobs with status running. Completed or already-cancelled jobs return an error.

Concurrency Limits

Each organization can run up to 10 concurrent enrichment jobs. Submitting an 11th job returns 429 Too Many Requests:
{
  "detail": "Too many concurrent enrichment jobs (10/10). List running jobs: GET /api/public/enrich/jobs?status=running — Cancel a job: POST /api/public/enrich/{job_id}/cancel"
}
To unblock yourself:
  1. List running jobsGET /api/public/enrich/jobs?status=running
  2. Cancel any jobs you no longer need — POST /api/public/enrich/{job_id}/cancel
  3. Retry your request