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



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


    Valyu uses transparent, pay-per-use pricing. Credits are shared across every
    API.

    - **Search**: CPM-based (cost per mille tokens retrieved)

    - **Contents**: $0.001 per URL extracted, +$0.001 with AI features

    - **Answer**: $0.10 per request + variable search and AI costs

    - **DeepResearch**: Fixed per-task pricing by mode ($0.10 - $15.00)


    All plans include web search and open academic sources. A subscription
    unlocks specialised and proprietary sources (SEC filings, patents, drug
    discovery, genomics, and more) at a lower cost per credit. See
    [docs.valyu.ai](https://docs.valyu.ai) for full pricing details.


    ## SDKs


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

    - [TypeScript SDK](https://www.npmjs.com/package/valyu) - `npm install
    valyu`
  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: Standard error response.
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          description: Always `false` for error responses.
          example: false
        error:
          type: string
          description: Human-readable error message describing what went wrong.
          example: Invalid request parameters
  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.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            example:
              summary: Invalid API key
              value:
                success: false
                error: Invalid API key
    Forbidden:
      description: The API key does not have permission for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            example:
              summary: Permission denied
              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).

````