Basic
News
API endpoint for news search
Authorization
AuthorizationRequiredBearer <token>In: header
Request Body
application/jsonRequiredNews search parameters
bodyRequiredSingle News Search | Batch News SearchResponse Body
Successful Response
TypeScript Definitions
Use the response body type in TypeScript.
searchParametersNewsRequestresultsarray<object>Unexpected error
TypeScript Definitions
Use the response body type in TypeScript.
errorRequiredintegerFormat:
"int32"messageRequiredstringcurl -X POST "https://api.search1api.com/news" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"query": "OpenAI",
"search_service": "google",
"max_results": 5,
"crawl_results": 0,
"image": false,
"include_sites": [],
"exclude_sites": [],
"language": "en",
"time_range": "day"
}'const body = JSON.stringify({
"query": "OpenAI",
"search_service": "google",
"max_results": 5,
"crawl_results": 0,
"image": false,
"include_sites": [],
"exclude_sites": [],
"language": "en",
"time_range": "day"
})
fetch("https://api.search1api.com/news", {
headers: {
"Authorization": "Bearer <token>"
},
body
})package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://api.search1api.com/news"
body := strings.NewReader(`{
"query": "OpenAI",
"search_service": "google",
"max_results": 5,
"crawl_results": 0,
"image": false,
"include_sites": [],
"exclude_sites": [],
"language": "en",
"time_range": "day"
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://api.search1api.com/news"
body = {
"query": "OpenAI",
"search_service": "google",
"max_results": 5,
"crawl_results": 0,
"image": false,
"include_sites": [],
"exclude_sites": [],
"language": "en",
"time_range": "day"
}
response = requests.request("POST", url, json = body, headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
})
print(response.text){
"searchParameters": {
"query": "OpenAI",
"search_service": "google",
"max_results": 5,
"crawl_results": 0,
"image": false,
"include_sites": [],
"exclude_sites": [],
"language": "en",
"time_range": "day"
},
"results": [
{
"title": "string",
"link": "string",
"snippet": "string",
"content": "string"
}
]
}{
"error": 0,
"message": "string"
}