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

# Synthesized answer with citations from the 9-provider fan-out

> Same fan-out as /search/sources, plus an LLM synthesis pass that produces a cited answer. Returns `{ answer, citations, cost }` — the underlying sources are not echoed back; call /search/sources separately if you need the raw evidence pile. When the synthesis model fails (timeout, malformed structured output), the endpoint still returns 200 with `answer: null` and `cost.synthesis_error` set, but no result list. Charges sum of upstream provider costs + LLM token cost + $0.03 lava-search markup.



## OpenAPI

````yaml /openapi.json post /search/answer
openapi: 3.0.0
info:
  title: Lava API
  description: >-
    Lava API enables businesses to implement usage-based billing for AI
    services. This API allows tracking, managing, and billing for third-party AI
    API usage through a forwarding system.
  version: 1.0.0
  contact:
    name: Lava support
    url: https://www.lava.so/contact
servers:
  - url: https://api.lava.so/v1/
    description: Lava API v1
security: []
tags:
  - name: Authentication
  - name: Core Endpoints
  - name: Models
  - name: Services
  - name: Requests
  - name: Wallet
  - name: Payment Methods
  - name: Spend Keys
  - name: Usage
  - name: Checkout Sessions
  - name: Customers
  - name: Plans
  - name: Subscriptions
  - name: Meters
  - name: Webhooks
  - name: Secret Keys
  - name: Credit Bundles
  - name: Gateway Settings
  - name: Skills
  - name: News Data
  - name: Search
  - name: Enrich
paths:
  /search/answer:
    post:
      tags:
        - Search
      summary: Synthesized answer with citations from the 9-provider fan-out
      description: >-
        Same fan-out as /search/sources, plus an LLM synthesis pass that
        produces a cited answer. Returns `{ answer, citations, cost }` — the
        underlying sources are not echoed back; call /search/sources separately
        if you need the raw evidence pile. When the synthesis model fails
        (timeout, malformed structured output), the endpoint still returns 200
        with `answer: null` and `cost.synthesis_error` set, but no result list.
        Charges sum of upstream provider costs + LLM token cost + $0.03
        lava-search markup.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - q
              properties:
                q:
                  type: string
                  description: The query to answer
                providers:
                  type: array
                  items:
                    type: string
                  nullable: true
                  description: >-
                    Optional subset of providers (defaults to all 9). See
                    /search/sources for valid ids.
                max_results_per_source:
                  type: integer
                  minimum: 1
                  maximum: 50
                  nullable: true
                since:
                  type: string
                  format: date-time
                  nullable: true
            examples:
              cryptoQuery:
                value:
                  q: >-
                    Current state of NIST post-quantum standardization 2025-2026
                    — ML-KEM and ML-DSA deployment, FrodoKEM as a hedge,
                    security margin against Module-LWE attacks
      responses:
        '200':
          description: >-
            Synthesized answer with citations. When the LLM step fails, `answer`
            is null and `cost.synthesis_error` is set; the rest of the payload
            is unchanged. Underlying sources are not echoed back — call
            /search/sources separately if needed.
          content:
            application/json:
              schema:
                type: object
                required:
                  - answer
                  - citations
                  - cost
                properties:
                  answer:
                    type: string
                    nullable: true
                    description: >-
                      Markdown answer citing sources via [N]. Null when the
                      synthesis model failed.
                  citations:
                    type: array
                    items:
                      type: object
                      required:
                        - source
                        - url
                        - title
                      properties:
                        source:
                          type: string
                        url:
                          type: string
                        title:
                          type: string
                  cost:
                    type: object
                    required:
                      - breakdown
                      - llm_cost
                      - markup
                      - total
                    properties:
                      breakdown:
                        type: object
                        additionalProperties:
                          type: string
                      llm_cost:
                        type: string
                        description: >-
                          Synthesis-model token cost as a decimal string. "0"
                          when the synthesis call failed.
                      markup:
                        type: string
                      total:
                        type: string
                      synthesis_error:
                        type: string
                        nullable: true
                        description: >-
                          Present when `answer` is null. Identifies the
                          synthesis failure mode (e.g. "xai_500",
                          "invalid_shape").
        '400':
          description: Unknown provider id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: >-
            Every requested provider failed. No synthesis attempted, no markup
            charged.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - Auth: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Human-readable error message describing what went wrong
              example: Invalid authentication credentials
            code:
              type: string
              description: Machine-readable error code describing what went wrong
              example: forward_token_json_invalid
            status:
              type: integer
              description: HTTP status code of the error
              example: 400
            issues:
              type: array
              items:
                type: object
                properties:
                  path:
                    type: array
                    items:
                      type: string
                    description: Path to the field that caused the validation error
                  message:
                    type: string
                    description: Error message describing the validation issue
                required:
                  - path
                  - message
              description: >-
                Optional array of specific validation issues with their paths
                and messages
              example:
                - path:
                    - model
                  message: 'Missing required field: model'
                - path:
                    - messages
                    - '0'
                    - content
                  message: Invalid message content format
          required:
            - message
            - code
            - status
      required:
        - error
  securitySchemes:
    Auth:
      type: http
      scheme: bearer
      description: >-
        Bearer token authentication used for standard API calls. Format: 'Bearer
        YOUR_API_KEY'

````