← Back to API Ninjas
Get a random image
Returns a random royalty-free image, optionally constrained by `category`, `width` and `height`. Useful for placeholder or sample imagery.
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/randomimage"
});
console.log(output);Query parameters
category
string
Image category. If set, must be one of the following: nature, city, technology, food, still_life, abstract, wildlife. (Allowed: nature, city, technology, food, still_life, abstract, wildlife)
width
number
Width of the image to generate. Must be between 1 and 5000. Default value is 640. (Default: 640)
height
number
Height of the image to generate. Must be between 1 and 5000. Default value is 480. (Default: 480)