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

# Search

> Structured search results from the web or news. Strips out ads and HTML noise to provide pure data in JSON, Markdown, or HTML. Fully supports AI-grounded answers, search-with-scrape, image search, and targeted Web or News sourcing.



## OpenAPI

````yaml POST /search
openapi: 3.1.0
info:
  title: Geekflare
  description: Official OpenAPI specification for all Geekflare endpoints.
  version: 1.0.0
  license:
    name: MIT
servers:
  - url: https://api.geekflare.com
security:
  - x-api-key: []
paths:
  /search:
    post:
      tags:
        - api-tool
      summary: Search API for AI Agents & LLMs
      description: >-
        Structured search results from the web or news. Strips out ads and HTML
        noise to provide pure data in JSON, Markdown, or HTML. Fully supports
        AI-grounded answers, search-with-scrape, image search, and targeted Web
        or News sourcing.
      operationId: search
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequestDto'
      responses:
        '200':
          description: Search results (format depends on request)
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/SearchResponseDto'
                  - $ref: '#/components/schemas/ImageSearchResponseDto'
                  - $ref: '#/components/schemas/SearchMarkdownResponseDto'
                  - $ref: '#/components/schemas/SearchHtmlResponseDto'
                  - $ref: '#/components/schemas/GroundedAnswerResponseDto'
        '400':
          description: Invalid URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseErrorResponseDto'
              example:
                timestamp: 1700000000000
                apiStatus: failure
                apiCode: 400
                message: INVALID_URL
                details: The URL must be a valid HTTP or HTTPS URL.
        '422':
          description: Unable to connect to the target website.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseErrorResponseDto'
              example:
                timestamp: 1700000000000
                apiStatus: failure
                apiCode: 422
                message: UNABLE_TO_CONNECT
                details: >-
                  The destination server could not be resolved, refused the
                  connection, timed out, or is redirecting indefinitely.
        '500':
          description: Search failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseErrorResponseDto'
              example:
                timestamp: 1700000000000
                apiStatus: failure
                apiCode: 500
                message: SEARCH_FAILED
                details: >-
                  Our search service encountered an error while processing the
                  request.
