Skip to main content
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.

LangSearch connects AI applications to information on the web. Send a query and receive structured results with source URLs and search snippets, or full webpage text when requested. Building with a coding agent? Share the self-contained integration guide.

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.

1. Get an API key

Open the Dashboard, choose API keys, and create a key. Replace YOUR_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 in data.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, use text 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:
Create a key in Dashboard → API keys, copy it when the full key is shown, and store it securely. Run requests from a server or trusted local tool; do not expose the key in a browser bundle, public repository, or shared configuration file. To rotate a key, create a replacement, update your application, verify a request, and then delete the old key. All keys on your account share the same allowance. If you receive 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.
Use valid calendar dates with the start on or before the end. Use 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.
Date filtering uses source metadata, not a guarantee that a page was crawled during that window. For query refinement and choosing the right amount of context, read Best Practices.

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