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

# Extract Products

> Build a structured product catalog from any brand website — names, prices, images, and descriptions — without writing custom scrapers.

<Badge color="orange">10 Credits</Badge> <Badge color="orange">Rate limit weight: 10</Badge> <Badge color="purple">Beta Feature</Badge>

<Info>
  Each call counts as 10 requests against your per-minute [rate limit](/optimization/rate-limits#weighted-endpoints).
</Info>


## OpenAPI

````yaml POST /brand/ai/products
openapi: 3.1.0
info:
  title: Context API
  description: API for retrieving context data from any website
  version: 1.0.0
servers:
  - url: https://api.context.dev/v1
security: []
tags:
  - name: Batch
    description: Scrape many pages or crawl a site asynchronously.
  - name: Monitors
    description: >-
      Monitor pages, sitemaps, and extracted website data for exact or semantic
      changes. Webhook payloads are documented by the
      MonitorsChangeDetectedWebhookPayload and
      MonitorsRunCompletedWebhookPayload schemas.
  - name: WebDBs
    description: Create structured tables from web pages and keep them up to date.
  - name: News
    description: >-
      Search live first-party RSS and free historical news data by company
      identity.
paths:
  /brand/ai/products:
    post:
      tags:
        - Web Extraction
      summary: Extract products from a brand's website
      description: >-
        Extract product information from a brand's website. We will analyze the
        website and return a list of products with details such as name,
        description, image, pricing, features, and more.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - title: By Domain
                  type: object
                  required:
                    - domain
                  properties:
                    domain:
                      type: string
                      description: The domain name to analyze.
                    maxProducts:
                      type: integer
                      minimum: 1
                      maximum: 12
                      description: Maximum number of products to extract.
                    maxAgeMs:
                      type: integer
                      minimum: 0
                      maximum: 2592000000
                      default: 604800000
                      description: >-
                        Return a cached result if a prior scrape for the same
                        parameters exists and is younger than this many
                        milliseconds. Defaults to 7 days (604800000 ms) when
                        omitted. Max is 30 days (2592000000 ms). Set to 0 to
                        always scrape fresh.
                    timeoutMS:
                      $ref: '#/components/schemas/TimeoutMS'
                    tags:
                      $ref: '#/components/schemas/RequestTags'
                - title: By Direct URL
                  type: object
                  required:
                    - directUrl
                  properties:
                    directUrl:
                      type: string
                      format: uri
                      description: >-
                        A specific URL to use directly as the starting point for
                        extraction without domain resolution.
                    maxProducts:
                      type: integer
                      minimum: 1
                      maximum: 12
                      description: Maximum number of products to extract.
                    maxAgeMs:
                      type: integer
                      minimum: 0
                      maximum: 2592000000
                      default: 604800000
                      description: >-
                        Return a cached result if a prior scrape for the same
                        parameters exists and is younger than this many
                        milliseconds. Defaults to 7 days (604800000 ms) when
                        omitted. Max is 30 days (2592000000 ms). Set to 0 to
                        always scrape fresh.
                    timeoutMS:
                      $ref: '#/components/schemas/TimeoutMS'
                    tags:
                      $ref: '#/components/schemas/RequestTags'
      responses:
        '200':
          description: Successful response
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                type: object
                properties:
                  products:
                    type: array
                    description: Array of products extracted from the website
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          description: Name of the product
                        description:
                          type: string
                          description: Description of the product
                        price:
                          type:
                            - number
                            - 'null'
                          description: Price of the product
                        regular_price:
                          type:
                            - number
                            - 'null'
                          description: >-
                            Original or regular price before a displayed
                            discount
                        currency:
                          type:
                            - string
                            - 'null'
                          description: Currency code for the price (e.g., USD, EUR)
                        billing_frequency:
                          type:
                            - string
                            - 'null'
                          enum:
                            - monthly
                            - yearly
                            - one_time
                            - usage_based
                            - null
                          description: Billing frequency for the product
                        pricing_model:
                          type:
                            - string
                            - 'null'
                          enum:
                            - per_seat
                            - flat
                            - tiered
                            - freemium
                            - custom
                            - null
                          description: Pricing model for the product
                        url:
                          type:
                            - string
                            - 'null'
                          description: URL to the product page
                        category:
                          type:
                            - string
                            - 'null'
                          description: Category of the product
                        availability:
                          type:
                            - string
                            - 'null'
                          enum:
                            - in_stock
                            - out_of_stock
                            - limited_availability
                            - preorder
                            - backorder
                            - made_to_order
                            - discontinued
                            - null
                          description: Normalized stock or ordering availability
                        dimensions:
                          type: array
                          description: >-
                            Dimension statements shown for the product,
                            preserving labels, values, and units
                          items:
                            type: string
                        features:
                          type: array
                          description: List of product features
                          items:
                            type: string
                        target_audience:
                          type: array
                          description: Target audience for the product (array of strings)
                          items:
                            type: string
                        tags:
                          type: array
                          description: Tags associated with the product
                          items:
                            type: string
                        image_url:
                          type:
                            - string
                            - 'null'
                          description: URL to the product image
                        images:
                          type: array
                          description: URLs to product images on the page (up to 7)
                          items:
                            type: string
                        sku:
                          type:
                            - string
                            - 'null'
                          description: >-
                            Stock Keeping Unit (product identifier). Null if no
                            identifier is found.
                      required:
                        - name
                        - description
                        - features
                        - target_audience
                        - tags
                        - images
                        - sku
                  cache_metadata:
                    $ref: '#/components/schemas/CacheMetadata'
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
                required:
                  - cache_metadata
        '400':
          description: Bad Request - validation error
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  error_code:
                    type: string
                    enum:
                      - INTERNAL_ERROR
                      - VALID
                      - NOT_FOUND
                      - FORBIDDEN
                      - USAGE_EXCEEDED
                      - RATE_LIMITED
                      - UNAUTHORIZED
                      - DISABLED
                      - INSUFFICIENT_PERMISSIONS
                      - TIMEOUT_EXCEEDS_MAXIMUM
                      - WEBSITE_ACCESS_ERROR
                      - INPUT_VALIDATION_ERROR
                    description: Error code indicating the type of error
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
        '401':
          description: Unauthorized
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error_code:
                    type: string
                    enum:
                      - INTERNAL_ERROR
                      - VALID
                      - NOT_FOUND
                      - FORBIDDEN
                      - USAGE_EXCEEDED
                      - RATE_LIMITED
                      - UNAUTHORIZED
                      - DISABLED
                      - INSUFFICIENT_PERMISSIONS
                      - TIMEOUT_EXCEEDS_MAXIMUM
                      - WEBSITE_ACCESS_ERROR
                      - INPUT_VALIDATION_ERROR
                    description: Error code indicating the type of error
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
        '408':
          description: Request Timeout
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Timeout error message
                  error_code:
                    type: string
                    enum:
                      - REQUEST_TIMEOUT
                    description: Error code indicating request timeout
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: Internal server error
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  error_code:
                    type: string
                    enum:
                      - INTERNAL_ERROR
                    description: Error code indicating internal server error
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import ContextDev from 'context.dev';


            const client = new ContextDev({
              apiKey: process.env['CONTEXT_DEV_API_KEY'], // This is the default and can be omitted
            });


            const response = await client.ai.extractProducts({ domain: 'domain'
            });


            console.log(response.cache_metadata);
        - lang: Python
          source: |-
            import os
            from context.dev import ContextDev

            client = ContextDev(
                api_key=os.environ.get("CONTEXT_DEV_API_KEY"),  # This is the default and can be omitted
            )
            response = client.ai.extract_products(
                domain="domain",
            )
            print(response.cache_metadata)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/context-dot-dev/context-go-sdk\"\n\t\"github.com/context-dot-dev/context-go-sdk/option\"\n)\n\nfunc main() {\n\tclient := contextdev.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.AI.ExtractProducts(context.TODO(), contextdev.AIExtractProductsParams{\n\t\tOfByDomain: &contextdev.AIExtractProductsParamsBodyByDomain{\n\t\t\tDomain: \"domain\",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.CacheMetadata)\n}\n"
        - lang: Ruby
          source: |-
            require "context_dev"

            context_dev = ContextDev::Client.new(api_key: "My API Key")

            response = context_dev.ai.extract_products(body: {domain: "domain"})

            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use ContextDev\Client;

            use ContextDev\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY') ?: 'My
            API Key');


            try {
              $response = $client->ai->extractProducts(
                domain: 'domain',
                maxAgeMs: 0,
                maxProducts: 1,
                tags: ['production', 'team-alpha'],
                timeoutMs: 1000,
                directURL: 'https://example.com',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            context-dev ai extract-products \
              --api-key 'My API Key' \
              --domain domain \
              --direct-url https://example.com
components:
  schemas:
    TimeoutMS:
      type: integer
      minimum: 1000
      maximum: 300000
      description: >-
        Optional timeout in milliseconds for the request. If the request takes
        longer than this value, it will be aborted with a 408 status code.
        Maximum allowed value is 300000ms (5 minutes).
    RequestTags:
      type: array
      items:
        type: string
        minLength: 1
        maxLength: 50
      maxItems: 20
      description: >-
        Optional tags for tracking usage. Up to 20 tags, each 1 to 50
        characters.
      example:
        - production
        - team-alpha
    CacheMetadata:
      type: object
      properties:
        status:
          type: string
          enum:
            - hit
            - miss
            - zdr
          description: >-
            Whether the response was served from cache, required fresh work, or
            honored zero-data-retention cache bypass.
        age_ms:
          type: integer
          minimum: 0
          description: >-
            Age of the cached data in milliseconds. Zero for miss and zdr
            responses.
      required:
        - status
        - age_ms
      additionalProperties: false
      description: >-
        Cache outcome for this response. Composite responses are hits only when
        every cache-controlled fetch contributing to the output was a hit;
        age_ms is the oldest contributing hit.
    KeyMetadata:
      type: object
      properties:
        credits_consumed:
          type: integer
          description: The number of credits consumed by this request.
        credits_remaining:
          type: integer
          description: >-
            The number of credits remaining for your organization after this
            request.
      required:
        - credits_consumed
        - credits_remaining
      description: >-
        Metadata about the API key used for the request. Included in every
        response whenever a valid API key is provided, even when the response
        status is not 200.
  headers:
    RateLimitLimit:
      description: >-
        Maximum requests allowed in the current fixed one-minute window.
        Returned when the authenticated API key has a per-minute rate limit.
      schema:
        type: integer
        minimum: 1
    RateLimitRemaining:
      description: >-
        Requests remaining in the current fixed one-minute window. Returned when
        the authenticated API key has a per-minute rate limit.
      schema:
        type: integer
        minimum: 0
    RateLimitReset:
      description: >-
        Unix timestamp in seconds when the current rate-limit window resets.
        Returned when the authenticated API key has a per-minute rate limit.
      schema:
        type: integer
  responses:
    RateLimited:
      description: Rate limit exceeded
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
        Retry-After:
          description: Seconds until the per-minute rate limit window resets
          schema:
            type: integer
            minimum: 1
            maximum: 60
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error message
              error_code:
                type: string
                enum:
                  - RATE_LIMITED
                description: Error code indicating the rate limit was exceeded
              key_metadata:
                $ref: '#/components/schemas/KeyMetadata'
            required:
              - message
              - error_code
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <API_KEY>`, where
        `<API_KEY>` is your api key.

````