Public data interface

X Feed API documentation

A simple public JSON API that serves saved posts and replies from the @billiejs6 X profile. Data is synced from X and delivered from a Cloudflare D1 cache.

Request URL

The main read endpoint. No API key is required.

GEThttps://x-feed.blakusprojekts.lv/api/x-feed?limit=50

API servisa apraksts · Veselības pārbaude

Pagination

Set limit in the request (1–100; defaults to 50). Pass the previous response's nextCursor value to retrieve the next page. Entries are ordered by created_at and tweet_id descending; limit applies to the combined number of posts and replies.

GET /api/x-feed?limit=50
GET /api/x-feed?limit=50&cursor=<nextCursor>

The response includes nextCursor (null when there is no next page) and hasMore (whether more entries exist). An invalid limit or cursor returns HTTP 400.

Response structure

A successful response contains the profile identifier, last sync time, pagination metadata, and two entry arrays.

{
  "service": "blakusprojekts-x-feed",
  "type": "api",
  "purpose": "data-retrieval",
  "profile": "billiejs6",
  "updatedAt": "2026-11-04T12:00:00.000Z",
  "limit": 50,
  "nextCursor": "eyJjcmVhdGVkQXQiOiIyMDI2LTExLTA0VDEwOjAwOjAwLjAwMFoiLCJ0d2VldElkIjoiMTIzNDU2Nzg5MDEyMzQ1Njc4OSJ9",
  "hasMore": true,
  "posts": [
    {
      "tweet_id": "1234567890123456789",
      "kind": "post",
      "text": "Publikācijas teksts",
      "created_at": "2026-11-04T10:00:00.000Z",
      "fetched_at": "2026-11-04T12:00:00.000Z"
    }
  ],
  "replies": []
}

Data fields

Each entry contains tweet_id (X post ID), kind (post or reply), text, created_at (publication time), and fetched_at (fetch time).

Usage examples

JavaScript in a browser or Node.js

const response = await fetch(
  'https://x-feed.blakusprojekts.lv/api/x-feed?limit=50',
  { headers: { Accept: 'application/json' } }
);

if (!response.ok) throw new Error(`API kļūda: ${response.status}`);

const feed = await response.json();
console.log('Publikācijas:', feed.posts);
console.log('Atbildes:', feed.replies);

cURL

curl -H "Accept: application/json" \
  https://x-feed.blakusprojekts.lv/api/x-feed

Render a simple feed

const list = document.querySelector('#x-posts');
feed.posts.forEach((post) => {
  const item = document.createElement('article');
  item.textContent = post.text; // textContent novērš HTML ievadīšanu
  list.append(item);
});

CORS and access

Browser requests from other origins are restricted to blakusprojekts.lv domains. Server-side integrations can call the public GET endpoint directly. CORS is not authentication; it only controls browser access.

Caching and limits

Responses are cached for 5 minutes, with stale-while-revalidate up to 30 minutes. The current best-effort limit is 120 read requests per minute per IP per Worker instance. Use Cloudflare WAF/rate limiting for higher traffic.

Security

Only the read endpoint is public. The data-sync endpoint is private and requires a Bearer secret; never put this secret in browser code. API responses include security and no-index headers.

Errors and documentation

Error responses use HTTP status codes and a JSON error field. A 429 response includes Retry-After. Every JSON response and the Link header point to this documentation.

  • 401 — neatļauta piekļuve iekšējam refresh galapunktam
  • 404 — galapunkts nav atrasts
  • 405 — neatbalstīta HTTP metode
  • 429 — sasniegts pieprasījumu limits; ievēro Retry-After
  • 503 — datu plūsma īslaicīgi nav pieejama

← Back to homepage