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

# Search

Search for information with various retrieval strategies.

<ParamFields />

## Example Request

```bash theme={null}
curl -X POST https://api.agentserp.com/search \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"query": "openai"}'
```


## OpenAPI

````yaml POST /search
openapi: 3.0.0
info:
  title: AgentSerp API
  version: 1.0.0
  description: API for search, extraction, summarization, and more.
servers:
  - url: https://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app
    description: AgentSerp API
security: []
paths:
  /search:
    post:
      summary: Search across the web
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                  description: Natural-language search query
                mode:
                  type: string
                  enum:
                    - auto
                    - keyword
                    - neural
                  default: auto
                  description: >-
                    Retrieval strategy: let backend choose, force keyword, or
                    force embedding
                depth:
                  type: string
                  enum:
                    - basic
                    - advanced
                  default: basic
                  description: Depth/quality tier; advanced costs more & may run longer
                topic:
                  type: string
                  enum:
                    - general
                    - news
                  default: general
                  description: Domain-specific retrieval agent
                max_results:
                  type: integer
                  minimum: 1
                  maximum: 50
                  default: 10
                  description: Maximum number of results to return
                add_answer:
                  anyOf:
                    - type: boolean
                      enum:
                        - false
                    - type: string
                      enum:
                        - basic
                    - type: string
                      enum:
                        - detailed
                  default: false
                  description: >-
                    `false` → no answer. `basic` → one-sentence LLM answer.
                    `detailed` → richer
                include_raw_content:
                  type: boolean
                  default: false
                  description: If true, include cleaned HTML text in each result
                include_images:
                  type: boolean
                  default: false
                  description: If true, also run an image search
                recency:
                  anyOf:
                    - type: string
                      enum:
                        - day
                        - week
                        - month
                        - year
                      description: Human shortcut for common recency windows
                    - type: integer
                      minimum: 0
                      exclusiveMinimum: true
                  description: Limit results to this many days in the past or a preset
                filters:
                  type: object
                  properties:
                    include_domains:
                      type: array
                      items:
                        type: string
                      description: Restrict results to these hostnames
                    exclude_domains:
                      type: array
                      items:
                        type: string
                      description: Omit any result whose hostname matches
                    include_text:
                      type: array
                      items:
                        type: string
                      description: Require these tokens appear in document body
                    exclude_text:
                      type: array
                      items:
                        type: string
                      description: Reject docs containing these tokens
                  description: Fine-grained filtering for /search
                view:
                  type: array
                  items:
                    type: string
                    enum:
                      - results
                      - answer
                      - images
                      - embeddings
                    description: Selective blocks to include in response
                  default:
                    - results
                  description: Which data blocks to include in the response
                similar_to:
                  type: string
                  format: uri
                  description: Return docs similar to this URL instead of keyword search
                stream:
                  type: boolean
                  description: If true, respond with NDJSON streaming
                response_format:
                  type: string
                  enum:
                    - json
                    - ndjson
                    - csv
                    - parquet
                  description: Serialization format for large/bulk results
                user_context:
                  type: object
                  additionalProperties:
                    nullable: true
                  description: Opaque object echoed for personalization
              required:
                - query
              description: Input contract for POST /search
      responses:
        '200':
          description: Search results
          content:
            application/json:
              schema:
                type: object
                properties:
                  request_id:
                    type: string
                    description: Echo of client-supplied ID or server-assigned UUID
                  data:
                    type: object
                    properties:
                      answer:
                        type: string
                        description: LLM answer if requested
                      results:
                        type: array
                        items:
                          type: object
                          properties:
                            title:
                              type: string
                              description: Human-readable title of the document
                            url:
                              type: string
                              description: Canonical URL of the document
                            content:
                              type: string
                              description: Snippet or full text, depending on request
                            score:
                              type: number
                              minimum: 0
                              maximum: 1
                              description: Relevance score (0-1) where 1 is most relevant
                            meta:
                              type: object
                              additionalProperties:
                                nullable: true
                              description: >-
                                Backend-specific key-value pairs (author,
                                publishedDate, etc.)
                          required:
                            - title
                            - url
                          description: Generic doc object used across endpoints
                        description: Ordered list of search hits
                      images:
                        type: array
                        items:
                          type: object
                          properties:
                            url:
                              type: string
                              format: uri
                            alt:
                              type: string
                          required:
                            - url
                          description: Image URL plus alt text
                      embeddings:
                        type: array
                        items:
                          type: array
                          items:
                            type: number
                        description: Vector embeddings in the same order as `results`
                    description: Endpoint-specific payload
                  meta:
                    type: object
                    properties:
                      api_version:
                        type: string
                        description: >-
                          Semantic version string of the API that produced the
                          response
                      processing_ms:
                        type: integer
                        description: Time taken on the server to satisfy the request, in ms
                      tokens_used:
                        type: integer
                        description: Total LLM tokens consumed (prompt+completion)
                      cost:
                        type: object
                        properties:
                          total:
                            type: number
                            minimum: 0
                            description: Total dollar cost for serving this request
                          breakdown:
                            type: object
                            additionalProperties:
                              type: number
                              minimum: 0
                            description: >-
                              Optional map of operation → incremental cost (e.g.
                              neuralSearch: 0.004)
                        required:
                          - total
                        description: Per-request cost information
                    required:
                      - api_version
                    description: Metadata block attached to every response
                required:
                  - data
                description: Universal response wrapper
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error

````