The Random Image API generates random images for all your placeholder and design needs. It supports custom sizes as well as custom image categories.
https://api.api-ninjas.com/v1/randomimage
Returns a random, base64-encoded image in JPEG format.
category
optionalpremium onlyImage category. If set, must be one of the following: nature
, city
, technology
, food
, still_life
, abstract
, wildlife
.
width
optionalpremium onlyWidth of the image to generate. Must be between 1
and 5000
. Default value is 640
.
height
optionalpremium onlyHeight of the image to generate. Must be between 1
and 5000
. Default value is 480
.
X-Api-Key
requiredAPI Key associated with your account.
Accept
requiredHeader indicating the content type to accept in the result. Must be set to the following: image/jpg
.
https://api.api-ninjas.com/v1/randomimage
Headers
X-Api-Key
Log in or sign up to get your API Key
1
2
3
curl -X GET "https://api.api-ninjas.com/v1/randomimage?category=animals" \
-H "X-Api-Key: YOUR_API_KEY" \
--output random_image.jpg
If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.