Octivas Docs
API Reference

Search API

Search the web programmatically and get structured results with content extraction.

The Search API allows you to search the web programmatically and get structured results. Each result includes the page content extracted in your preferred format. Control results with geographic targeting, time filters, and per-result scrape options.

Endpoint

POST https://api.octivas.com/api/v1/search

Request Parameters

Core Parameters

ParameterTypeRequiredDefaultDescription
querystringYesSearch query (1–500 characters). Supports operators like "" (exact match), - (exclude), site:, filetype:.
limitintegerNo5Maximum number of results (1–20)
formatsstring[]No["markdown"]Output formats for scraped content (see Output Formats)

Search Control

ParameterTypeRequiredDefaultDescription
locationstringNoGeographic location for geo-targeted results (e.g. "San Francisco,California,United States", "Germany")
countrystringNoISO 3166-1 alpha-2 country code (e.g. "US", "DE", "JP", "BR")
tbsstringNoTime-based search filter: qdr:h (past hour), qdr:d (past day), qdr:w (past week), qdr:m (past month), qdr:y (past year)

Per-Result Scrape Options

ParameterTypeRequiredDefaultDescription
only_main_contentbooleanNoExtract only the primary content of each result page, excluding navigation, sidebars, footers, etc.
timeoutintegerNoRequest timeout in milliseconds (1,000–300,000)

Output Formats

The formats array accepts any combination of:

FormatDescription
markdownPage content converted to Markdown
htmlCleaned HTML content
rawHtmlOriginal unprocessed HTML
screenshotScreenshot of the page (returned as a URL)
linksList of URLs found on the page
jsonStructured data extraction
imagesList of image URLs found on the page
summaryAI-generated summary of the page content

Example Request

curl -X POST https://api.octivas.com/api/v1/search \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "machine learning tutorials",
    "limit": 5,
    "formats": ["markdown"]
  }'
import Octivas from 'octivas';

const client = new Octivas('your_api_key');

const results = await client.search({
  query: 'machine learning tutorials',
  numResults: 5,
  extractContent: true
});

results.results.forEach(result => {
  console.log(result.title);
  console.log(result.url);
  console.log(result.markdown);
});
import octivas

client = octivas.Client("your_api_key")

results = client.search(
    query="machine learning tutorials",
    limit=5
)

for result in results.results:
    print(result.title)
    print(result.url)
    print(result.markdown)

Advanced Example

Use location targeting, time filters, and content options to refine your search:

curl -X POST https://api.octivas.com/api/v1/search \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "best web scraping tools 2025",
    "limit": 10,
    "formats": ["markdown", "links"],
    "country": "US",
    "tbs": "qdr:m",
    "only_main_content": true,
    "timeout": 60000
  }'
const response = await fetch("https://api.octivas.com/api/v1/search", {
  method: "POST",
  headers: {
    "Authorization": "Bearer your_api_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: "best web scraping tools 2025",
    limit: 10,
    formats: ["markdown", "links"],
    country: "US",
    tbs: "qdr:m",
    only_main_content: true,
    timeout: 60000,
  }),
});

const result = await response.json();
console.log(`Found ${result.results_count} results`);
import requests

response = requests.post(
    "https://api.octivas.com/api/v1/search",
    headers={
        "Authorization": "Bearer your_api_key",
        "Content-Type": "application/json",
    },
    json={
        "query": "best web scraping tools 2025",
        "limit": 10,
        "formats": ["markdown", "links"],
        "country": "US",
        "tbs": "qdr:m",
        "only_main_content": True,
        "timeout": 60000,
    },
)

result = response.json()
print(f"Found {result['results_count']} results")

Response

{
  "success": true,
  "query": "machine learning tutorials",
  "results_count": 3,
  "credits_used": 5,
  "results": [
    {
      "url": "https://example.com/ml-guide",
      "title": "Complete Machine Learning Guide",
      "description": "A comprehensive guide to machine learning concepts and tools.",
      "markdown": "# Machine Learning Guide\n\nThis comprehensive guide...",
      "html": "<h1>Machine Learning Guide</h1><p>This comprehensive guide...</p>",
      "links": [
        "https://example.com/ml-basics",
        "https://example.com/ml-advanced"
      ]
    },
    {
      "url": "https://example.com/ml-basics",
      "title": "ML Basics for Beginners",
      "description": "Learn the fundamentals of machine learning.",
      "markdown": "# ML Basics\n\nLearn the fundamentals..."
    }
  ]
}

Response Fields

FieldTypeDescription
successbooleanWhether the request succeeded
querystringThe search query used
results_countintegerNumber of results returned
credits_usedintegerTotal credits consumed
resultsarrayArray of search result objects
results[].urlstringURL of the result page
results[].titlestring | nullPage title
results[].descriptionstring | nullPage meta description or search snippet
results[].markdownstring | nullPage content as Markdown (if requested)
results[].htmlstring | nullPage content as HTML (if requested)
results[].raw_htmlstring | nullOriginal unprocessed HTML (if requested)
results[].screenshotstring | nullScreenshot URL (if requested)
results[].linksstring[] | nullURLs found on the page (if requested)
results[].imagesstring[] | nullImage URLs found on the page (if requested)
results[].summarystring | nullAI-generated page summary (if requested)

On this page