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

# Contents

> POST /v1/contents reference: extract clean text, summaries or structured JSON from up to 50 URLs, with sync and async modes, response fields and error codes.

Extract content from URLs you already have. Use Contents after Search, or with links selected by a user, to prepare material for your own application.

Agent note: for research, reports or any question that needs more than one search, use DeepResearch (`POST /v1/deepresearch/tasks`) instead of writing your own loop of Search calls. Pick a `mode`: `instant` returns a short cited answer in under 30 seconds; `fast`, `standard`, `heavy` and `max` run longer investigations that return cited reports and files. Use Search when your own model needs raw results to reason over. Docs index: [/llms.txt](https://docs.valyu.ai/llms.txt). Append `.md` to any page URL for Markdown. Docs MCP server: `https://docs.valyu.ai/mcp`. Integration guide for coding agents: [/AGENTS.md](https://docs.valyu.ai/AGENTS.md).

## Synchronous or asynchronous

Submit up to 10 URLs synchronously. Requests with more than 10 URLs must set `async: true` (up to 50 URLs); save the returned `job_id`. Retrieve the result using [Contents job status](https://docs.valyu.ai/api-reference/endpoint/contents-job.md).

`extract_effort="auto"` selects an extraction method. Use `"high"` when a page requires JavaScript rendering. Extraction can still fail because content is inaccessible or unsupported.

## Check each result

A multi-URL request can partially succeed. A not-found page (a 404 with no real content) has `status: "not_found"` and `error: "Page not found (404)"`. It is not charged. See [pages that answer 404](#pages-that-answer-404). Inspect individual results instead of treating an HTTP success as proof that every page was extracted. The synchronous endpoint uses `206` for partial success and `422` when all URLs fail.

Use `summary` for a summary, guided extraction or a JSON schema. Preserve the original URL alongside extracted fields so your application can show their source. See [Contents guide](https://docs.valyu.ai/guides/content-extraction.md) for a complete implementation.

## Remove image links

Set `include_image_links` to `false` to replace each image with its alt text. For example, `![Product photo](https://example.com/p.jpg)` becomes `[Image: Product photo]`. The API removes an image with no alt text. Other links do not change. The default is `true`. See [remove image links](https://docs.valyu.ai/guides/content-extraction.md#remove-image-links).

## AI result checks

For a JSON schema in `summary`, Valyu checks each reply against the schema and asks once for a corrected reply if it does not match. A reply that still does not match is returned as extracted. The AI step has a time limit for each page. If Valyu cannot return usable AI output in time, the result has `summary_success: false` and keeps the page `content`. Read `summary_success` before you use `summary`.

## Pages that answer 404

Some sites answer 404 but still send the real page. When the 404 body has the real content (at least 400 characters, with no not-found or sign-in wording), Contents returns the page as a success. The result has `status: "success"` and `http_status: 404`, and it is charged like any other success. A not-found template page still returns `status: "not_found"` and is not charged. This applies to Contents, sync and async. Search is not changed.

## Pages that redirect

When a URL redirects to a different page, the result has `final_url`, the page that Contents read. For example, a closed job posting can redirect to the careers page, and the `content` is then the careers page. Compare `final_url` with `url` before you use the content. `final_url` is not set when there was no redirect. A change of scheme, host case, `www.`, trailing slash or `#fragment` is not a different page.

## Control caching

Set `max_age` to the oldest cached copy of a page, in seconds, that you accept. `0` forces a live crawl. Use an integer from `0` to `2592000` (30 days). Without `max_age`, Contents can return a copy up to 7 days old, and it refreshes a copy older than 30 minutes in the background. With `max_age`, Contents starts no background refresh. Do not use `max_age` with `historical_cache`. It also works with `async: true`. Billing does not change.

Each successful result has `cache_state` (`hit`, `miss` or `stale`) and `crawled_at` (ISO 8601 time that the page copy was captured, or `null`). See [control caching](https://docs.valyu.ai/guides/content-extraction.md#control-caching).

## Cost

Each successfully extracted URL uses 0.2 credits, or 0.6 in total when `summary` is set (text summary or structured extraction; the same price for sync and async requests). If the AI step fails for a URL, you pay only the 0.2 credits for extraction. Failed URLs are free. A result's `price` is the base extraction price only; `total_cost_dollars` is the amount charged, including any AI processing. Set `max_price_dollars` to cap a request: it returns `400` if the worst case exceeds the cap before processing, and `402` if the actual cost does.

For point-in-time extraction, pass `start_date`, `end_date` and `historical_cache: true`. Contents then serves only snapshots captured inside the window, and a URL without one fails instead of falling back to a live crawl.


## OpenAPI

````yaml POST /v1/contents
openapi: 3.0.3
info:
  title: Valyu API
  version: 2.3.0
  description: >
    The search API built for AI agents. One API that gives your AI unified
    access to web search, academic papers, financial data, SEC filings, clinical
    trials, patents, genomics, and 40+ proprietary data sources.


    ## Products


    | Product | Endpoint | Description |

    | --- | --- | --- |

    | **Search** | `POST /v1/search` | Multi-source search across web and
    proprietary datasets |

    | **Contents** | `POST /v1/contents` | Extract clean, structured content
    from URLs |

    | **Answer** | `POST /v1/answer` | AI-powered answers with real-time search
    |

    | **DeepResearch** | `POST /v1/deepresearch/tasks` | Async research agents
    for comprehensive analysis |

    | **Workflows** (Beta) | `GET /v1/workflows` | Templated, versioned
    DeepResearch for repeatable knowledge work |

    | **Datasources** | `GET /v1/datasources` | Discover available data sources
    and their schemas |


    ## Authentication


    All endpoints require an API key passed via the `X-API-Key` header (the
    lowercase `x-api-key` form is also accepted). Get your key at
    [platform.valyu.ai](https://platform.valyu.ai).


    ```

    X-API-Key: your_api_key_here

    ```


    ## Pricing


    Pay per use in credits. One credit balance covers every API.

    - **Search**: priced per result returned. Web and news results use 0.1
    credits each (100 per 1,000 results). arXiv, PubMed, bioRxiv and medRxiv use
    0.05 credits each (50 per 1,000). Other datasets have their own price per
    1,000 results, listed in `GET /v1/datasources` (`pricing.cpm`).

    - **Contents**: 0.2 credits per successfully extracted URL. Any AI
    processing (a text summary or structured extraction through `summary`)
    brings the price to 0.6 credits per URL in total, the same for both. Failed
    URLs are free.

    - **Answer**: no per-request fee. You pay for the search, content extraction
    and AI processing each answer uses, reported in
    `cost.total_deduction_dollars`.

    - **DeepResearch**: fixed price per task by mode: instant 8 credits, fast
    25, standard 100, heavy 500, max 2,500, plus tool add-ons.


    Every plan includes web search and open academic sources. Paid plans unlock
    specialist sources such as SEC filings, clinical trials, patents and
    genomics. See [pricing](https://docs.valyu.ai/pricing) for plans and free
    credits.


    ## Rate limits


    Limits apply per organisation: 10 requests per second with bursts up to 20,
    and 86,400 requests per day by default. Enterprise plans can raise them. A
    request over the limit is currently rejected with `403 Forbidden` and the
    body `{"error": "Forbidden", "message": "Access denied - API key is invalid,
    disabled, or revoked"}`. If a key that otherwise works starts receiving 403
    under load, reduce concurrency and retry with exponential backoff.


    ## SDKs


    - [Python SDK](https://pypi.org/project/valyu/) - `pip install valyu`

    - [TypeScript SDK](https://www.npmjs.com/package/valyu-js) - `npm install
    valyu-js`
  contact:
    name: Valyu Support
    url: https://valyu.ai
    email: support@valyu.ai
  x-logo:
    url: https://valyu.ai/logo.png
    altText: Valyu
servers:
  - url: https://api.valyu.ai
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Search
    description: >-
      Search across web, academic, financial, and proprietary data sources.
      Returns results ready for RAG pipelines, AI agents, and applications.
    externalDocs:
      description: Search API Guide
      url: https://docs.valyu.ai/search/quickstart
  - name: Contents
    description: >-
      Extract clean, structured content from web pages at scale. Supports batch
      processing, AI-powered summaries, structured extraction via JSON schemas,
      and async jobs for large URL sets.
    externalDocs:
      description: Contents API Guide
      url: https://docs.valyu.ai/guides/content-extraction
  - name: Answer
    description: >-
      Get AI-powered answers grounded in real-time search results. The Answer
      API searches across web, academic, and financial sources, then uses AI to
      generate a readable response via Server-Sent Events streaming.
    externalDocs:
      description: Answer API Guide
      url: https://docs.valyu.ai/guides/answer-api
  - name: DeepResearch
    description: >-
      Async research agents that perform comprehensive, multi-step research.
      DeepResearch searches multiple sources, analyzes content, and generates
      detailed reports with citations. Tasks run in the background and can take
      minutes to complete.
    externalDocs:
      description: DeepResearch Guide
      url: https://docs.valyu.ai/guides/deepresearch
  - name: Batches
    description: >-
      Run multiple DeepResearch tasks in parallel with shared configuration,
      unified monitoring, and aggregated cost tracking.
    externalDocs:
      description: Batch API Guide
      url: https://docs.valyu.ai/guides/deepresearch-batch-quickstart
  - name: Workflows
    description: >-
      **Beta.** Templated, versioned DeepResearch for repeatable knowledge work
      - earnings previews, diligence reads, market sizings. A workflow bundles a
      prompt template with typed variables, a research strategy, report format,
      deliverables, tools, and a recommended mode. Workflows are immutably
      versioned; runs can pin a version. Two scopes exist: your organization's
      private workflows and curated Valyu workflows available to everyone. Run a
      workflow by passing `workflow_id` + `workflow_params` to `POST
      /v1/deepresearch/tasks` - same auth, billing, and task lifecycle as
      freeform DeepResearch.
    externalDocs:
      description: Workflows Guide (Beta)
      url: https://docs.valyu.ai/guides/workflows
  - name: Datasources
    description: >-
      Discover available data sources and their schemas. A tool manifest for AI
      agents - instead of hardcoding knowledge of available datasets, agents can
      query this API to discover sources, filter by category, and use
      `example_queries` for few-shot prompting.
    externalDocs:
      description: Datasources Guide
      url: https://docs.valyu.ai/guides/datasources
externalDocs:
  description: Complete API Documentation
  url: https://docs.valyu.ai
paths:
  /v1/contents:
    post:
      tags:
        - Contents
      summary: Extract clean, structured content from URLs
      description: >-
        Extract content from URLs, with optional summaries, structured
        extraction and screenshots. Access or extraction can fail for individual
        URLs.


        - **Synchronous:** Submit up to 10 URLs and receive results directly.

        - **Asynchronous:** Set `async: true` for up to 50 URLs, save the
        returned `job_id` and poll the job endpoint. Requests with more than 10
        URLs must use `async: true`.

        - **Partial success:** Inspect the result for each URL rather than
        treating the request as all-or-nothing.


        **Pricing:** 0.2 credits per successfully extracted URL. When `summary`
        is enabled (text summary or structured extraction), the price is 0.6
        credits per URL in total. This applies to synchronous and async
        requests. Failed URLs are free. `total_cost_dollars` is the amount
        charged.
      operationId: extractContents
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContentsRequest'
            examples:
              basic:
                summary: Basic content extraction
                value:
                  urls:
                    - https://en.wikipedia.org/wiki/Quantum_computing
              With Summary:
                summary: Extraction with AI summary
                value:
                  urls:
                    - https://example.com/selected-paper
                  summary: Summarize the key findings and methodology
                  response_length: medium
              structured:
                summary: Structured data extraction with JSON schema
                value:
                  urls:
                    - https://example.com/product-page
                  summary:
                    type: object
                    properties:
                      product_name:
                        type: string
                      price:
                        type: number
                      features:
                        type: array
                        items:
                          type: string
              Async Batch:
                summary: Async batch processing with webhook
                value:
                  urls:
                    - https://example.com/page1
                    - https://example.com/page2
                  async: true
                  webhook_url: https://example.com/webhooks/valyu
      responses:
        '200':
          description: All URLs processed successfully (synchronous).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContentsResponse'
              examples:
                basic:
                  summary: Illustrative extraction response with one successful URL
                  value:
                    success: true
                    error: null
                    tx_id: tx_c1d2e3f4-a5b6-7890-cdef-123456789abc
                    urls_requested: 1
                    urls_processed: 1
                    urls_failed: 0
                    results:
                      - url: https://example.com/article
                        status: success
                        title: Illustrative article
                        content: |-
                          # Illustrative article

                          Placeholder text representing extracted page content.
                        description: Placeholder article for demonstrating extraction.
                        source: web
                        price: 0.00125
                        length: 77
                        data_type: unstructured
                        source_type: website
                        image_url: {}
                    total_cost_dollars: 0.00125
                    total_characters: 77
                structured:
                  summary: >-
                    Illustrative structured extraction (price is the 0.2 credit
                    base; total_cost_dollars includes the 0.4 credit AI
                    processing, 0.6 credits in total)
                  value:
                    success: true
                    error: null
                    tx_id: tx_struct-1234-5678-abcd-ef0123456789
                    urls_requested: 1
                    urls_processed: 1
                    urls_failed: 0
                    results:
                      - url: https://example.com/product-page
                        status: success
                        title: Product Page
                        content:
                          product_name: Example product
                          price: 29.99
                          features:
                            - Feature A
                            - Feature B
                        source: web
                        price: 0.00125
                        length: 91
                        data_type: structured
                        summary_success: true
                    total_cost_dollars: 0.00375
                    total_characters: 91
        '202':
          description: Async job created. Poll the `poll_url` for results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContentsAsyncResponse'
              examples:
                example:
                  summary: Async job created
                  value:
                    success: true
                    job_id: cj_a1b2c3d4e5f6g7h8
                    status: pending
                    urls_total: 25
                    poll_url: /contents/jobs/cj_a1b2c3d4e5f6g7h8
                    tx_id: tx_async-1234-5678-abcd-ef0123456789
                    webhook_secret: EXAMPLE_WEBHOOK_SECRET_REPLACE_WITH_RETURNED_VALUE
        '206':
          description: Partial success - some URLs failed processing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContentsResponse'
        '400':
          description: The request was malformed or contained invalid parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                async_required:
                  summary: More than 10 URLs without async
                  value:
                    success: false
                    error: >-
                      Requests with more than 10 URLs require async processing.
                      Set 'async': true in your request to process 12 URLs.
                too_many_urls:
                  summary: More than 50 URLs
                  value:
                    success: false
                    error: Maximum 50 URLs allowed per request
                max_price:
                  summary: Worst-case cost above max_price_dollars
                  value:
                    success: false
                    error: >-
                      Maximum possible cost $0.0375 exceeds max_price_dollars
                      $0.01
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: >-
            The request can't be paid for. See the shared payment errors:
            `insufficient_credits`, `credit_limit_reached` and
            `spend_cap_reached`.


            Also returned after processing when the actual cost exceeds
            `max_price_dollars`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                insufficient_credits:
                  summary: Balance exhausted
                  value:
                    success: false
                    error: >-
                      Your credit balance is used up. Nothing was charged. Top
                      up to continue:
                      https://platform.valyu.ai/user/account/billing?tab=credits
                      Monthly plans give you cheaper credits and more data
                      sources:
                      https://platform.valyu.ai/user/account/billing?tab=plan
                    code: insufficient_credits
                    recovery:
                      topup_url: >-
                        https://platform.valyu.ai/user/account/billing?tab=credits
                      topup_api: POST https://api.valyu.ai/v1/account/balance/topup
                      upgrade_url: https://platform.valyu.ai/user/account/billing?tab=plan
                credit_limit_reached:
                  summary: Monthly usage limit reached
                  value:
                    success: false
                    error: >-
                      Your organisation's monthly credit limit is reached.
                      Nothing was charged. Raise the limit to continue:
                      https://platform.valyu.ai/user/account/billing?tab=credits
                    code: credit_limit_reached
                    recovery:
                      increase_limit_url: >-
                        https://platform.valyu.ai/user/account/billing?tab=credits
                spend_cap_reached:
                  summary: API key budget cap reached
                  value:
                    success: false
                    error: >-
                      This API key has reached its credit cap. Nothing was
                      charged. Raise the key's cap or use an uncapped key:
                      https://platform.valyu.ai/user/account/apikeys
                    code: spend_cap_reached
                    recovery:
                      increase_cap_url: https://platform.valyu.ai/user/account/apikeys
                max_price_exceeded:
                  summary: Actual cost above max_price_dollars
                  value:
                    success: false
                    error: Actual cost $0.0125 exceeds max_price_dollars $0.01
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: All URLs failed to process. No charge is applied.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Why extraction failed.
                  results:
                    type: array
                    description: Always empty.
                    items: {}
                    example: []
              examples:
                all_failed:
                  summary: All URLs failed
                  value:
                    success: false
                    error: >-
                      Could not process the requested URL(s). See the per-result
                      'error' field for details.
                    results: []
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    ContentsRequest:
      type: object
      required:
        - urls
      additionalProperties: true
      description: Content extraction request parameters.
      properties:
        urls:
          type: array
          description: >-
            URLs to extract content from. Must be valid HTTP/HTTPS URLs.
            Duplicates are silently removed.
          items:
            type: string
            format: uri
          minItems: 1
          maxItems: 50
          example:
            - https://en.wikipedia.org/wiki/Quantum_computing
            - https://example.com/selected-paper
        response_length:
          description: |-
            Maximum character length of extracted content per URL.

            - `"short"` - 25,000 characters (default)
            - `"medium"` - 50,000 characters
            - `"large"` - 100,000 characters
            - `"max"` - No limit
            - Any positive integer for a custom character limit
          oneOf:
            - type: string
              enum:
                - short
                - medium
                - large
                - max
            - type: integer
              minimum: 1
          default: short
        max_price_dollars:
          type: number
          description: >-
            Maximum budget for this request. Defaults to 2x the maximum possible
            cost.


            - If the worst-case cost exceeds this value, the request is rejected
            before processing with 400.

            - If the actual cost after processing exceeds it, the request
            returns 402.
          minimum: 0
          exclusiveMinimum: true
          example: 0.05
        summary:
          description: >-
            Controls AI-powered content processing. Brings the price to 0.6
            credits per successfully extracted URL in total (0.2 base plus 0.4
            for AI processing) when enabled. A text summary and structured
            extraction cost the same. If the AI step fails for a URL, only the
            0.2 credit base is charged.


            - `false` - No AI processing, raw extracted content only (default)

            - `true` - Generate a text summary of each page

            - `"string"` - Generate a summary guided by custom instructions (max
            500 characters)

            - `{json_schema}` - Extract structured data matching the provided
            JSON schema
          oneOf:
            - type: boolean
            - type: string
              maxLength: 500
            - type: object
              description: >-
                JSON Schema for structured extraction. Supports types: object,
                array, string, number, integer, boolean.
          default: false
        extract_effort:
          type: string
          description: |-
            Controls how pages are rendered for extraction.

            - `"auto"` - Automatically selects the best method per URL (default)
            - `"normal"` - HTTP-only extraction, fastest
            - `"high"` - Full Chrome rendering, best for JavaScript-heavy pages
          enum:
            - auto
            - normal
            - high
          default: auto
        start_date:
          type: string
          description: >-
            Start of the date window for point-in-time extraction. Accepts
            `YYYY`, `YYYY-MM-DD` or an ISO-8601 datetime. Use with
            `historical_cache`.
          example: '2024-01-01'
        end_date:
          type: string
          description: >-
            End of the date window (the cutoff) for point-in-time extraction.
            Accepts `YYYY`, `YYYY-MM-DD` or an ISO-8601 datetime. A year alone
            means the last day of that year. `start_date` must be on or before
            `end_date`.
          example: '2024-12-31'
        historical_cache:
          type: boolean
          description: >-
            Serve a snapshot captured inside the date window instead of a live
            crawl. On Contents this always applies `historical_cache_strict:
            "only"`: a URL with no qualifying snapshot fails rather than falling
            back to a live crawl.
          default: false
        historical_cache_strict:
          type: string
          enum:
            - 'off'
            - prefer
            - only
          description: >-
            Snapshot policy. Accepted for parity with Search, but on Contents
            any request with `historical_cache: true` uses `only`, whatever
            value is passed.
        screenshot:
          type: boolean
          description: >-
            Capture a screenshot of each page. The screenshot URL is returned in
            each result's `screenshot_url` field.
          default: false
        include_image_links:
          type: boolean
          description: >-
            Keep image URLs in the content. When `true` (default), images stay
            as markdown, for example `![Product
            photo](https://example.com/p.jpg)`. When `false`, each image becomes
            `[Image: Product photo]`. The API removes the image URL and keeps
            the alt text. The API removes an image with no alt text. A linked
            image `[![alt](src)](href)` becomes `[[Image: alt]](href)`. Other
            links do not change. Set `false` to use fewer tokens.
          default: true
        max_age:
          type: integer
          minimum: 0
          maximum: 2592000
          description: >-
            The oldest cached copy of a page, in seconds, that you accept. `0`
            forces a live crawl. Omit it for the default cache policy: a copy up
            to 7 days old, with a background refresh when it is older than 5
            minutes. A value from 1 to 2592000 (30 days) accepts a copy at most
            that old and starts no background refresh. Cannot be used with
            `historical_cache`. Works with `async` too. Billing does not change.
          example: 3600
        async:
          type: boolean
          description: >-
            Process URLs asynchronously in the background. Returns a `job_id` to
            poll via `GET /v1/contents/jobs/{job_id}`. Required when submitting
            more than 10 URLs (maximum 50). Also useful for slow,
            JavaScript-heavy pages.
          default: false
        webhook_url:
          type: string
          format: uri
          description: >-
            HTTPS URL to receive a webhook POST when async processing completes.
            Only used when `async` is `true`. The webhook payload is signed with
            HMAC-SHA256.
          example: https://example.com/webhooks/valyu
    ContentsResponse:
      type: object
      description: Synchronous content extraction response.
      required:
        - success
        - tx_id
        - urls_requested
        - urls_processed
        - urls_failed
        - results
        - total_cost_dollars
        - total_characters
      properties:
        success:
          type: boolean
          description: Whether the extraction completed successfully.
          example: true
        error:
          type: string
          nullable: true
          description: Error message if some URLs failed. `null` on complete success.
          example: null
        tx_id:
          type: string
          description: Transaction ID for tracking.
          example: tx_a1b2c3d4-e5f6-7890-abcd-ef1234567890
        urls_requested:
          type: integer
          description: Number of deduplicated URLs submitted.
          example: 3
        urls_processed:
          type: integer
          description: Number of URLs successfully processed.
          example: 3
        urls_failed:
          type: integer
          description: Number of URLs that failed processing.
          example: 0
        results:
          type: array
          description: Extraction results for each URL.
          items:
            $ref: '#/components/schemas/ContentResult'
        total_cost_dollars:
          type: number
          description: >-
            Total amount charged, including AI processing (0.4 credits on top of
            the 0.2 credit base, 0.6 credits in total per URL). Only
            successfully extracted URLs are charged.
          example: 0.00375
        total_characters:
          type: integer
          description: Sum of all result content lengths.
          example: 45230
    ContentsAsyncResponse:
      type: object
      description: Response returned when async processing is initiated.
      required:
        - success
        - job_id
        - status
        - urls_total
        - poll_url
        - tx_id
      properties:
        success:
          type: boolean
          description: Whether the async job was created successfully.
          example: true
        job_id:
          type: string
          description: Job identifier for polling status.
          example: cj_a1b2c3d4e5f6g7h8
        status:
          type: string
          description: Initial job status.
          enum:
            - pending
          example: pending
        urls_total:
          type: integer
          description: Total number of URLs queued for processing.
          example: 25
        poll_url:
          type: string
          description: Relative URL to poll for job status.
          example: /contents/jobs/cj_a1b2c3d4e5f6g7h8
        tx_id:
          type: string
          description: Transaction ID.
          example: tx_a1b2c3d4-e5f6-7890-abcd-ef1234567890
        webhook_secret:
          type: string
          description: >-
            HMAC-SHA256 secret for verifying webhook payloads. Only present when
            `webhook_url` was provided.
          example: EXAMPLE_WEBHOOK_SECRET_REPLACE_WITH_RETURNED_VALUE
    Error:
      type: object
      description: >-
        Error response. Every error body has `error`. Search, Contents, Answer
        and Datasources errors usually also carry `success: false`. Errors
        returned before a request reaches the endpoint (missing, invalid or
        disabled keys, rate limits) and DeepResearch errors have no `success`
        field. Some errors add a machine-readable `code` and a `recovery`
        object.
      required:
        - error
      properties:
        success:
          type: boolean
          description: '`false` when present.'
          example: false
        error:
          type: string
          description: >-
            Error message, or a machine-readable code for some errors (for
            example `invalid_scope_policy`, or `rate_limited` on a `429`).
          example: Invalid request parameters
        message:
          type: string
          description: >-
            Human-readable detail. Present on errors returned before the request
            reaches the endpoint.
        code:
          type: string
          description: >-
            Stable machine-readable error code, when available. Branch on this
            rather than on the message text.
          example: insufficient_credits
        recovery:
          type: object
          description: Links or details that help resolve the error, when available.
          additionalProperties: true
        transaction_id:
          type: string
          description: Transaction ID for support, when available.
    ContentResult:
      type: object
      description: Extracted content from a single URL.
      required:
        - url
        - status
      properties:
        url:
          type: string
          format: uri
          description: The URL that was processed.
          example: https://example.com/research/source-1
        status:
          type: string
          description: >-
            Processing status for this URL. `not_found` means that the page is a
            not-found page (a 404 with no real content). Only `success` results
            are charged.
          enum:
            - success
            - failed
            - not_found
          example: success
        title:
          type: string
          description: Page title. Present when `status` is `"success"`.
          example: Illustrative source document
        content:
          description: >-
            Extracted content. Markdown string when `data_type` is
            `"unstructured"`, JSON object when `data_type` is `"structured"`.
            Present when `status` is `"success"`.
          oneOf:
            - type: string
              description: Markdown-formatted content.
            - type: object
              description: Structured data matching the provided JSON schema.
          example: Placeholder content representing the text returned from a source.
        description:
          type: string
          description: Meta description of the page.
          example: Illustrative metadata, not a factual research finding.
        source:
          type: string
          description: >-
            `"web"` for web pages, or the dataset id for academic papers served
            from Valyu's processed index (e.g. `valyu/valyu-arxiv`,
            `valyu/valyu-pubmed`, `valyu/valyu-biorxiv`, `valyu/valyu-medrxiv`,
            `valyu/valyu-chemrxiv`).
          example: web
        price:
          type: number
          description: >-
            Base extraction price for this URL (0.2 credits). Excludes AI
            processing for `summary` (0.4 credits more, 0.6 credits in total);
            use the response's `total_cost_dollars` for the amount charged.
          example: 0.00125
        length:
          type: integer
          description: Character count of the `content` field.
          example: 65
        data_type:
          type: string
          description: >-
            `"unstructured"` for text content, `"structured"` when JSON schema
            extraction succeeded.
          enum:
            - unstructured
            - structured
          example: unstructured
        source_type:
          type: string
          description: >-
            Classification of the content type. `"paper"` for academic papers
            served from the processed index.
          enum:
            - website
            - pdf
            - txt
            - json
            - xml
            - sitemap
            - csv
            - paper
          example: website
        publication_date:
          type: string
          description: Publication date in `YYYY-MM-DD` format, or empty string if unknown.
          example: '2024-03-15'
        cache_state:
          type: string
          enum:
            - hit
            - miss
            - stale
          description: >-
            How the page was served. `miss`: this request crawled the page.
            `hit`: a cached copy answered the request and was fresh for you.
            `stale`: the page cache served a copy older than 5 minutes for a
            request with no `max_age`, and the page is refreshed in the
            background. Papers served from the processed index return `hit`.
            Present when `status` is `"success"`.
          example: miss
        crawled_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            Time that the page copy was captured, in ISO 8601. For `miss` it is
            the crawl time. `null` when there is no page copy to date, for
            example a paper served from the processed index. Present when
            `status` is `"success"`.
          example: '2026-10-28T10:15:00+00:00'
        final_url:
          type: string
          format: uri
          description: >-
            The page that Contents read, when the URL redirected to a different
            page. For example, a closed job posting can redirect to the careers
            page. Not present when there was no redirect. A change of scheme,
            host case, `www.`, trailing slash or fragment is not a different
            page.
          example: https://example.com/careers
        http_status:
          type: integer
          enum:
            - 404
          description: >-
            Present, and always `404`, only when the server answered 404 but the
            body is the real page. Such a result has `status` `"success"` and is
            charged like any other success. A not-found template page has
            `status` `"not_found"` and no `http_status`.
          example: 404
        id:
          type: string
          description: >-
            Identifier for this result. The URL for web pages, or the bare paper
            id / DOI for academic papers (e.g. `2506.05440`,
            `10.26434/chemrxiv-2025-chn4j`).
          example: https://example.com/research/source-1
        image_url:
          type: object
          description: Image URLs found on the page, keyed by index.
          additionalProperties:
            type: string
            format: uri
          example:
            '0': https://example.com/images/source-image.png
        screenshot_url:
          type: string
          format: uri
          description: >-
            Screenshot URL. Present only when `screenshot` was enabled; omitted
            otherwise.
          example: https://example.com/screenshots/source-1.png
        summary:
          description: >-
            AI-generated summary or structured extraction result. Only present
            when `summary` was enabled in the request.
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
        summary_success:
          type: boolean
          description: >-
            Whether AI processing succeeded. Only present when `summary` was
            enabled.
        structured_metadata:
          type: object
          description: >-
            Metadata from structured data extraction. Only present when
            `data_type` is `"structured"`.
          additionalProperties: true
        error:
          type: string
          description: >-
            Human-readable failure reason. Only present when `status` is
            `"failed"` or `"not_found"`. For `not_found` it is `Page not found
            (404)`. Describes why extraction failed without exposing internal
            infrastructure.
          example: >-
            Could not extract content from this URL. The page may be
            unavailable, require sign-in, or block automated access.
        doi:
          type: string
          description: >-
            Paper DOI. Present for academic papers served from the processed
            index.
        authors:
          type: array
          items:
            type: string
          description: >-
            Paper authors. Present for academic papers served from the processed
            index.
        citation_count:
          type: integer
          description: >-
            Citation count. Present for academic papers served from the
            processed index.
  responses:
    Unauthorized:
      description: Missing or invalid API key. Send your key in the `X-API-Key` header.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missing_or_invalid:
              summary: Missing or invalid API key
              value:
                error: Unauthorized
                message: API key is missing or invalid
            invalid_key:
              summary: Invalid API key (endpoint response)
              value:
                success: false
                error: Invalid API key
    Forbidden:
      description: >-
        The API key is disabled, revoked or lacks permission for this operation.
        A request over the rate limit returns `429`, not `403`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            forbidden:
              summary: Key disabled or revoked
              value:
                error: Forbidden
                message: Access denied - API key is invalid, disabled, or revoked
            permission:
              summary: Key lacks permission
              value:
                success: false
                error: API key does not have inference permission
    RateLimited:
      description: >-
        Over this endpoint's rate limit for your plan. Nothing is charged. Wait
        `retry_after` seconds (the `Retry-After` header), then retry with
        backoff. See [Rate
        limits](https://docs.valyu.ai/api-reference/overview#rate-limits).


        `message` is a sentence you can relay that names the limit and how to
        raise it. `error` and `code` are both `rate_limited`, and `recovery`
        repeats `retry_after`, `plan`, `limit` and `upgrade_url` (`contact_url`
        on the top plans), which also stay at the top level.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            rate_limited:
              summary: Search rate limit reached
              value:
                error: rate_limited
                code: rate_limited
                message: >-
                  Search rate limit reached: your Pay-as-you-go plan allows 5
                  requests per second. Retry after 2 seconds. Upgrade to
                  Ridiculously Cheap for 10 requests per second:
                  https://platform.valyu.ai/user/account/billing?tab=plan
                retry_after: 2
                plan: Pay-as-you-go
                limit:
                  endpoint: search
                  requests_per_second: 5
                upgrade_url: https://platform.valyu.ai/user/account/billing?tab=plan
                recovery:
                  retry_after: 2
                  upgrade_url: https://platform.valyu.ai/user/account/billing?tab=plan
                  plan: Pay-as-you-go
                  limit:
                    endpoint: search
                    requests_per_second: 5
    InternalServerError:
      description: An unexpected error occurred on the server.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            example:
              summary: Internal error
              value:
                success: false
                error: Internal server error. Please try again later.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Get yours at
        [platform.valyu.ai](https://platform.valyu.ai).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.