Skip to content

Local News

The /v1/news/local endpoint returns news around a single geographic point — given either lat/lng coordinates or a place name — and ranks the results by distance. Unlike the plain geo filter on /v1/news/everything, it sorts by proximity, adds distance_km and nearest_location to every article, and can attach an optional local intelligence dashboard.

Endpoint

GET  /v1/news/local
POST /v1/news/local

Both methods are equivalent: parameters can be passed as query parameters (GET) or as a JSON body (POST).

Local endpoint vs. the geo filter

/v1/news/local uses bare lat, lng and radius parameters, while the geo filter on /v1/news/everything uses the dotted location.lat, location.lng and location.radius form. Both find articles near a point, but /v1/news/local adds features the filter does not: proximity sorting, per-article distance_km and nearest_location, place-name geocoding, relevance ranking presets, and aggregate local_insights. If you only need a geographic constraint on a normal search, use the geo filter instead.

Query Parameters

The endpoint accepts every filter available on /v1/news/everything (for example language.code, category.id, published_at.start), plus the local-specific parameters below.

ParameterTypeRequiredDescription
latfloatYes*Latitude of the center point (-90 to 90). Must be sent together with lng.
lngfloatYes*Longitude of the center point (-180 to 180). Must be sent together with lat.
placestringYes*A place name to geocode instead of lat/lng (for example Berlin).
countrystringNoTwo-letter country code that narrows a place lookup (for example de).
radiusintegerNoSearch radius in kilometers. Default 50, maximum 20000.
sortstringNodistance (default), published_at, or relevance.
rankingstringNoWeighting preset used when sort=relevance: balanced (default), proximity, authority, fresh.
w.distance / w.opr / w.recency / w.importantfloatNoOverride individual relevance weights (used with sort=relevance).
insightsstringNoComma-separated list of local insight blocks to compute (see below).
per_pageintegerNoNumber of articles per page. Default 100, maximum 250.
pageintegerNoPage of results, starting at 1.

* You must supply a center: either both lat and lng, or a place.

Response Format

json
{
  "status": "ok",
  "query": { "lat": 52.52, "lng": 13.4, "radius_km": 50, "sort": "distance" },
  "total": 128,
  "results": [
    {
      "id": 0,
      "title": "string",
      "href": "string",
      "distance_km": 3.2,
      "nearest_location": {
        "entity_id": 0,
        "name": "string",
        "lat": 52.51,
        "lng": 13.41,
        "country": "de"
      }
    }
  ]
}

Response Fields

FieldTypeDescription
statusstringAlways ok on success.
queryobjectThe center and settings that were used: lat, lng, radius_km, sort. When place is used it also carries place and resolved_entity_id.
totalintegerExact number of matching articles inside the radius.
resultsarrayArticle objects (same shape as /v1/news/everything) with the extra fields below.
results[].distance_kmfloatDistance from the center to the article's nearest matched location.
results[].nearest_locationobjectClosest matched place: entity_id, name, lat, lng, country.
results[].relevance_scorefloatPresent only when sort=relevance.
ranking_weightsobjectThe effective relevance weights (present when sort=relevance).
local_insightsobjectPresent only when insights is requested (see below).

Local insights

Pass the insights parameter — a comma-separated list — to compute aggregate intelligence over the radius. The results appear under a local_insights object alongside the article list. Allowed blocks are:

mood, hotspots, events, entities, bias, sources, timeline, top_categories, top_topics, breaking, velocity, movers.

An unknown value returns 400 ER0420. In the response, four blocks are keyed by their aggregated form: eventstop_events, entitiestop_entities, biasbias_split, sourcestop_sources; the rest keep their names. The movers block surfaces entities and topics accelerating against their 14-day baseline, scoped to the radius.

Billing

A /v1/news/local call costs 1 point for the article listing, plus 1 additional point for each requested insight block. A request with no insights costs 1 point; insights=mood,hotspots,breaking costs 4 points (1 + 3). Points are charged only when the response contains at least one article.

Request Examples

bash
curl "https://api.apitube.io/v1/news/local?lat=52.52&lng=13.40&radius=50&api_key=YOUR_API_KEY"
python
import requests

resp = requests.get(
    "https://api.apitube.io/v1/news/local",
    params={"lat": "52.52", "lng": "13.40", "radius": "50", "api_key": "YOUR_API_KEY"},
)
print(resp.json())
javascript
const params = new URLSearchParams({ lat: "52.52", lng: "13.40", radius: "50", api_key: "YOUR_API_KEY" });
const resp = await fetch(`https://api.apitube.io/v1/news/local?${params}`);
console.log(await resp.json());
php
$query = http_build_query(["lat" => "52.52", "lng" => "13.40", "radius" => "50", "api_key" => "YOUR_API_KEY"]);
$data = json_decode(file_get_contents("https://api.apitube.io/v1/news/local?$query"), true);
print_r($data);

Geocode a place name and rank by relevance

bash
curl "https://api.apitube.io/v1/news/local?place=Berlin&country=de&radius=30&sort=relevance&ranking=authority&api_key=YOUR_API_KEY"

Attach a local insights dashboard

bash
curl "https://api.apitube.io/v1/news/local?lat=52.52&lng=13.40&radius=50&insights=mood,hotspots,breaking&api_key=YOUR_API_KEY"

Error Responses

CodeStatusMeaning
ER0406400No center provided — send lat and lng together, or a place.
ER0407400lat must be a valid latitude between -90 and 90.
ER0408400lng must be a valid longitude between -180 and 180.
ER0409400radius must be a positive number up to 20000 km.
ER0420400Unknown value in insights.
ER0421400The place could not be geocoded — try a more specific name, add country, or pass lat/lng.