Skip to main content
Endpoint: GET /customsearch/v1 Perform a Google Custom Search using the cx you provide. If omitted, the request uses YouRouter’s default search engine. This endpoint is useful when you need fresh web results, documentation lookup, or a programmable search engine for your own sites.
Search requests are covered by Zero Completion Insurance. Failed or empty search results are not billed as successful completions.
import os
import requests
import json

response = requests.get(
    "https://api.yourouter.ai/customsearch/v1",
    headers={"Authorization": f"Bearer {os.environ['YOUROUTER_API_KEY']}"},
    params={
        "q": "how to set up billing",
        "cx": "YOUR_CUSTOM_SEARCH_ENGINE_ID",
        "num": 3
    }
)
print(json.dumps(response.json(), indent=2))

Parameters

ParameterTypeDescriptionRequired
qstringThe search query.Yes
cxstringCustom Search Engine ID. Uses YouRouter’s default if omitted.No
numintegerNumber of search results to return (1-10).No
startintegerThe index of the first result to return.No
siteSearchstringSpecifies a site to search.No

Response Format

A successful response contains an items array of search result objects.
{
  "kind": "customsearch#search",
  "items": [
    {
      "kind": "customsearch#result",
      "title": "Billing Information - Example Docs",
      "link": "https://docs.example-app.ai/billing"
    }
  ]
}

Typical Use Cases

Create a Google Programmable Search Engine that indexes only your documentation domains, then pass the top results into a model to answer product questions with fresher grounding.
Use search results to fetch recent articles, pages, or announcements before asking a model to summarize or reason over them.