Skip to content
looot docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

NewsData.io API / Latest news articles

NewsData.io API tool newsdata-io-1-latest on looot: input fields, $0.01 per call, output shape, and code to run it with curl, JavaScript or Python.

Returns the most recent news articles from the past 48 hours. On the free plan, articles are available with a 12-hour delay. Paid plans can narrow the window with the timeframe parameter. This endpoint does not accept from_date / to_date. Consumes 1 API credit per call.

Inputs

Name Type Required Description
category array no
country array no
creator array no
datatype array no
domain array no
domainurl array no
excludecategory array no
excludecountry array no
excludedomain array no
excludefield array no
excludelanguage array no
full_content string no
id array no
image string no
language array no
organization array no
page string no
prioritydomain string no
q string no
qInMeta string no
qInTitle string no
region array no
removeduplicate string no
sentiment string no
sentiment_score number no
size integer no
sort string no
tag array no
timeframe string no
timezone string no
url string no
video string no

Output

Shape of the run’s result, checked against 2 real answers:

{ status, results: { link, title, ai_org, ai_tag, content, country: string[], creator: string[], pubDate, category: string[], datatype, keywords: string[], language, ai_region, duplicate, image_url, pubDateTZ, sentiment, source_id, video_url, ai_summary, article_id, fetched_at, source_url, description, source_icon, source_name, sentiment_stats, source_priority }[], nextPage, totalResults }

Run it

Every call needs your API token in LOOOT_TOKEN; Sign in shows how to get one. Each run also needs a new idempotency key, so a retry never pays twice. With wait: 30 the answer comes back inline when the run ends within 30 seconds. Otherwise you get the running run back: poll GET /v1/runs/<runId>.

Example input with placeholder values:

curl -X POST "https://api.looot.ai/v1/runs" \
  -H "Authorization: Bearer $LOOOT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"endpointId":"newsdata-io-1-latest","input":{"q":"<q>"},"wait":30}'
const response = await fetch("https://api.looot.ai/v1/runs", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LOOOT_TOKEN}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    endpointId: "newsdata-io-1-latest",
    input: {
      q: "<q>",
    },
    wait: 30,
  }),
});
const run = await response.json();
console.log(run.status, run.result);
import os
import uuid

import requests

response = requests.post(
    "https://api.looot.ai/v1/runs",
    headers={
        "Authorization": f"Bearer {os.environ['LOOOT_TOKEN']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "endpointId": "newsdata-io-1-latest",
        "input": {
            "q": "<q>",
        },
        "wait": 30,
    },
    timeout=90,
)
run = response.json()
print(run["status"], run.get("result"))

To let looot pick among every provider of this job instead, send job:news.search as endpointId; see the job page.

Was this page helpful?