x402 Integration
Gloria X402 API is a micropayment-enabled news API that leverages the X402 protocol to provide access to news feeds.
News API
Endpoint
GET /newsPrice per request is $0.01.
Query Parameters
feed_categories
string
Comma separated list of feed categories.
from_date
string
Optional. Get the news from this date, ISO format (YYYY-MM-DD). Defaults to 2025-05-01.
to_date
string
Optional. Get the news up to this date, ISO format (YYYY-MM-DD). Defaults to today.
Available Feeds
See Available Feeds section in REST API.
Response Format
See Response Format section in REST API.
Status Codes
200
Success
400
Bad Request (invalid parameters)
402
Payment required
404
Not Found (no data found for the specified parameters)
Recaps API
Endpoint
GET /recapsPrice per request is $0.10.
Query Parameters
feed_category
string
The feed category to get recap for.
Available Feeds
See Available Feeds section in REST API.
Response Format
See Response Format section in REST API.
Status Codes
200
Success
400
Bad Request (invalid parameters)
402
Payment required
404
Not Found (no data found for the specified parameters)
News By Keyword API
Endpoint
GET /news-by-keywordPrice per request is $0.10.
Query Parameters
keyword
string
The keyword to search for.
Available Feeds
See Available Feeds section in REST API.
Response Format
See Response Format section in REST API.
Status Codes
200
Success
400
Bad Request (invalid parameters)
402
Payment required
404
Not Found (no data found for the specified parameters)
Payment Integration
X402 Protocol
The API uses the X402 protocol for micropayments. Each request to the /news , /recaps or /news-by-keyword endpoint requires a payment to proceed.
Payment Flow
Client makes request to
/newsendpointServer responds with payment challenge (402 Payment Required)
Client processes payment using X402 protocol
Client retries request with payment proof
Server validates payment and serves content
Currently, only payments in USDC on Base network are supported. More coming soon.
Client Implementation
You can find more information on how to implement the client on x402.gitbook.io.
Example Implementation
import { withPaymentInterceptor } from "x402-axios";
import axios from "axios";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount("0x...");
const api = withPaymentInterceptor(
axios.create({
baseURL: "https://api.itsgloria.ai",
}),
account,
);
const response = await api.get("/news");Last updated