← Back to API Ninjas
Get Random Facts
Returns one or more random facts from a library of over 125,000.
API Ninjas·$0.001 per call
Example code
// Using @orth/sdk - The simplest way to call APIs
// Install: npm install @orth/sdk
import Orthogonal from "@orth/sdk";
const orthogonal = new Orthogonal({
apiKey: process.env.ORTHOGONAL_API_KEY,
});
const output = await orthogonal.run({
api: "api-ninjas",
path: "/v1/facts"
});
console.log(output);Query parameters
limit
number
How many results to return. Must be between 1 and 100. Default is 1. (Default: 1)
safe
boolean
Set safe=true to exclude facts flagged as sexually explicit, crude, or containing profanity, slurs, or offensive content. Defaults to false, so results are unfiltered unless you opt in. Filtering is best-effort and not a guarantee. Any value other than true/false returns an error. (Default: False)