Random Image API
The Random Image API generates random images for all your placeholder and design needs. It supports custom sizes as well as custom image categories.
/v1/randomimage GET
https://api.api-ninjas.com/v1/randomimage
Returns a random, base64-encoded image in JPEG format.
Parameters
- categoryoptionalpremium only- Image category. If set, must be one of the following: - nature,- city,- technology,- food,- still_life,- abstract,- wildlife.
- widthoptionalpremium only- Width of the image to generate. Must be between - 1and- 5000. Default value is- 640.
- heightoptionalpremium only- Height of the image to generate. Must be between - 1and- 5000. Default value is- 480.
Headers
- X-Api-Keyrequired- API Key associated with your account. 
- Acceptrequired- Header indicating the content type to accept in the result. Must be set to the following: - image/jpg.
Sample Request Live Demo!
https://api.api-ninjas.com/v1/randomimageHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
3
curl -X GET "https://api.api-ninjas.com/v1/randomimage?category=wildlife" \
  -H "X-Api-Key: YOUR_API_KEY" \
  --output random_image.jpgIf 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.