Target Data API: Extract Structured JSON in 2026
Tutorials

Target Data API: Extract Structured JSON in 2026

Learn how to extract structured JSON data from Target using AlterLab's Target Data API. Skip HTML parsing and get typed e-commerce data instantly.

4 min read
4 views

TL;DR

Use AlterLab's Extract API with a JSON schema to get structured Target data. Send a POST request with the Target URL and your schema to receive validated JSON output containing fields like title, price, and SKU — no HTML parsing needed.

This guide covers extracting publicly accessible data. Always review a site's robots.txt and Terms of Service before scraping.

Why use Target data?

Target's public product listings offer rich e-commerce datasets for three key engineering use cases:

  • Training ML models on real-time pricing and availability patterns
  • Building competitive intelligence dashboards that track SKU-level changes
  • Enriching product catalogs with standardized attributes for AI agents

Unlike social media or login-gated data, Target's product pages represent intentionally public commercial information suitable for aggregation when accessed respectfully.

What data can you extract?

From publicly accessible Target product pages, you can retrieve these e-commerce fields:

  • title: Product name as displayed
  • price: Current sale price (string format to preserve precision)
  • currency: ISO 4217 code (e.g., "USD")
  • sku: Stock Keeping Unit identifier
  • availability: "In Stock", "Out of Stock", or "Limited Availability"
  • rating: Average review score (string to handle fractional values)
  • brand: Manufacturer or private label name

AlterLab validates each field against your JSON schema, ensuring type consistency and eliminating cleanup steps. For example, price always comes as a string like "29.99" rather than requiring regex extraction from HTML.

The extraction approach

Raw HTTP requests followed by HTML parsing fail consistently on Target due to:

  • Dynamic content loaded via JavaScript frameworks
  • Anti-bot measures requiring header rotation and proxy management
  • Frequent DOM structure changes breaking CSS selectors
  • Encoding inconsistencies in price/availability symbols

A data API approach solves these by treating the target as a structured data source rather than a document to scrape. AlterLab handles infrastructure complexity — rotating proxies, JavaScript rendering, and anti-bot evasion — while you focus solely on defining the data shape you need through a JSON schema.

Quick start with AlterLab Extract API

Begin by installing the AlterLab SDK (getting started guide). Here's a Python example extracting core product fields:

Python
import alterlab

client = alterlab.Client("YOUR_API_KEY")

schema = {
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "The title field"
    },
    "price": {
      "type": "string",
      "description": "The price field"
    },
    "currency": {
      "type": "string",
      "description": "The currency field"
    },
    "sku": {
      "type": "string",
      "description": "The sku field"
    },
    "availability": {
      "type": "string",
      "description": "The availability field"
    }
  }
}

result = client.extract(
    url="https://www.target.com/p/apple-iphone-15-pro/-/A-88932345",
    schema=schema,
)
print(result.data)

Output:

JSON
{
  "title": "Apple iPhone 15 Pro - 256GB Black Titanium",
  "price": "999.99",
  "currency": "USD",
  "sku": "A-88932345",
  "availability": "In Stock"
}

The equivalent cURL request:

Bash
curl -X POST https://api.alterlab.io/v1/extract \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.target.com/p/apple-iphone-15-pro/-/A-88932345",
    "schema": {
      "properties": {
        "title": {"type": "string"},
        "price": {"type": "string"},
        "currency": {"type": "string"},
        "sku": {"type": "string"},
        "availability": {"type": "string"}
      }
    }
  }'

For batch processing, use asynchronous jobs to handle rate limits efficiently:

Python
import alterlab
import asyncio

client = alterlab.Client("YOUR_API_KEY")

async def extract_product(url):
    schema = {"properties": {"title": {"type": "string"}, "price": {"type": "string"}}}
    return await client.extract(url=url, schema=schema)

urls = [
    "https://www.target.com/p/apple-iphone-15-pro/-/A-88932345",
    "https://www.target.com/p/samsung-galaxy-s24/-/A-89012345",
    "https://www.target.com/p/google-pixel-8-pro/-/A-89123456"
]

async def main():
    tasks = [extract_product(url) for url in urls]
    results = await asyncio.gather(*tasks)
    for i, res in enumerate(results):
        print(f"Product {i+1}: {res.data}")

asyncio.run(main())

Define your schema

The Extract API uses JSON Schema Draft 07 for validation. Key principles:

  • Type safety: Specify string, number, boolean, or object types
  • Field descriptions: Improve AI extraction accuracy with clear semantics
  • Required fields: Mark critical data as "required": ["title", "price"]
  • Default values: Provide fallbacks for occasionally missing fields

Example schema for enriched product data:

JSON
{
  "type": "object",
  "required": ["title", "price", "sku"],
  "properties": {
    "title": {"type": "string", "description": "Full product title"},
    "price": {"type": "string", "description": "Current price"},
    "currency": {"type": "string", "enum": ["USD", "CAD"], "default": "USD"},
    "sku": {"type": "string", "pattern": "^A-\\d{8}$"},
    "availability": {
      "type": "string",
      "enum": ["In Stock", "Out of Stock", "Pre-order", "Limited Availability"]
    },
    "rating": {"type": "string", "pattern": "^\\d\\.\\d$"},
    "brand": {"type": "string"}
  }
}

AlterLab returns only validated data matching this schema. Invalid fields are omitted (not nulled), ensuring your pipeline receives clean, predictable output.

Handle pagination and scale

For catalog-level extraction:

  1. Discover URLs: Use sitemaps or category pages to collect product links
  2. Batch requests: Process 10-50 URLs per async job to stay within rate limits
  3. Error handling: Implement retry logic for 429 responses (AlterLab includes Retry-After header)
  4. Cost optimization: Monitor usage via the dashboard — AlterLab charges only for successful extractions

See pricing for volume tiers. At 10K extractions/month, the effective cost is ~$0.005 per request. No minimums mean you pay strictly for what you use, with credits rolling over indefinitely.

Key takeaways

  • Schema-first design: Define your data shape upfront to eliminate parsing fragility
  • Public data focus: Extract only what Target intentionally exposes to visitors
  • Infrastructure offload: AlterLab manages proxies, JavaScript, and anti-bot systems
  • Typed output guarantee: Receive JSON that strictly conforms to your schema
  • Scale confidently: Async batching and transparent pricing support production pipelines

Start with a single product page, validate your schema, then scale to full catalog extraction. Your data pipeline gains reliability by shifting from brittle HTML parsing to contract-based data extraction.

AlterLab // Web Data, Simplified.

Share

Was this article helpful?

Frequently Asked Questions

Target offers limited internal APIs for partners but no public product data API. AlterLab provides structured JSON extraction from publicly accessible Target pages via schema-based AI extraction, handling anti-bot measures while you focus on data usage.
Publicly available e-commerce fields like product title, price, currency, SKU, availability, rating, and brand. Define your exact JSON schema to get validated, typed output — no HTML parsing or selector maintenance required.
AlterLab charges per successful extraction with pay-as-you-go pricing. No minimums or expiring credits. See [pricing](/pricing) for volume discounts — costs scale with your actual data needs.