Developer Quickstart

API Reference & Guides

Learn how to authenticate requests, enrich product SKUs with maternity & postpartum intelligence, power interactive due-date sizing widgets, ingest closed-loop return telemetry, and run catalog assortment ROI audits.

Authentication

All requests must include your provisioned key in the X-API-Key request header. The key is validated in constant time and cached briefly for rapid verification at the edge.

HTTP Header
X-API-Key: dlp_live_abcdef1234567890abcdef1234567890

Never expose secret keys in client-side code or public repositories. Requests missing the header or presenting invalid keys are rejected immediately with 401 Unauthorized (accompanied by a WWW-Authenticate: ApiKey response header).

Endpoints Reference

The Delphra API exposes four synchronous HTTPS endpoints for catalog enrichment, shopper personalization, return telemetry, and assortment auditing:

Delphra v1 API Endpoints
POST https://api.delphra.com/api/v1/enrich_product
POST https://api.delphra.com/api/v1/shopper/personalized-fit
POST https://api.delphra.com/api/v1/feedback/fit-outcome
POST https://api.delphra.com/api/v1/catalog/assortment-report

All four endpoints accept JSON request bodies over HTTPS and authenticate via the X-API-Key header.

Request Schema

The endpoint consumes a payload conforming to the ProductSchema specification. Fields marked required must be present in every request:

Field Type Required Description
external_sku_id string Yes* Retailer SKU or product identifier (or pass source_id; max 255 chars).
title string Yes* Product title or display name (or pass product_name; max 255 chars).
description string No Raw textual product description and styling notes.
image_url / image_urls string / string[] No High-resolution product imagery for multimodal silhouette, seam, and neckline analysis.
fabric_composition object (map) No Structured fiber percentages (e.g. {"modal": 92.0, "elastane": 8.0}).
materials string No Raw fabric composition string (e.g. "92% Modal, 8% Elastane").
stretch_level string No Garment stretch level: "none", "low", "medium", "high", or "four_way".
fit_type string No Garment silhouette fit: "fitted", "regular", "relaxed", or "oversized".
waist_rise string No Waistline placement: "low", "mid", "high", "empire", "drop", or "none".
closure_type string No Closure mechanism (e.g. "pull-on", "button-front", "wrap-tie", "back-zip").
curation_mode string No "bump_friendly_discovery" (default: discovers bump-friendly styles inside non-maternity catalogs) or "full_maternity_catalog" (evaluates both mainstream and explicit maternity/nursing SKUs).
include_shopify_metafields boolean No Defaults to true. Populates ready-to-import delphra.* Shopify metafields in the response.

cURL Quickstart

Make a direct HTTPS POST request to https://api.delphra.com/api/v1/enrich_product with your product SKU metadata:

cURL
curl -X POST "https://api.delphra.com/api/v1/enrich_product" \
  -H "X-API-Key: dlp_live_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "external_sku_id": "SKU-10293",
    "title": "Ribbed Modal Wrap Midi Dress",
    "brand": "Delphra Studio",
    "description": "True functional wrap dress in breathable modal rib with adjustable tie above the waist.",
    "image_urls": ["https://example.com/images/10293-front.jpg"],
    "fabric_composition": {"modal": 92.0, "elastane": 8.0},
    "stretch_level": "high",
    "waist_rise": "empire",
    "closure_type": "wrap-tie",
    "curation_mode": "bump_friendly_discovery"
  }'

Python Example

Integrate maternity enrichment and assortment curation directly into your catalog pipeline using httpx or requests.

Python 3.10+ (httpx)
import httpx

API_ENDPOINT = "https://api.delphra.com/api/v1/enrich_product"
API_KEY = "dlp_live_YOUR_KEY_HERE"

headers = {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
}

payload = {
    "external_sku_id": "sku_8741",
    "title": "Smocked Organic Cotton Midi Dress",
    "description": "Elastic smocked bodice with tiered A-line skirt and flexible straps.",
    "image_urls": ["https://images.example.com/sku_8741.jpg"],
    "fabric_composition": {"cotton": 95.0, "elastane": 5.0},
    "stretch_level": "high",
    "curation_mode": "bump_friendly_discovery",
}

with httpx.Client(timeout=30.0) as client:
    response = client.post(API_ENDPOINT, json=payload, headers=headers)

    if response.status_code == 200:
        result = response.json()
        print(f"Include in Maternity Edit: {result['include']} ({result.get('maternity_classification')})")
        print(f"Sizing Advice: {result.get('sizing_recommendation')}")
        print(f"Shopify Metafields: {result.get('shopify_metafields')}")

Response Schema (ProductAnalysisResult)

