newsfilter

Overview

Authentication, pagination and errors, shared by every route.

The pages in this section are generated from the same zod schemas the API validates its requests and responses against, so they always match what the API does. The raw spec is served at /v1/openapi.json.

Authentication

Send your API key as a bearer token on every request:

curl https://api.newsfilter.dev/v1/stories?ticker=ACME \
  -H "Authorization: Bearer $NEWSFILTER_KEY"

A missing, unknown or revoked key answers 401.

Any authenticated app can read the shared news for every ticker newsfilter covers. Your subscriptions decide which tickers' webhooks and catch-up events you receive; they don't limit what you can read.

Pagination

List routes return a page:

{ "data": [], "next_cursor": "…" }

Pass next_cursor back as cursor for the next page. It is null on the last page. limit is 1 to 200, 50 by default.

Catch-up pages differently, since it never reaches a last page:

{ "data": [], "next_cursor": "…", "has_more": false }

Pass next_cursor back as since. It is always set: when has_more is false you are caught up, and the same cursor picks up new events next time. limit is 1 to 1,000, 100 by default.

Errors

Every error has the same shape, with a stable code and a message for people:

{ "error": { "code": "not_found", "message": "No such story" } }
StatuscodeWhen
400invalid_requestA parameter or the body doesn't match the schema. message says which.
400invalid_jsonThe body isn't valid JSON.
400invalid_cursorThe cursor wasn't one the API gave you.
401missing_api_keyNo Authorization: Bearer header.
401invalid_api_keyThe key is unknown or revoked.
401app_pausedYour app is paused.
403forbiddenThe key belongs to a different app.
404not_foundNo such story or app. A closed story answers 404.
409stale_revisionSubscriptions changed since the revision you sent. Read them again.
410cursor_expiredThe catch-up cursor is older than 30 days. Reload in full.
500internalSomething went wrong on our side. Retry later.

On this page