curl --request GET \
--url https://api.bonai.io/news/article/random \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.bonai.io/news/article/random"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.bonai.io/news/article/random', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bonai.io/news/article/random"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}curl --request GET \
--url https://api.bonai.io/news/article/random \
--header 'Authorization: Bearer <token>'{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"parameters": {},
"article": {
"title": "<string>",
"url": "<string>",
"excerpt": "<string>",
"thumbnail": "<string>",
"language": "<string>",
"paywall": true,
"content_length": 123,
"date": "2023-11-07T05:31:56Z",
"authors": [
"<string>"
],
"keywords": [
"<string>"
],
"publisher": {
"name": "<string>",
"url": "<string>",
"favicon": "<string>"
},
"id": "<string>",
"content": "<string>",
"translations": {}
}
}{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"errors": [
{
"code": "INVALID_PARAMETER",
"message": "<string>",
"details": {}
}
]
}{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"errors": [
{
"code": "INVALID_PARAMETER",
"message": "<string>",
"details": {}
}
]
}{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"errors": [
{
"code": "INVALID_PARAMETER",
"message": "<string>",
"details": {}
}
]
}{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"errors": [
{
"code": "INVALID_PARAMETER",
"message": "<string>",
"details": {}
}
]
}{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"errors": [
{
"code": "INVALID_PARAMETER",
"message": "<string>",
"details": {}
}
]
}Random article
Retrieve a random article based on optional filters
curl --request GET \
--url https://api.bonai.io/news/article/random \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.bonai.io/news/article/random"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.bonai.io/news/article/random', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bonai.io/news/article/random"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}curl --request GET \
--url https://api.bonai.io/news/article/random \
--header 'Authorization: Bearer <token>'{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"parameters": {},
"article": {
"title": "<string>",
"url": "<string>",
"excerpt": "<string>",
"thumbnail": "<string>",
"language": "<string>",
"paywall": true,
"content_length": 123,
"date": "2023-11-07T05:31:56Z",
"authors": [
"<string>"
],
"keywords": [
"<string>"
],
"publisher": {
"name": "<string>",
"url": "<string>",
"favicon": "<string>"
},
"id": "<string>",
"content": "<string>",
"translations": {}
}
}{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"errors": [
{
"code": "INVALID_PARAMETER",
"message": "<string>",
"details": {}
}
]
}{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"errors": [
{
"code": "INVALID_PARAMETER",
"message": "<string>",
"details": {}
}
]
}{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"errors": [
{
"code": "INVALID_PARAMETER",
"message": "<string>",
"details": {}
}
]
}{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"errors": [
{
"code": "INVALID_PARAMETER",
"message": "<string>",
"details": {}
}
]
}{
"metadata": {
"id": "<string>",
"took_ms": 123,
"timestamp": "2023-11-07T05:31:56Z"
},
"errors": [
{
"code": "INVALID_PARAMETER",
"message": "<string>",
"details": {}
}
]
}Authorizations
Your Bonai API key, sent as Authorization: Bearer <key>. The api-key and x-api-key headers are also accepted.
Headers
API version to consume. Defaults to the latest version (2026-08-01).
2026-08-01, 2024-01-01 Query Parameters
Topic filter
Language code
Content type to return
plaintext, html Response
Successful response
The query parameters used for this request
Hide child attributes
Hide child attributes
Language code, for example en
Length of the article content in characters
Publish date (ISO 8601)
Stable article identifier (deterministic hash of the normalized URL). Exposed in version 2026-08-01 and later when your plan includes it.
Full article content. Only returned by GET /article when your plan includes it.
Per-language title and excerpt translations. Only present for non-English articles in version 2026-08-01 and later, and when your plan includes them. Null for English articles and when no translation data exists.
Was this page helpful?