components:
  schemas:
    SearchRequestDto:
      type: object
      properties:
        query:
          type: string
          description: Search query
          example: best running shoes
          maxLength: 2048
        limit:
          type: number
          description: Number of results
          example: 10
          default: 10
          minimum: 1
          maximum: 100
        time:
          type: string
          description: Time filter (h, d, w, m, y or h2, d7, etc.)
          example: d
          default: any
        location:
          type: string
          description: Country code (ISO alpha-2)
          example: us
          default: us
        source:
          type: string
          description: Search source
          enum:
            - web
            - news
            - images
          example: web
          default: web
        category:
          type: string
          description: Category filter
          enum:
            - general
            - code
            - pdf
            - research
            - linkedin
            - wiki
          example: code
          default: general
        includeDomains:
          description: Include only these domains
          example:
            - reddit.com
            - stackoverflow.com
          type: array
          items:
            type: string
        excludeDomains:
          description: Exclude these domains
          example:
            - pinterest.com
          type: array
          items:
            type: string
        format:
          type: string
          description: Output format
          enum:
            - json
            - markdown
            - html
          default: json
        scrape:
          type: boolean
          description: scrape and extract content from SERP result URLs
          example: false
          default: false
        scrapeLimit:
          type: number
          description: 'Number of URLs to scrape (requires scrape: true)'
          example: 3
          default: 3
          minimum: 1
          maximum: 10
        groundedAnswer:
          type: boolean
          description: Use AI to synthesize a grounded answer from search results.
          example: false
          default: false
      required:
        - query
    SearchResponseDto:
      type: object
      properties:
        timestamp:
          type: number
          description: Timestamp of the request in milliseconds
          example: 1783943217189
        apiStatus:
          type: string
          description: API status message
          example: success
          enum:
            - success
            - failure
        apiCode:
          type: number
          description: API status code
          example: 200
        meta:
          $ref: '#/components/schemas/SearchMetaDto'
        data:
          type: array
          items:
            $ref: '#/components/schemas/SearchResultItemDto'
      required:
        - timestamp
        - apiStatus
        - apiCode
        - meta
        - data
    ImageSearchResponseDto:
      type: object
      properties:
        timestamp:
          type: number
          description: Timestamp of the request in milliseconds
          example: 1783943217189
        apiStatus:
          type: string
          description: API status message
          example: success
          enum:
            - success
            - failure
        apiCode:
          type: number
          description: API status code
          example: 200
        meta:
          $ref: '#/components/schemas/SearchMetaDto'
        data:
          type: array
          items:
            $ref: '#/components/schemas/ImageSearchResultItemDto'
      required:
        - timestamp
        - apiStatus
        - apiCode
        - meta
        - data
    SearchMarkdownResponseDto:
      type: object
      properties:
        timestamp:
          type: number
          description: Timestamp of the request in milliseconds
          example: 1783943217189
        apiStatus:
          type: string
          description: API status message
          example: success
          enum:
            - success
            - failure
        apiCode:
          type: number
          description: API status code
          example: 200
        meta:
          $ref: '#/components/schemas/SearchMetaDto'
        data:
          type: object
          example: |-
            1. [Title](https://example.com)
               - snippet
      required:
        - timestamp
        - apiStatus
        - apiCode
        - meta
        - data
    SearchHtmlResponseDto:
      type: object
      properties:
        timestamp:
          type: number
          description: Timestamp of the request in milliseconds
          example: 1783943217189
        apiStatus:
          type: string
          description: API status message
          example: success
          enum:
            - success
            - failure
        apiCode:
          type: number
          description: API status code
          example: 200
        meta:
          $ref: '#/components/schemas/SearchMetaDto'
        data:
          type: object
          example: <ul><li><a href="...">Title</a></li></ul>
      required:
        - timestamp
        - apiStatus
        - apiCode
        - meta
        - data
    GroundedAnswerResponseDto:
      type: object
      properties:
        timestamp:
          type: number
          description: Timestamp of the request in milliseconds
          example: 1783943217189
        apiStatus:
          type: string
          description: API status message
          example: success
          enum:
            - success
            - failure
        apiCode:
          type: number
          description: API status code
          example: 200
        meta:
          $ref: '#/components/schemas/SearchMetaDto'
        data:
          $ref: '#/components/schemas/GroundedAnswerDataDto'
      required:
        - timestamp
        - apiStatus
        - apiCode
        - meta
        - data
    BaseErrorResponseDto:
      type: object
      properties:
        timestamp:
          type: number
          description: Timestamp of the request in milliseconds
          example: 1778737930991
        apiStatus:
          type: string
          description: API status message
          example: success
          enum:
            - success
            - failure
        apiCode:
          type: number
          description: API status code
          example: 200
        message:
          type: string
          description: Error message
          example: Invalid URL provided
        details:
          type: string
          description: Detailed error information
          example: The URL must be a valid HTTP or HTTPS URL
      required:
        - timestamp
        - apiStatus
        - apiCode
        - message
    SearchMetaDto:
      type: object
      properties:
        query:
          type: string
          description: Original query
          example: best running shoes
        count:
          type: number
          description: Number of results returned
          example: 10
        source:
          description: Search source used
          example: web
          type: array
          items:
            type: string
        location:
          type: string
          description: Country used for ranking
          example: us
        time:
          type: string
          description: Time filter applied
          example: d
        scrape:
          type: boolean
          description: Whether URL scraping was enabled
          example: false
        scrapeLimit:
          type: number
          description: Number of URLs scraped
          example: 3
        test:
          description: Test metadata
          allOf:
            - $ref: '#/components/schemas/TestMetaDto'
      required:
        - query
        - count
        - source
        - location
        - time
        - scrape
        - scrapeLimit
        - test
    SearchResultItemDto:
      type: object
      properties:
        title:
          type: string
          description: Result title
          example: Best Running Shoes of 2025
        url:
          type: string
          description: Canonical URL
          example: https://example.com/running-shoes
        snippet:
          type: string
          description: Clean snippet (ads/HTML removed)
          example: We tested over 100 pairs to find the best running shoes...
        date:
          type: string
          description: Published date (if available)
          example: Dec 18, 2025
        position:
          type: number
          description: Rank position
          example: 1
        content:
          type: object
          description: Scraped cleaned HTML content from the result URL
          example: Full article cleaned for LLM consumption...
        thumbnail:
          type: object
          description: Thumbnail image URL (if available)
          example: https://example.com/thumb.jpg
      required:
        - title
        - url
        - snippet
        - position
    ImageSearchResultItemDto:
      type: object
      properties:
        title:
          type: string
          example: Nike Alphafly 3
        imageUrl:
          type: string
          example: https://example.com/img.jpg
        sourceUrl:
          type: string
          example: https://example.com/page
        width:
          type: number
          example: 1024
        height:
          type: number
          example: 768
      required:
        - title
        - imageUrl
        - sourceUrl
        - width
        - height
    GroundedAnswerDataDto:
      type: object
      properties:
        answer:
          type: string
          description: AI-synthesized answer with inline citations
        sources:
          description: Sources cited in the answer
          type: array
          items:
            $ref: '#/components/schemas/GroundedSourceDto'
      required:
        - answer
        - sources
    TestMetaDto:
      type: object
      properties:
        id:
          type: string
          description: Unique test identifier
          example: mxqx9v9y0742lap6altwdteqd28t23nq
      required:
        - id
    GroundedSourceDto:
      type: object
      properties:
        title:
          type: string
          example: web
        url:
          type: string
          example: https://example.com
        position:
          type: number
          example: 1
      required:
        - title
        - url
        - position
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: API Key required for all endpoints

````