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

# Preview Workflow

> Resolve a Workflow template against your params without running it.

Beta

Resolve a template using the supplied parameters without executing research. The response includes the prompt, research strategy, report format and other resolved configuration.

Use preview to catch missing inputs and check instructions before a paid run. A successful preview validates template resolution, not the factual quality of the report that a future run will produce.


## OpenAPI

````yaml POST /v1/workflows/{slug}/preview
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/workflows/{slug}/preview:
    post:
      tags:
        - Workflows
      summary: Preview a resolved workflow (Beta)
      description: >-
        **Beta.** Resolve a workflow's prompt template against supplied
        `workflow_params` without running it. Returns the resolved prompt,
        research strategy, report format, deliverables, recommended mode, and
        tools - exactly what a run would use. Useful for validating parameters
        before incurring a DeepResearch cost.
      operationId: previewWorkflow
      parameters:
        - name: slug
          in: path
          required: true
          schema:
            type: string
          description: The workflow slug.
          example: ib-company-profile
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowPreviewRequest'
      responses:
        '200':
          description: Resolved configuration.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowPreviewResponse'
        '400':
          $ref: '#/components/responses/WorkflowBadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/WorkflowNotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    WorkflowPreviewRequest:
      type: object
      description: >-
        Resolve a workflow template against supplied parameters without running
        it.
      properties:
        workflow_params:
          type: object
          description: >-
            Values for the workflow's template variables, keyed by variable
            `key`.
          additionalProperties:
            oneOf:
              - type: string
              - type: number
              - type: boolean
          example:
            company: NVIDIA (NVDA)
        workflow_version:
          type: integer
          description: Version to preview. Defaults to the current version.
          minimum: 1
          example: 1
    WorkflowPreviewResponse:
      type: object
      description: The resolved configuration a run with these parameters would use.
      required:
        - workflow
        - resolved
      properties:
        workflow:
          type: object
          description: Which workflow and version were resolved.
          properties:
            slug:
              type: string
              example: ib-company-profile
            version:
              type: integer
              minimum: 1
              example: 1
        resolved:
          type: object
          description: The resolved DeepResearch configuration.
          properties:
            input:
              type: string
              description: The prompt template with all `{key}` placeholders substituted.
              example: >-
                Build a company profile for NVIDIA (NVDA) covering its business,
                financials, and recent developments.
            research_strategy:
              type: string
              nullable: true
              description: Resolved research strategy.
            report_format:
              type: string
              nullable: true
              description: Resolved report format.
            deliverables:
              type: array
              items:
                $ref: '#/components/schemas/WorkflowDeliverable'
            mode:
              $ref: '#/components/schemas/WorkflowMode'
            tools:
              $ref: '#/components/schemas/WorkflowTools'
            output_formats:
              $ref: '#/components/schemas/WorkflowOutputFormats'
        estimated_credits:
          type: number
          nullable: true
          description: Estimated credit cost of a run, when available.
          example: null
    WorkflowDeliverable:
      type: object
      description: A deliverable file the workflow produces.
      required:
        - type
        - description
      properties:
        type:
          type: string
          description: File format for the deliverable.
          enum:
            - csv
            - xlsx
            - pptx
            - docx
            - pdf
          example: xlsx
        description:
          type: string
          description: What the deliverable should contain.
          example: A model summary tab with revenue, margins, and key ratios.
    WorkflowMode:
      type: string
      description: >-
        Recommended DeepResearch mode for a workflow. Maps directly to the
        DeepResearch `mode` parameter.
      enum:
        - fast
        - standard
        - heavy
        - max
      example: heavy
    WorkflowTools:
      type: object
      description: Optional tools the workflow's research agent may use.
      properties:
        code_execution:
          type: boolean
          description: Enable code execution in a sandboxed environment.
        screenshots:
          type: boolean
          description: Enable visual screenshot capture of web pages.
        browser_use:
          type: boolean
          description: Enable autonomous browser sessions.
        charts:
          type: boolean
          description: Enable chart and graph generation in the report.
    WorkflowOutputFormats:
      type: array
      description: >-
        Output formats the workflow produces. Items are the strings
        `"markdown"`, `"pdf"`, or `"toon"`, and/or a single JSON Schema object
        for structured output. Rules: at most one JSON Schema object; a JSON
        Schema object cannot be combined with `"markdown"` or `"pdf"`; `"toon"`
        requires a JSON Schema object. An invalid combination returns `400
        invalid_output_formats`.


        At run time, a task created with `workflow_id` inherits the workflow's
        `output_formats` when the request does not pass its own; a request-level
        `output_formats` always wins.
      items:
        oneOf:
          - type: string
            enum:
              - markdown
              - pdf
              - toon
          - type: object
            description: JSON Schema for structured output.
      example:
        - type: object
          properties:
            base_case:
              type: string
            bull_case:
              type: string
            bear_case:
              type: string
            confidence:
              type: number
        - toon
    WorkflowError:
      type: object
      description: >-
        Workflow error response. `error` is a machine-readable code; `message`
        is human-readable text.
      required:
        - error
      properties:
        error:
          type: string
          description: Machine-readable error code.
          example: invalid_output_formats
        message:
          type: string
          description: Human-readable explanation.
          example: >-
            output_formats may contain at most one JSON schema, which cannot be
            combined with markdown or pdf.
    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.
  responses:
    WorkflowBadRequest:
      description: >-
        The workflow request was invalid. The `error` field carries a
        machine-readable code and `message` a human-readable explanation.


        Common codes:

        - `changelog_required` - a changelog is required when publishing a new
        version

        - `unreferenced_template_vars` - a declared variable is not used in the
        prompt template, or the template references an unknown variable

        - `invalid_output_formats` - `output_formats` contained more than one
        JSON schema, mixed a schema with `markdown`/`pdf`, or used `toon`
        without a schema

        - `field_too_long` - a text field exceeds its limit (64 KB)

        - `too_many_variables` - more than 50 variables

        - `too_many_deliverables` - more than 20 deliverables

        - `workflow_and_freeform_mutually_exclusive` - workflow and freeform
        fields were both supplied (on the DeepResearch create endpoint)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/WorkflowError'
          examples:
            changelog_required:
              summary: Changelog required
              value:
                error: changelog_required
                message: A changelog is required when publishing a new version.
            unreferenced_template_vars:
              summary: Unreferenced template variable
              value:
                error: unreferenced_template_vars
                message: >-
                  A declared variable is not used in the prompt template, or the
                  template references an unknown variable.
            invalid_output_formats:
              summary: Invalid output_formats
              value:
                error: invalid_output_formats
                message: >-
                  output_formats may contain at most one JSON schema, which
                  cannot be combined with markdown or pdf; toon requires a
                  schema.
    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
    WorkflowNotFound:
      description: The workflow or version was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/WorkflowError'
          examples:
            workflow_not_found:
              summary: Workflow not found
              value:
                error: workflow_not_found
                message: No workflow matches that slug.
    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.