> ## 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.

# Scrape Images

> Find the images on any page and enrich them with metadata for brand, catalog, and content workflows.

<Badge color="blue">1 Credit</Badge> <Badge color="orange">With actions: 2 Credits</Badge> <Badge color="orange">Enriched: 5 Credits</Badge>


## OpenAPI

````yaml GET /web/scrape/images
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:
  /web/scrape/images:
    get:
      tags:
        - Web Scraping
      summary: Scrape Images
      description: >-
        Extract image assets from a web page, including standard URLs, inline
        SVGs, data URIs, responsive image sources, metadata, CSS backgrounds,
        video posters, and embeds. The base request costs 1 credit, or 2 credits
        with browser actions. When enrichment is enabled, the entire call costs
        5 credits, including requests that also use actions.
      parameters:
        - schema:
            type: string
            minLength: 1
            format: uri
            description: Page URL to inspect. Must include http:// or https://.
          required: true
          description: Page URL to inspect. Must include http:// or https://.
          name: url
          in: query
        - schema:
            type:
              - integer
              - 'null'
            minimum: 0
            maximum: 2592000000
            default: 86400000
            description: >-
              Reuse a cached result this many milliseconds old or newer.
              Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum:
              2592000000 (30 days).
          required: false
          description: >-
            Reuse a cached result this many milliseconds old or newer. Default:
            86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30
            days).
          name: maxAgeMs
          in: query
        - schema:
            type:
              - object
              - 'null'
            properties:
              resolution:
                type: boolean
                default: false
                description: Measure image width and height when possible.
              hostedUrl:
                type: boolean
                default: false
                description: >-
                  Host materializable images on the Brand.dev CDN and return
                  their URL and MIME type.
              classification:
                type: boolean
                default: false
                description: Classify each image by visual asset type.
              maxTimePerMs:
                type: integer
                minimum: 1
                maximum: 60000
                default: 30000
                description: >-
                  Per-image enrichment timeout in milliseconds. Default: 30000.
                  Maximum: 60000.
            additionalProperties: false
            description: >-
              Optional per-image processing, sent as deep-object query params
              such as enrichment[resolution]=true.
          required: false
          description: >-
            Optional per-image processing, sent as deep-object query params such
            as enrichment[resolution]=true.
          name: enrichment
          in: query
        - schema:
            type: boolean
            default: false
            description: >-
              When true, visually duplicate images are removed: every image is
              loaded and perceptually hashed, and only the highest-resolution
              copy of each duplicate group is kept. Images that cannot be
              downloaded or hashed are kept. Default: false.
          required: false
          description: >-
            When true, visually duplicate images are removed: every image is
            loaded and perceptually hashed, and only the highest-resolution copy
            of each duplicate group is kept. Images that cannot be downloaded or
            hashed are kept. Default: false.
          name: dedupe
          in: query
        - schema:
            type:
              - integer
              - 'null'
            minimum: 0
            maximum: 30000
            description: >-
              Optional browser wait time in milliseconds after initial page load
              before collecting images. Min: 0. Max: 30000 (30 seconds).
          required: false
          description: >-
            Optional browser wait time in milliseconds after initial page load
            before collecting images. Min: 0. Max: 30000 (30 seconds).
          name: waitForMs
          in: query
        - schema:
            type:
              - array
              - 'null'
            items:
              $ref: '#/components/schemas/WebScrapeAction'
            maxItems: 5
            description: >-
              Optional browser actions executed in array order after the page
              loads and before content is captured. Requires a paid plan. Send a
              JSON array in the query parameter. Maximum: 5 actions.
          required: false
          description: >-
            Optional browser actions executed in array order after the page
            loads and before content is captured. Requires a paid plan. Send a
            JSON array in the query parameter. Maximum: 5 actions.
          name: actions
          in: query
        - schema:
            type: object
            additionalProperties:
              type: string
              maxLength: 8192
              pattern: ^[^\r\n]*$
            description: >-
              Optional outbound HTTP headers forwarded only to the target URL,
              sent as deep-object query params such as headers[X-Custom]=value.
              When provided, caching is bypassed: the result is neither read
              from nor written to cache.
          required: false
          description: >-
            Optional outbound HTTP headers forwarded only to the target URL,
            sent as deep-object query params such as headers[X-Custom]=value.
            When provided, caching is bypassed: the result is neither read from
            nor written to cache.
          name: headers
          in: query
        - schema:
            $ref: '#/components/schemas/LenientTimeoutMS'
          required: false
          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).
          name: timeoutMS
          in: query
        - $ref: '#/components/parameters/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:
                  success:
                    type: boolean
                    enum:
                      - true
                    description: Always true on success.
                  images:
                    type: array
                    description: Images found on the page.
                    items:
                      type: object
                      properties:
                        src:
                          type: string
                          description: >-
                            Original image value: URL, inline SVG or HTML, or
                            base64 data URI.
                        element:
                          type: string
                          enum:
                            - img
                            - svg
                            - link
                            - source
                            - video
                            - css
                            - object
                            - meta
                            - background
                          description: Where the image was found.
                        type:
                          type: string
                          enum:
                            - url
                            - html
                            - base64
                          description: Format of src.
                        alt:
                          type:
                            - string
                            - 'null'
                          description: Image alt text, or null when unavailable.
                        enrichment:
                          type: object
                          description: >-
                            Requested metadata for images that could be
                            processed.
                          properties:
                            width:
                              type: integer
                              description: Image width in pixels, when measured.
                            height:
                              type: integer
                              description: Image height in pixels, when measured.
                            mimetype:
                              type: string
                              description: Detected MIME type, when hosted.
                            url:
                              type: string
                              format: uri
                              description: Brand.dev CDN URL, when hosted.
                            type:
                              type: string
                              enum:
                                - photography
                                - illustration
                                - logo
                                - wordmark
                                - icon
                                - pattern
                                - graphic
                                - other
                              description: Visual asset category, when classified.
                      required:
                        - src
                        - element
                        - type
                        - alt
                  url:
                    type: string
                    description: Page URL that was scraped.
                  cache_metadata:
                    $ref: '#/components/schemas/CacheMetadata'
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
                  actionsApplied:
                    type: array
                    description: >-
                      One verified outcome per requested browser action, in
                      request order.
                    items:
                      type: object
                      properties:
                        instruction:
                          type: string
                        status:
                          type: string
                          enum:
                            - applied
                            - failed
                            - skipped
                          description: >-
                            Applied means the requested page state was visibly
                            verified. Failed means it was not verified. Skipped
                            means it was not attempted.
                        method:
                          type: string
                        targetDescription:
                          type: string
                        completionEvidence:
                          type: string
                          description: >-
                            Visible page evidence used to verify an applied
                            action.
                        error:
                          type: string
                        durationMs:
                          type: number
                      required:
                        - instruction
                        - status
                required:
                  - success
                  - images
                  - url
                  - cache_metadata
        '400':
          description: Invalid URL or scrape failed.
          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 describing the issue
                  error_code:
                    type: string
                    enum:
                      - INPUT_VALIDATION_ERROR
                      - WEBSITE_ACCESS_ERROR
                    description: Error code indicating the type of error
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
                required:
                  - message
                  - error_code
        '401':
          description: Unauthorized - Invalid or missing API key
          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:
                      - UNAUTHORIZED
                    description: Error code indicating unauthorized access
                  key_metadata:
                    $ref: '#/components/schemas/KeyMetadata'
        '403':
          description: Forbidden - Insufficient permissions or usage limit exceeded
          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:
                      - FORBIDDEN
                      - USAGE_EXCEEDED
                      - DISABLED
                      - INSUFFICIENT_PERMISSIONS
                    description: Error code indicating forbidden access
                  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.web.webScrapeImages({ url:
            'https://example.com' });


            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.web.web_scrape_images(
                url="https://example.com",
            )
            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.Web.WebScrapeImages(context.TODO(), contextdev.WebWebScrapeImagesParams{\n\t\tURL: \"https://example.com\",\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.web.web_scrape_images(url:
            "https://example.com")


            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->web->webScrapeImages(
                url: 'https://example.com',
                actions: [['do' => 'wait', 'timeMs' => 0]],
                dedupe: true,
                enrichment: [
                  'classification' => true,
                  'hostedURL' => true,
                  'maxTimePerMs' => 1,
                  'resolution' => true,
                ],
                headers: ['foo' => 'J!'],
                maxAgeMs: 0,
                tags: ['production', 'team-alpha'],
                timeoutMs: 1,
                waitForMs: 0,
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            context-dev web web-scrape-images \
              --api-key 'My API Key' \
              --url https://example.com
components:
  schemas:
    WebScrapeAction:
      oneOf:
        - $ref: '#/components/schemas/WebScrapeWaitAction'
        - $ref: '#/components/schemas/WebScrapePerformAction'
        - $ref: '#/components/schemas/WebScrapeScrollAction'
      discriminator:
        propertyName: do
        mapping:
          wait:
            $ref: '#/components/schemas/WebScrapeWaitAction'
          perform:
            $ref: '#/components/schemas/WebScrapePerformAction'
          scroll:
            $ref: '#/components/schemas/WebScrapeScrollAction'
      description: >-
        Browser action discriminated by `do`. Each variant exposes only its
        applicable fields.
    LenientTimeoutMS:
      type: integer
      minimum: 1
      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).
    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.
    WebScrapeWaitAction:
      type: object
      properties:
        do:
          type: string
          enum:
            - wait
        timeMs:
          type: integer
          minimum: 0
          maximum: 30000
      required:
        - do
        - timeMs
      additionalProperties: false
      description: >-
        Pause for a fixed number of milliseconds before continuing to the next
        action.
      title: Wait
    WebScrapePerformAction:
      type: object
      properties:
        do:
          type: string
          enum:
            - perform
        action:
          type: string
          minLength: 1
          maxLength: 500
      required:
        - do
        - action
      additionalProperties: false
      description: Resolve and perform one natural-language browser action.
      title: Perform
    WebScrapeScrollAction:
      type: object
      properties:
        do:
          type: string
          enum:
            - scroll
        direction:
          type: string
          enum:
            - up
            - down
            - left
            - right
          description: Direction to scroll. Defaults to down.
        amount:
          anyOf:
            - type: integer
              minimum: 1
              maximum: 100000
            - type: string
              enum:
                - viewport
                - max
          description: >-
            Pixels per scroll, one visible viewport, or the current scroll
            boundary. Defaults to viewport.
        container:
          type: string
          minLength: 1
          maxLength: 2000
          description: >-
            CSS selector for the first matching scroll container. Defaults to
            the page.
        maxScrolls:
          type: integer
          minimum: 1
          maximum: 50
          description: >-
            Maximum scroll iterations. Stops early when scrolling and scrollable
            extent stop changing. Defaults to 1.
      required:
        - do
      additionalProperties: false
      description: >-
        Scroll the page or a selected scrollable container, waiting adaptively
        for content and dimensions to settle after each iteration.
      title: Scroll
    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
  parameters:
    RequestTags:
      name: tags
      in: query
      required: false
      style: form
      explode: false
      schema:
        $ref: '#/components/schemas/RequestTags'
      description: >-
        Optional comma-separated caller-defined tags for tracking this request.
        Tags are recorded on the request's usage log and can be used to filter
        usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.
      example: production,team-alpha
  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.

````