FREE WEB SEARCH API
The World Engine
for AGI.
Bring the world’s information into your AI workflows. Search the web, retrieve useful context, and keep the sources.
What you can build
Grounded answers
Give your model search context and source URLs to support its answers.
Research workflows
Gather evidence across sources and refine the next search as you learn.
Coding agents
Find relevant documentation and technical explanations for a development task.
Make your first search
1. Get an API key
Open the Dashboard, choose API keys, and create a key. ReplaceYOUR_LANGSEARCH_API_KEY below with your key. Run the request from a server or trusted local environment.
2. Send a request
Choose cURL, Python, or JavaScript. These examples use standard HTTP clients; no LangSearch-specific SDK is required.3. Read the sources
Results are indata.webPages.value. Each item represents a source:
The examples above enable
contents.text, so read text for each source. Omit this option or set it to false to use snippet instead. Your model can use source text to compose an answer with citations. Text and date fields may be missing; an empty result array is also a valid response.
Result metadata and missing fields
Preserve result order unless your application has a reason to reorder it. For context, usetext in text mode or snippet in snippet mode, and keep the source URL even if text is missing. Broaden the query or freshness window when the evidence is insufficient.
Authentication and API keys
Every request uses the same authentication header:401, check the Bearer prefix, accidental whitespace, an unchanged placeholder, or a deleted key. MCP uses the same Bearer authentication with its client-specific configuration.
Choose what to retrieve
count defaults to 10 and has a maximum of 50. contents.text: true requests full webpage text with a 5000-character limit per result. An object also enables text: contents: { "text": { "max_characters": 3000 } }. The limit must be a positive integer, and you do not need a separate true flag. The limit is an upper bound; available text may be shorter.
Filter by date and domain
freshness accepts noLimit (default), oneDay, oneWeek, oneMonth, and oneYear, plus:
- A specific UTC date:
2026-09-12. - An inclusive UTC date range:
2026-09-01..2026-09-13.
includeDomains to restrict sources and excludeDomains to leave sources out. Domain entries are strings such as langsearch.com or openai.com; omit the arrays or leave them empty to apply no domain filter.
Connect your tools
MCP
Connect Codex, Claude Code, Cursor, VS Code, and other clients to the official hosted server.
Agent Skill
Give your agent the official installation instructions.
Next steps
- Web Search API reference: request fields and interactive playground.
- Plan & usage: account allowance and automatic resets.
- Errors & troubleshooting: diagnose failures and decide when to retry.