Both qualified and excluded items return 200 OK with a structured, deterministic ProductAnalysisResult payload (no arbitrary numeric LLM scores):

Field Type Required Description
include boolean Yes Whether the SKU qualifies for the Maternity & Postpartum Edit.
maternity_classification string Yes Deterministic segment derived from verified life-stage coverage: "core_bump_to_baby", "early_to_mid_bump", "fourth_trimester_hero", "explicit_maternity", or "not_suitable".
sizing_recommendation string Yes Primary shopper size guidance: "true_to_pre_pregnancy_size", "size_up_1", "size_up_2", "adjustable_flex_fit", or "not_recommended".
sizing_advice_by_stage StageFitAssessment[] No Per-stage breakdown (First Trimester, Second Trimester, Third Trimester, Postpartum) with suitable, sizing_recommendation, and fit_notes.
bump_accommodation BumpAccommodation No Structured garment anatomy: mechanisms (empire_waist, true_wrap_tie, smocked_or_shirred_bodice, etc.), waistband_interaction, and hemline_bump_impact.
postpartum_attributes PostpartumAttributes No Structured fourth-trimester details: nursing_friendly, nursing_access_types, pump_friendly, pump_compatibility, c_section_friendly, incision_clearance, baby_skin_safe, and hospital_bag_essential.
life_stages string[] No Qualifying stages: "First Trimester", "Second Trimester", "Third Trimester", "Postpartum".
occasions string[] No Includes standard & maternity milestones: "Baby Shower", "Maternity Photoshoot", "Hospital Bag / Coming Home", "Return-to-Work / Pumping", "Babymoon", "Wardrobe Staples", "Workwear", "Wedding Guest", "Party", "Vacation".
merchandising MerchandisingContent No Ready-to-display stylist_headline, pdp_fit_guide_blurb, sizing_tip_callout, and internal buyer_audit_rationale.
exclusion_flags / fit_warnings string[] No Machine-readable rejection codes (e.g. "rigid_non_stretch_denim") and shopper caveats (e.g. "Size up one for Third Trimester").
shopify_metafields object (map) No Pre-formatted delphra.* Shopify metafield dictionary ready for direct storefront sync.
agentic_commerce_attributes object (Schema.org JSON-LD) No Schema.org PropertyValue array for AI Shopping engines (Google Shopping AI, Perplexity Buy-with-Pro, ChatGPT Shopping).

Shopper Due-Date & Sizing Engine (POST /api/v1/shopper/personalized-fit)

A 100% deterministic Python calculation endpoint (sub-10ms latency, zero LLM inference) that powers interactive PDP fit widgets. Pass a shopper’s due_date (or current_pregnancy_week), pre_pregnancy_size, is_postpartum, nursing_intent, c_section_planned, and an enriched product_analysis payload to compute their current pregnancy week and stage, the exact recommended size to buy today, wearable trimesters, and postpartum compatibility.

Request Field Type Required Description
product_analysis ProductAnalysisResult Yes Enriched ProductAnalysisResult object for the SKU on the PDP.
pre_pregnancy_size string No "XXS", "XS", "S" (default), "M", "L", "XL", or "XXL".
due_date string (YYYY-MM-DD) No Estimated delivery date used to deterministically calculate current pregnancy week (1–42) and trimester.
current_pregnancy_week integer (1–42) No Optional direct pregnancy week override if due_date is not provided.
is_postpartum boolean No Defaults to false. Set true if the shopper is currently in the fourth trimester.
nursing_intent boolean No Defaults to true. Evaluates nursing & pumping access compatibility.
c_section_planned boolean No Defaults to false. Enforces low-transverse incision clearance.
POST /api/v1/shopper/personalized-fit — Response
{
  "compatible_with_shopper": true,
  "current_stage": "Third Trimester",
  "calculated_pregnancy_week": 28,
  "recommended_size_to_buy": "L (Size up 1 from M for Third Trimester)",
  "sizing_action": "size_up_1",
  "wearable_stages_for_shopper": ["First Trimester", "Second Trimester", "Third Trimester", "Postpartum"],
  "nursing_compatible": true,
  "c_section_compatible": true,
  "storefront_badge": "Verified Fit for Third Trimester — Order Size L + Nursing Ready",
  "personalized_fit_explanation": "Based on your current stage (Third Trimester, Week 28), order L (Size up 1 from M for Third Trimester). Supported across: First Trimester, Second Trimester, Third Trimester, Postpartum."
}

Closed-Loop Fit & Return Telemetry (POST /api/v1/feedback/fit-outcome)

Ingests post-purchase return events and shopper fit reviews indexed by pregnancy stage and purchased size. When real-world shoppers report tightness or hemline lift in a specific trimester, the endpoint returns a deterministic calibration signal to refine stage-level sizing guidance and reduce future return rates.

