← Back to API Ninjas
GET/v2/randomquotes

Get random quotes

Returns randomly chosen quotes, optionally filtered by category, author or work title. For stable paginated results use /quotes; for one fixed daily quote use /quoteoftheday.

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: "/v2/randomquotes" }); console.log(output);

Query parameters

categories
string

Comma-separated list of categories to include in results (results will match all of the categories). Example: categories=wisdom,success

exclude_categories
string

Comma-separated list of categories to exclude from results (results will not match any of the categories). Example: exclude_categories=love,philosophy

author
string

Filter quotes by author name (partial match supported). Example: author=Einstein

work
string

Filter quotes by work title (partial match supported). Example: work=War

limit
number

Number of random results to return. Must be between 1 and 100. Default is 1. (Default: 1)

safe
boolean

Set safe=true to exclude quotes 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)

    Orthogonal - Giving AI agents the tools they need.