Skip to content
Go To Dashboard

Search the Web

Give your agents real-time information from the web — raw search results, AI-generated answers with citations, or structured data extraction.

import { withSapiom } from "@sapiom/axios";
import axios from "axios";
const client = withSapiom(axios.create(), {
apiKey: process.env.SAPIOM_API_KEY,
});
// Search with AI-generated answer
const { data } = await client.post(
"https://linkup.services.sapiom.ai/v1/search",
{
query: "What are the latest developments in quantum computing?",
depth: "standard",
outputType: "sourcedAnswer",
}
);
console.log(data.answer);
console.log("Sources:", data.sources);

Sapiom provides access to two web search providers: Linkup and You.com. Both support AI-powered search with different strengths:

  • Linkup excels at structured data extraction and sourced answers
  • You.com excels at live crawling and freshness filters

Choose the provider that fits your use case. Both use the same SDK pattern — just point to the different endpoint.

ProviderBest ForPricing
LinkupStructured extraction, sourced answers$0.01 - $0.08/search
You.comLive crawling, freshness filters$0.006 - $0.01/search

Linkup provides three output modes:

  • Search Results — Raw search results with titles, URLs, and snippets
  • Sourced Answer — AI-generated answer with source citations
  • Structured — Extract data into a custom JSON schema
MethodPathDescription
POST/v1/searchWeb search
POST/v1/search/priceGet price estimate (free)
POST/v1/fetchFetch URL as markdown
POST/v1/fetch/priceGet fetch price estimate (free)

Base URL: https://linkup.services.sapiom.ai

const { data } = await client.post(
"https://linkup.services.sapiom.ai/v1/search",
{
query: "TypeScript best practices 2024",
depth: "standard",
outputType: "searchResults",
}
);
for (const result of data.results) {
console.log(`${result.title} - ${result.url}`);
}

Fetch and convert a web page to clean markdown:

const { data } = await client.post(
"https://linkup.services.sapiom.ai/v1/fetch",
{
url: "https://example.com/article",
renderJs: false,
}
);
console.log(data.markdown);
ParameterTypeRequiredDescription
querystringYesSearch query
depthstringYesstandard or deep
outputTypestringNosearchResults, sourcedAnswer, or structured
maxResultsnumberNoMaximum results (1-100)
includeImagesbooleanNoInclude images in results
includeDomainsstring[]NoOnly include these domains
excludeDomainsstring[]NoExclude these domains
fromDatedateNoResults from this date
toDatedateNoResults until this date
structuredOutputSchemaobjectRequired for structuredJSON schema for output
includeSourcesbooleanNoInclude sources with structured output
Output TypePrice
searchResults$0.01
sourcedAnswer$0.08
structured$0.08
Fetch OperationPrice
Standard fetch$0.01
With JS rendering$0.02

You.com provides fast web search with optional live crawling to fetch full page content from search results.

MethodPathDescription
POST/v1/searchWeb search
POST/v1/search/priceGet price estimate (free)
POST/v1/contentsFetch URL contents
POST/v1/contents/priceGet contents price estimate (free)

Base URL: https://you-com.services.sapiom.ai

const { data } = await client.get(
"https://you-com.services.sapiom.ai/v1/search",
{
params: {
query: "Best practices for building AI agents",
count: 10,
},
}
);
for (const result of data.results.web) {
console.log(`${result.title} - ${result.url}`);
}

Fetch content from specific URLs:

const { data } = await client.post(
"https://you-com.services.sapiom.ai/v1/contents",
{
urls: [
"https://example.com/article1",
"https://example.com/article2",
],
format: "markdown",
}
);
for (const content of data.contents) {
console.log(content.markdown);
}

Search:

ParameterTypeRequiredDescription
querystringYesSearch query
countnumberNoResults count (1-100, default: 10)
freshnessstringNoday, week, month, or year
countrystringNoISO 3166-2 country code
languagestringNoBCP 47 language code
offsetnumberNoResult offset for pagination (0-9)
safesearchstringNooff, moderate, or strict
livecrawlstringNoweb, news, or all
livecrawlFormatstringNohtml or markdown

Contents:

ParameterTypeRequiredDescription
urlsstring[]YesURLs to fetch (1-10)
formatstringNohtml or markdown (default: markdown)
Result CountPrice
1-50 (Standard)$0.006
51-100 (Extended)$0.008
ContentsPrice
Per URL$0.01

CodeDescription
400Invalid request parameters
402Payment required — ensure you’re using the Sapiom SDK
429Rate limit exceeded