API Endpoints

AnySearch provides three APIs for search, capability discovery and public URL content extraction. Use /v1/search for general or vertical queries, and /v1/sub-domains to discover vertical capabilities and parameters when needed. With a public webpage URL, optionally call /v1/extract directly to retrieve its content.

How the APIs work together

WHEN NEEDED · DISCOVER

Discover capabilities

For vertical search, read available tags and parameters first. General search can start with a query.

GET /v1/sub-domains

SEARCH

Run a search

Submit query, with a tag and capability parameters when needed.

POST /v1/search

RESULTS

Use the results

Read returned titles, URLs, snippets and available content.

Response fields

WHEN NEEDED · EXTRACT

Extract content

Call directly with a public webpage URL, or optionally extract content from a search result URL for summarization or analysis.

POST /v1/extract

Choose an API

TaskAPIQuota and next step
General or vertical searchPOST /v1/searchUses search quota; extract content afterward if needed.
Discover tags and parametersGET /v1/sub-domainsDoes not consume free or paid search quota; use the definitions in Search.
Read public webpage contentPOST /v1/extractSubject to quota; consult the applicable billing rules.

Request examples

General search only needs query. The examples below show the same request in five languages. See the Search page for vertical search examples.

cURL · macOS / Linux / Git Bash

curl -X POST https://api.anysearch.com/v1/search \
  -H "Authorization: Bearer YOUR_ANYSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "Global AI Semiconductor Industry Analysis",
  "max_results": 5
}'

Python 3 · requests

import os
import requests

response = requests.post(
    "https://api.anysearch.com/v1/search",
    headers={
        "Authorization": f"Bearer {os.environ['ANYSEARCH_API_KEY']}",
    },
    json={
        "query": "Global AI Semiconductor Industry Analysis",
        "max_results": 5,
    },
    timeout=30,
)

if not response.ok:
    request_id = response.headers.get("X-Request-ID", "unknown")
    raise RuntimeError(
        f"Request failed: HTTP {response.status_code}; request_id={request_id}"
    )

result = response.json()
print(result["data"])

JavaScript · Node.js 18+

const response = await fetch("https://api.anysearch.com/v1/search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ANYSEARCH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: "Global AI Semiconductor Industry Analysis",
    max_results: 5,
  }),
  signal: AbortSignal.timeout(30_000),
});

if (!response.ok) {
  const requestId = response.headers.get("X-Request-ID") ?? "unknown";
  throw new Error(
    `Request failed: HTTP ${response.status}; request_id=${requestId}`
  );
}

const result = await response.json();
console.log(result.data);

Go · Standard library

package main

import (
	"encoding/json"
	"fmt"
	"net/http"
	"os"
	"strings"
	"time"
)

func main() {
	req, err := http.NewRequest(
		http.MethodPost,
		"https://api.anysearch.com/v1/search",
		strings.NewReader(`{
			"query": "Global AI Semiconductor Industry Analysis",
			"max_results": 5
		}`),
	)
	if err != nil {
		panic(err)
	}

	req.Header.Set("Authorization", "Bearer "+os.Getenv("ANYSEARCH_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{Timeout: 30 * time.Second}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		requestID := resp.Header.Get("X-Request-ID")
		if requestID == "" {
			requestID = "unknown"
		}

		panic(fmt.Sprintf(
			"Request failed: HTTP %d; request_id=%s",
			resp.StatusCode, requestID,
		))
	}

	var result struct {
		Data json.RawMessage `json:"data"`
	}
	if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
		panic(err)
	}

	fmt.Println(string(result.Data))
}

Rust · reqwest + serde_json

use reqwest::blocking::Client;
use serde_json::{json, Value};
use std::{env, error::Error, time::Duration};

fn main() -> Result<(), Box<dyn Error>> {
    let api_key = env::var("ANYSEARCH_API_KEY")?;

    let client = Client::builder()
        .timeout(Duration::from_secs(30))
        .build()?;

    let response = client
        .post("https://api.anysearch.com/v1/search")
        .bearer_auth(api_key)
        .json(&json!({
            "query": "Global AI Semiconductor Industry Analysis",
            "max_results": 5,
        }))
        .send()?;

    if !response.status().is_success() {
        let request_id = response
            .headers()
            .get("X-Request-ID")
            .and_then(|value| value.to_str().ok())
            .unwrap_or("unknown");

        return Err(format!(
            "Request failed: HTTP {}; request_id={request_id}",
            response.status()
        )
        .into());
    }

    let result: Value = response.json()?;
    println!("{}", result["data"]);

    Ok(())
}

Base URL https://api.anysearch.com Content type Use Content-Type: application/json for POST requests.

Browse domains and capabilities

Find the right capability for your task, then read its parameter definitions before running a vertical search.

Browse the complete capability directory

Common response envelope

The server generates a UUID v4 request_id for each response and returns the same value in the X-Request-ID response header. A caller-supplied request ID is ignored.

FieldSuccessError
code0-1
message"success"Error description; HTTP 402 may include credentials.
request_idServer-generated UUID v4Use for diagnostics.
dataEndpoint-specific dataInspect the actual response.
error_codeUsually omittedOptional stable error identifier.

Success envelope · data depends on the endpoint

{
  "code": 0,
  "message": "success",
  "request_id": "7d6f4e91-2a83-4c5b-9f10-6e8a3d27b541",
  "data": {}
}

Error codes: Search, Sub-domains, Extract.

FAQ

Must I discover capabilities before a general search?

No. A general search only needs query. Discover definitions when you need a specific vertical capability.

Does format=markdown return a plain Markdown response?

No. The outer Search response remains JSON. The content field uses Markdown.

Does capability discovery consume search quota?

No. It does not consume free or paid search quota or count as search usage. Requests may still be rate limited.

What content can Extract read?

Public HTTP(S) pages containing HTML/XHTML, plain text, JSON or Markdown. PDF, images, audio and video are unsupported.

Documentation navigation