Overview

The Web Search API provides comprehensive search capabilities across multiple content types:

General & News

Web-wide and news-specific searches with domain filtering

Media Search

Find images and videos from across the web

Specialized Search

Shopping results and academic papers from scholarly sources

Pricing

Simple, transparent pricing
  • Standard searches: 0.001perrequest(0.001 per request (1 per 1,000 requests)
  • Shopping searches: 0.002perrequest(0.002 per request (2 per 1,000 requests)

Authentication

All requests require authentication via Bearer token in the Authorization header:
Authorization: Bearer YOUR_LLMLAYER_API_KEY

Endpoint

POST /api/v1/web_search Search the web with various search types and filtering options.

SDK Support

import { LLMLayerClient } from 'llmlayer';

const client = new LLMLayerClient({
apiKey: 'your-api-key'
});

const response = await client.searchWeb({
query: "your search query",
searchType: "general", // general, news, images, videos, shopping, scholar
location: "us",
recency: "week",
domainFilter: ["example.com", "-excluded.com"]
});

Request Body

query
string
required
The search query. Be specific for better results.
search_type
string
default:"general"
Type of search to perform.
  • general - Standard web search ($0.001)
  • news - Recent news articles ($0.001)
  • images - Image search ($0.001)
  • videos - Video search ($0.001)
  • shopping - Product search ($0.002)
  • scholar - Academic papers ($0.001)
location
string
default:"us"
Geographic location for localized results. Uses two-letter country codes.Examples: us, uk, ca, au, de, fr, jp, in, br
recency
string
Filter results by time period.Options: hour, day, week, month, year
Leave unset for all-time results. Only applies to general and news searches.
domain_filter
array
Include or exclude specific domains from results.
  • Include domains: ["example.com", "trusted-source.org"]
  • Exclude domains with - prefix: ["-spam-site.com"]
  • Mix both: ["trusted.com", "-untrusted.com"]
Only applies to general search type.

Response

results
array
Array of search results. Structure varies by search type.
cost
number
Cost in USD for this request.
  • Standard searches: $0.001
  • Shopping searches: $0.002

Response Fields by Search Type

Returns up to 10 results with the following fields:
title
string
Title of the search result
URL of the result
snippet
string
Brief description or excerpt
date
string
Publication date (when available)
Returns up to 10 news articles with the following fields:
title
string
Article headline
URL to the article
snippet
string
Article excerpt
date
string
Publication date
source
string
News source/publisher
imageUrl
string
Article thumbnail or main image
position
integer
Result position in search results
Returns up to 10 images with the following fields:
title
string
Image title or alt text
imageUrl
string
Direct URL to the full-size image
thumbnailUrl
string
URL to thumbnail version
width
integer
Image width in pixels
height
integer
Image height in pixels
source
string
Source website name
URL of the page containing the image
Returns up to 10 videos with the following fields:
title
string
Video title
URL to the video page
snippet
string
Video description
videoUrl
string
Direct video URL (when available)
duration
string
Video duration (format varies by source)
source
string
Video platform/source
channel
string
Channel or creator name
date
string
Upload or publication date
position
integer
Result position
imageUrl
string
Video thumbnail URL
Returns up to 10 products with the following fields:
title
string
Product name/title
source
string
Merchant or marketplace name
URL to product page
price
string
Product price (includes currency symbol)
imageUrl
string
Product image URL
rating
number
Product rating (typically 0-5 scale)
ratingCount
integer
Number of ratings/reviews
productId
string
Product identifier
position
integer
Result position
Returns up to 10 academic papers with the following fields:
title
string
Paper title
URL to paper or abstract
snippet
string
Abstract or excerpt
publicationInfo
string
Journal, conference, or publication details
year
string
Publication year
citedBy
string
Number of citations
pdfUrl
string
Direct PDF link (when available)

Error Handling

The API returns detailed error information in a consistent format:

Error Response Format

{
  "detail": {
    "error_type": "validation_error",
    "error_code": "invalid_search_type",
    "message": "Search type 'invalid' is not supported. Choose from 'general', 'news', 'shopping', 'videos', 'images', 'scholar'."
  }
}

Common Error Codes

Limitations

  • Returns up to 10 results per search
  • recency filter only works with general and news search types
  • domain_filter only works with general search type
  • Shopping searches cost 2x standard searches due to additional complexity

Next Steps

Need Help? Join our Discord or email support@llmlayer.ai