# Search GET https://ydc-index.io/v1/search This endpoint is designed to return LLM-ready web results based on a user's query. Based on a classification mechanism, it can return web results and news associated with your query. If you need to feed an LLM with the results of a query that sounds like `What are the latest geopolitical updates from India`, then this endpoint is the right one for you. Reference: https://docs.you.com/api-reference/search/v1-search ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Returns a list of unified search results from web and news sources version: endpoint_.returnsAListOfUnifiedSearchResultsFromWebAndNewsSources paths: /v1/search: get: operationId: returns-a-list-of-unified-search-results-from-web-and-news-sources summary: Returns a list of unified search results from web and news sources description: >- This endpoint is designed to return LLM-ready web results based on a user's query. Based on a classification mechanism, it can return web results and news associated with your query. If you need to feed an LLM with the results of a query that sounds like `What are the latest geopolitical updates from India`, then this endpoint is the right one for you. tags: - [] parameters: - name: query in: query description: >- The search query used to retrieve relevant results from the web. You can also include [search operators](/search/search-operators) to refine your search. required: true schema: type: string - name: count in: query description: >- Specifies the maximum number of search results to return per section (the sections are `web` and `news`. See the JSON response to visualize them). required: false schema: type: integer default: 10 - name: freshness in: query description: >- Specifies the freshness of the results to return. Provide either one of `day`, `week`, `month`, `year`, or a date range string in the format `YYYY-MM-DDtoYYYY-MM-DD`. When your search query includes a temporal keyword and you also set a freshness parameter, the search will use the broader (i.e., less restrictive) of the two timeframes. For example, if you use `query=news+this+week&freshness=month`, the results will use a freshness of month. required: false schema: type: string - name: offset in: query description: >- Indicates the `offset` for pagination. The `offset` is calculated in multiples of `count`. For example, if `count = 5` and `offset = 1`, results 5–10 will be returned. Range `0 ≤ offset ≤ 9`. required: false schema: type: integer - name: country in: query description: >- The country code that determines the geographical focus of the web results. required: false schema: $ref: '#/components/schemas/V1SearchGetParametersCountry' - name: language in: query description: >- The language of the web results that will be returned (BCP 47 format). required: false schema: $ref: '#/components/schemas/V1SearchGetParametersLanguage' - name: safesearch in: query description: >- Configures the safesearch filter for content moderation. This allows you to decide whether to return NSFW content or not. required: false schema: $ref: '#/components/schemas/V1SearchGetParametersSafesearch' - name: livecrawl in: query description: >- Indicates which section(s) of search results to livecrawl and return full page content. required: false schema: $ref: '#/components/schemas/V1SearchGetParametersLivecrawl' - name: livecrawl_formats in: query description: Indicates the format of the livecrawled content. required: false schema: $ref: '#/components/schemas/V1SearchGetParametersLivecrawlFormats' - name: X-API-Key in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: >- A JSON object containing unified search results from web and news sources content: application/json: schema: $ref: >- #/components/schemas/returnsAListOfUnifiedSearchResultsFromWebAndNewsSources_Response_200 '401': description: Unauthorized. Problems with API key. content: {} '403': description: Forbidden. API key lacks scope for this path. content: {} '500': description: >- Internal Server Error during authentication/authorization middleware. content: {} components: schemas: V1SearchGetParametersCountry: type: string enum: - value: AR - value: AU - value: AT - value: BE - value: BR - value: CA - value: CL - value: DK - value: FI - value: FR - value: DE - value: HK - value: IN - value: ID - value: IT - value: JP - value: KR - value: MY - value: MX - value: NL - value: NZ - value: 'NO' - value: CN - value: PL - value: PT - value: PH - value: RU - value: SA - value: ZA - value: ES - value: SE - value: CH - value: TW - value: TR - value: GB - value: US V1SearchGetParametersLanguage: type: string enum: - value: AR - value: EU - value: BN - value: BG - value: CA - value: ZH-HANS - value: ZH-HANT - value: HR - value: CS - value: DA - value: NL - value: EN - value: EN-GB - value: ET - value: FI - value: FR - value: GL - value: DE - value: EL - value: GU - value: HE - value: HI - value: HU - value: IS - value: IT - value: JP - value: KN - value: KO - value: LV - value: LT - value: MS - value: ML - value: MR - value: NB - value: PL - value: PT-BR - value: PT-PT - value: PA - value: RO - value: RU - value: SR - value: SK - value: SL - value: ES - value: SV - value: TA - value: TE - value: TH - value: TR - value: UK - value: VI default: EN V1SearchGetParametersSafesearch: type: string enum: - value: 'off' - value: moderate - value: strict V1SearchGetParametersLivecrawl: type: string enum: - value: web - value: news - value: all V1SearchGetParametersLivecrawlFormats: type: string enum: - value: html - value: markdown V1SearchGetResponsesContentApplicationJsonSchemaResultsWebItemsContents: type: object properties: html: type: string description: The HTML content of the page. markdown: type: string description: The Markdown content of the page. V1SearchGetResponsesContentApplicationJsonSchemaResultsWebItems: type: object properties: url: type: string description: The URL of the specific search result. title: type: string description: The title or name of the search result. description: type: string description: A brief description of the content of the search result. snippets: type: array items: type: string description: >- An array of text snippets from the search result, providing a preview of the content. thumbnail_url: type: string description: URL of the thumbnail. page_age: type: string format: date-time description: The age of the search result. contents: $ref: >- #/components/schemas/V1SearchGetResponsesContentApplicationJsonSchemaResultsWebItemsContents description: Contents of the page if livecrawl was enabled. authors: type: array items: type: string description: An array of authors of the search result. favicon_url: type: string description: The URL of the favicon of the search result's domain. V1SearchGetResponsesContentApplicationJsonSchemaResultsNewsItems: type: object properties: title: type: string description: The title of the news result. description: type: string description: A brief description of the content of the news result. page_age: type: string format: date-time description: UTC timestamp of the article's publication date. thumbnail_url: type: string description: URL of the thumbnail. url: type: string description: The URL of the news result. V1SearchGetResponsesContentApplicationJsonSchemaResults: type: object properties: web: type: array items: $ref: >- #/components/schemas/V1SearchGetResponsesContentApplicationJsonSchemaResultsWebItems news: type: array items: $ref: >- #/components/schemas/V1SearchGetResponsesContentApplicationJsonSchemaResultsNewsItems V1SearchGetResponsesContentApplicationJsonSchemaMetadata: type: object properties: search_uuid: type: string format: uuid query: type: string description: Returns the search query used to retrieve the results. latency: type: number format: double returnsAListOfUnifiedSearchResultsFromWebAndNewsSources_Response_200: type: object properties: results: $ref: >- #/components/schemas/V1SearchGetResponsesContentApplicationJsonSchemaResults metadata: $ref: >- #/components/schemas/V1SearchGetResponsesContentApplicationJsonSchemaMetadata ``` ## SDK Code Examples ```python # Use our official Python SDK to run a web search from youdotcom import You from youdotcom.types.typesafe_models import print_search with You("api_key") as you: results = you.search.unified( query="What are the latest geopolitical updates from India", count=10 ) print_search(results) ``` ```typescript // Use our official TypeScript SDK to run a web search import { You } from "@youdotcom-oss/sdk"; import type { SearchRequest } from "@youdotcom-oss/sdk/models/operations"; const you = new You({ apiKeyAuth: "api_key" }); const request: SearchRequest = { query: "What are the latest geopolitical updates from India", }; const result = await you.search(request); console.log(result.metadata); console.log(result.results?.web); ``` ```javascript // Use our official JavaScript SDK to run a web search import { You } from "@youdotcom-oss/sdk"; const you = new You({ apiKeyAuth: "api_key" }); const request = { query: "What are the latest geopolitical updates from India", }; const result = await you.search(request); console.log(result.metadata); console.log(result.results?.web); ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://ydc-index.io/v1/search?query=What+are+the+latest+geopolitical+updates+from+India&count=10" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-API-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```java HttpResponse response = Unirest.get("https://ydc-index.io/v1/search?query=What+are+the+latest+geopolitical+updates+from+India&count=10") .header("X-API-Key", "") .asString(); ``` ```csharp var client = new RestClient("https://ydc-index.io/v1/search?query=What+are+the+latest+geopolitical+updates+from+India&count=10"); var request = new RestRequest(Method.GET); request.AddHeader("X-API-Key", ""); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["X-API-Key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://ydc-index.io/v1/search?query=What+are+the+latest+geopolitical+updates+from+India&count=10")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```