# Live News GET https://api.ydc-index.io/livenews This endpoint returns structured news results using your natural language query. **NOTE**: This endpoint is currently available only to exclusive early access partners. To express interest in early access, please reach out via email to [api@you.com](mailto:api@you.com). Reference: https://docs.you.com/api-reference/live-news/live-news ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: livenews version: 1.0.0 paths: /livenews: get: operationId: returns-a-list-of-live-news-relevant-to-a-users-query summary: Returns a list of live news relevant to a user's query description: >- This endpoint returns structured news results using your natural language query. **NOTE**: This endpoint is currently available only to exclusive early access partners. To express interest in early access, please reach out via email to [api@you.com](mailto:api@you.com). tags: - '' parameters: - name: q in: query description: The query used to retrieve relevant news results. required: true schema: type: string - name: count in: query description: Specifies the maximum number of news results to return. required: false schema: type: integer default: 5 - name: page_num in: query description: >- Indicates the `page_num` for pagination. The `page_num` is calculated in multiples of `count`. For example, if `count = 5` and `page_num = 1`, results 5–10 will be returned. required: false schema: type: integer - name: recency in: query description: >- Filters news results by publication date/time. Accepts the following values: - `day` — Past 24 hours - `week` — Past 7 days - `month` — Past 31 days - Date range: `YYYY-MM-DDtoYYYY-MM-DD` (e.g., `2024-01-15to2024-02-12`) - Datetime range: `YYYY-MM-DDTHH:MMtoYYYY-MM-DDTHH:MM` (e.g., `2024-01-15T09:30to2024-01-15T17:45`) Invalid values are silently ignored (no time filtering applied). required: false schema: type: string - name: X-API-Key in: header description: >- Required to authorize API access. See how to [get an API key](/quickstart#get-your-api-key). required: true schema: type: string responses: '200': description: A JSON object containing news results. content: application/json: schema: $ref: >- #/components/schemas/returnsAListOfLiveNewsRelevantToAUsersQuery_Response_200 '401': description: Unauthorized. Problems with API key. content: application/json: schema: $ref: >- #/components/schemas/ReturnsAListOfLiveNewsRelevantToAUsersQueryRequestUnauthorizedError '403': description: Forbidden. API key lacks scope for this path. content: application/json: schema: $ref: >- #/components/schemas/ReturnsAListOfLiveNewsRelevantToAUsersQueryRequestForbiddenError '500': description: >- Internal Server Error during authentication/authorization middleware. content: application/json: schema: $ref: >- #/components/schemas/ReturnsAListOfLiveNewsRelevantToAUsersQueryRequestInternalServerError servers: - url: https://api.ydc-index.io components: schemas: LivenewsGetResponsesContentApplicationJsonSchemaNewsQuery: type: object properties: original: type: string description: Returns the original query submitted. spellcheck_off: type: boolean default: false title: LivenewsGetResponsesContentApplicationJsonSchemaNewsQuery LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsMetaUrl: type: object properties: hostname: type: string description: The domain name of the URL. netloc: type: string path: type: string description: The URL's path. scheme: type: string description: The URL's metadata. title: LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsMetaUrl LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsThumbnail: type: object properties: src: type: string format: uri description: The image's URI. title: >- LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsThumbnail LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsMetadata: type: object properties: {} title: LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsMetadata LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItems: type: object properties: age: type: string description: How long ago the news was published. description: type: string description: The publisher's description. meta_url: $ref: >- #/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsMetaUrl description: The URL's metadata. page_age: type: string format: date-time description: The timestamp of the publication date. source_name: type: string description: The publisher's name. thumbnail: $ref: >- #/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsThumbnail description: The image's URI. title: type: string description: The news article's title. type: type: string url: type: string format: uri metadata: $ref: >- #/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItemsMetadata article_id: type: - string - 'null' title: LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItems LivenewsGetResponsesContentApplicationJsonSchemaNewsMetadata: type: object properties: request_uuid: type: string format: uuid title: LivenewsGetResponsesContentApplicationJsonSchemaNewsMetadata LivenewsGetResponsesContentApplicationJsonSchemaNews: type: object properties: query: $ref: >- #/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsQuery results: type: array items: $ref: >- #/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsResultsItems type: type: string metadata: $ref: >- #/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNewsMetadata title: LivenewsGetResponsesContentApplicationJsonSchemaNews returnsAListOfLiveNewsRelevantToAUsersQuery_Response_200: type: object properties: news: $ref: >- #/components/schemas/LivenewsGetResponsesContentApplicationJsonSchemaNews title: returnsAListOfLiveNewsRelevantToAUsersQuery_Response_200 ReturnsAListOfLiveNewsRelevantToAUsersQueryRequestUnauthorizedError: type: object properties: detail: type: string description: Error detail message. title: ReturnsAListOfLiveNewsRelevantToAUsersQueryRequestUnauthorizedError ReturnsAListOfLiveNewsRelevantToAUsersQueryRequestForbiddenError: type: object properties: detail: type: string title: ReturnsAListOfLiveNewsRelevantToAUsersQueryRequestForbiddenError ReturnsAListOfLiveNewsRelevantToAUsersQueryRequestInternalServerError: type: object properties: detail: type: string title: ReturnsAListOfLiveNewsRelevantToAUsersQueryRequestInternalServerError securitySchemes: ApiKeyAuth: type: apiKey in: header name: X-API-Key description: >- Required to authorize API access. See how to [get an API key](/quickstart#get-your-api-key). ``` ## SDK Code Examples ```python import requests url = "https://api.ydc-index.io/livenews" querystring = {"q":"what happened in the stock market today"} headers = {"X-API-Key": ""} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript const url = 'https://api.ydc-index.io/livenews?q=what+happened+in+the+stock+market+today'; const options = {method: 'GET', headers: {'X-API-Key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.ydc-index.io/livenews?q=what+happened+in+the+stock+market+today" 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 import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.ydc-index.io/livenews?q=what+happened+in+the+stock+market+today") .header("X-API-Key", "") .asString(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.ydc-index.io/livenews?q=what+happened+in+the+stock+market+today"); 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://api.ydc-index.io/livenews?q=what+happened+in+the+stock+market+today")! 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() ```