Request Field Type Required Description
external_sku_id string Yes Retailer SKU identifier (1–128 chars).
brand string No Brand or vendor name.
pre_pregnancy_size string Yes Shopper’s baseline size: "XXS", "XS", "S", "M", "L", "XL", or "XXL".
purchased_size string Yes Size purchased by the shopper: "XXS" through "XXL".
stage_worn string Yes "First Trimester", "Second Trimester", "Third Trimester", or "Postpartum".
outcome string Yes "kept_good_fit", "returned_tight_at_bump", "returned_tight_at_bust", "returned_hemline_rode_up", "returned_waistband_irritated_incision", or "returned_other".
notes string No Optional shopper review or return note (max 500 chars).
POST /api/v1/feedback/fit-outcome — Request & Response
curl -X POST "https://api.delphra.com/api/v1/feedback/fit-outcome" \
  -H "X-API-Key: dlp_live_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "external_sku_id": "SKU-9824",
    "brand": "Atelier Lumière",
    "pre_pregnancy_size": "M",
    "purchased_size": "M",
    "stage_worn": "Third Trimester",
    "outcome": "returned_tight_at_bump",
    "notes": "Wrap overlap felt narrow at 34 weeks in my usual M."
  }'

# Response (200 OK)
{
  "feedback_id": "fbk_9a4c2e81b03f7d12",
  "status": "recorded",
  "external_sku_id": "SKU-9824",
  "stage_worn": "Third Trimester",
  "outcome": "returned_tight_at_bump",
  "deterministic_calibration_signal": "Calibration trigger: shift Third Trimester sizing_recommendation from true_to_pre_pregnancy_size -> size_up_1."
}

Catalog Assortment & ROI Report (POST /api/v1/catalog/assortment-report)

Submit a batch of enriched ProductAnalysisResult items along with optional store parameters (target_min_per_stage, average_order_value_usd, avg_inventory_depth_units_per_sku) to generate a complete readiness audit, trimester/category gap breakdown, and a deterministic financial_impact_estimate quantifying unlocked maternity inventory value and annual return-reduction savings.

POST /api/v1/catalog/assortment-report — Response
{
  "total_skus_evaluated": 420,
  "qualified_skus_count": 64,
  "rejected_skus_count": 356,
  "qualification_rate_pct": 15.2,
  "stage_coverage": {
    "First Trimester": 61,
    "Second Trimester": 58,
    "Third Trimester": 41,
    "Postpartum": 52
  },
  "financial_impact_estimate": {
    "unlocked_maternity_skus": 64,
    "full_pregnancy_to_postpartum_hero_skus": 38,
    "estimated_inventory_value_unlocked_usd": 264000.0,
    "estimated_annual_return_savings_usd": 31680.0,
    "methodology_note": "Calculated deterministically from 64 qualified SKUs × $165.00 AOV × 25 units/SKU, with 12% return reduction from stage-specific sizing guidance."
  },
  "ready_to_launch_section": true,
  "merchandising_recommendations": [
    "Your catalog has strong coverage across all trimesters, postpartum needs, and core apparel categories to launch a dedicated Maternity & Postpartum Edit."
  ]
}

Error Codes

The API returns standard HTTP status codes. Client-facing error messages are sanitized to safeguard internal infrastructure:

Status Meaning Cause & Remediation
200 OK Success Product enriched successfully. Response contains a validated ProductAnalysisResult object. Billed.
204 No Content No Result Produced The agent completed inference but generated no conclusive classification. Unbilled.
401 Unauthorized Authentication Failure Missing, malformed, revoked, or invalid X-API-Key. Returns WWW-Authenticate: ApiKey.
402 Payment Required Account Past Due Account is suspended for non-payment. Customer must update payment details in Stripe billing.
403 Forbidden Scope Insufficient Key does not possess the requisite operational scope for this resource.
429 Too Many Requests Quota or Rate Limit Exceeded Triggered by Cloud Armor per-key rate limiting, monthly request/token cap exhaustion, or upstream Gemini quota exhaustion.
500 Server Error Internal Exception Internal processing error. The server returns a sanitized notice; safe to retry with exponential backoff. Unbilled.

Rate Limits & Quotas

Delphra enforces two layers of protective throttling:

  • Cloud Armor Edge Guard: Each API key receives an independent token bucket throttled on requests per minute. Burst traffic exceeding the threshold receives immediate 429 responses without incurring inference costs.
  • Monthly Account Cap: Every billing plan enforces a total monthly allowance. When reached, subsequent requests return 429 (Monthly quota exhausted) until the calendar month rolls over or an overage plan is enabled.