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

# Run a search



## OpenAPI

````yaml /api-reference/search.json post /api/search/query
openapi: 3.1.0
info:
  title: truscan search
  version: 1.0.0
  description: >-
    A web search API. One query is fanned out across many independent sources,
    then deduplicated, extracted, ranked, and returned with a score it will
    explain. Every response uses the {success, result, message} envelope except
    where noted.
servers:
  - url: https://api.truscan.co
    description: Production
security: []
paths:
  /api/search/query:
    post:
      summary: Run a search
      operationId: search
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
      responses:
        '200':
          description: Ranked results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchEnvelope'
        '400':
          $ref: '#/components/responses/Failure'
        '422':
          $ref: '#/components/responses/Failure'
        '429':
          $ref: '#/components/responses/Failure'
        '502':
          $ref: '#/components/responses/Failure'
components:
  schemas:
    SearchRequest:
      type: object
      required:
        - query
      properties:
        query:
          type: string
          maxLength: 512
        q:
          type: string
          description: Accepted as an alias for query.
        tier:
          type: string
          enum:
            - instant
            - fast
            - auto
            - deep
            - deep_reasoning
          default: instant
          description: >-
            Search depth. instant/fast/auto share one recall budget; deep
            doubles it; deep_reasoning widens it further and extracts nearly
            everything it recalls.
        limit:
          type: integer
          minimum: 1
          maximum: 50
          default: 10
        enrich:
          type: boolean
          default: true
          description: >-
            Fetch and extract page bodies for the top results. Off is roughly
            ten times faster and returns engine snippets only.
        format:
          type: string
          enum:
            - json
            - markdown
            - text
          default: json
        site:
          type: string
          description: Restrict to one host.
        lang:
          type: string
        freshness:
          type: string
          enum:
            - any
            - day
            - week
            - month
            - year
        category:
          type: string
          enum:
            - general
            - news
            - science
            - images
            - videos
            - it
          default: general
    SearchEnvelope:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
        result:
          $ref: '#/components/schemas/SearchResponse'
    SearchResponse:
      type: object
      properties:
        id:
          type: string
        query:
          type: string
        tier:
          type: string
          enum:
            - instant
            - deep
            - deep_reasoning
          description: >-
            The tier this search actually ran at, which is what billing charges
            for.
        total:
          type: integer
        format:
          type: string
          enum:
            - json
            - markdown
            - text
        rendered:
          type: string
          description: The markdown or text view. Empty for format=json.
        results:
          type: array
          items:
            $ref: '#/components/schemas/Result'
        stats:
          $ref: '#/components/schemas/Stats'
    Failure:
      type: object
      properties:
        success:
          type: boolean
          const: false
        message:
          type: string
          description: Written for a person.
        result:
          type: object
          properties:
            code:
              type: string
    Result:
      type: object
      properties:
        rank:
          type: integer
        url:
          type: string
          format: uri
        title:
          type: string
        snippet:
          type: string
        domain:
          type: string
        score:
          type: number
        components:
          $ref: '#/components/schemas/Components'
        published_at:
          type: string
          format: date-time
        content:
          $ref: '#/components/schemas/Content'
    Stats:
      type: object
      properties:
        took_ms:
          type: integer
        recall_ms:
          type: integer
        enrich_ms:
          type: integer
        candidates:
          type: integer
        deduped:
          type: integer
        enriched:
          type: integer
        cached:
          type: boolean
    Components:
      type: object
      description: >-
        The score, itemised, so a caller can tune against real output instead of
        guessing.
      properties:
        consensus:
          type: number
          description: Independent engine agreement.
        position:
          type: number
          description: The upstream sources' own ranking.
        lexical:
          type: number
          description: BM25 over title, snippet and body.
        proximity:
          type: number
          description: How close the query terms sit to each other.
        authority:
          type: number
          description: An offline host-quality prior.
        freshness:
          type: number
          description: Age decay. Zero unless the query asked for recency.
    Content:
      type: object
      properties:
        text:
          type: string
          description: Readable prose with navigation, banners and footers removed.
        markdown:
          type: string
          description: The same content with headings, lists and links preserved.
        excerpt:
          type: string
        words:
          type: integer
        lang:
          type: string
        author:
          type: string
        site_name:
          type: string
        truncated:
          type: boolean
        error:
          type: string
          description: >-
            Why this page has no content. Present instead of an empty text
            field, which would be indistinguishable from a genuinely empty page.
        highlights:
          type: array
          items:
            $ref: '#/components/schemas/Highlight'
    Highlight:
      type: object
      description: >-
        A passage that matched, with its offsets into content.text, so a UI can
        render it without re-running the match.
      properties:
        text:
          type: string
        start:
          type: integer
        end:
          type: integer
        score:
          type: number
  responses:
    Failure:
      description: >-
        The envelope with success false. result carries the machine-readable
        code and nothing else; the HTTP status line carries the real status.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Failure'

````