Pixabay Free Image API

I was working on little weather app in Vue and wanted to make it smarter and more interesting by adding location image in background. I thought that Image API with ability to return images of desired location would be a great solution. So I started googling around for such API, but finding one that’s working well and that’s free proved to be a hard task. Anyway after few hours of research and testing I found one that’s working well and it’s free. I decided to share this one with you guys and it’s Pixabay Image API.

Requirements

Using Pixabay Image API is free. You’ll need to register on their site to obtain API key and when you use images you will need to show to your users where are your images from. Let your users know from where are you getting images in your app or website by adding link to Pixabay website. So that’s all you need to do in order to use this cool image API.

Limitations

By default, you can make up to 5,000 requests per hour. Requests are associated with the API key, and not with your IP address. The response headers tell you everything you need to know about your current rate limit status.

GET Images

To get images you will need to send GET request to https://pixabay.com/api/ url with your API key included. API supports many different parameters which will give you huge possibilities to filter best images based on their name, type, category, size and even color. For example if you want to get images of my home city Sarajevo, all you need is to include q parameter with name of the city like I have done below.

  https://pixabay.com/api/?key=YOUR_API_KEY&q=sarajevo

For full list of supported parameters please check API Documentation.

Response

The API returns JSON-encoded objects.

{
  "largeImageURL": "https://pixabay.com/get/eb35b40728fc063ed1584d05fb1d4e92e475e3d11cac104497f1c97aaee4b1b1_1280.jpg",
  "webformatHeight": 426,
  "webformatWidth": 640,
  "likes": 29,
  "imageWidth": 5184,
  "id": 2058087,
  "user_id": 4527338,
  "views": 4093,
  "comments": 4,
  "pageURL": "https://pixabay.com/en/bosnia-europe-herzegovina-country-blue-l-2058087/",
  "imageHeight": 3456,
  "webformatURL": "https://pixabay.com/get/eb35b40728fc063ed1584d05fb1d4e92e475e3d11cac104497f1c97aaee4b1b1_640.jpg",
  "type": "photo",
  "previewHeight": 99,
  "tags": "bosnia europe herzegovina country blue landmark tourism flag city landscape european water river symbol design architecture sarajevo old travel white town bosnia bosnia bosnia europe sarajevo sarajevo sarajevo sarajevo sarajevo travel",
  "downloads": 1665,
  "user": "thalespaz",
  "favorites": 30,
  "imageSize": 4973005,
  "previewWidth": 150,
  "userImageURL": "",
  "previewURL": "https://cdn.pixabay.com/photo/2017/02/11/17/07/bosnia-2058087_150.jpg"
}

GET Videos

Yes you can even get videos it’s just amazing how much this API can help you in your work. To get videos you need to send GET request to https://pixabay.com/api/videos/ with your API key included as parameter. To retrieve videos about “yellow flowers” you need to send request like in example bellow.

https://pixabay.com/api/videos/?key=8472145-a9d609df3f7faa7d61c5022dd&q=yellow+flowers

API supports many different parameters for videos too so check API Documentation to see what is available.

I’m using Pixabay Image API to get cool images and videos in my apps and web pages it makes them smarter, interactive and more interesting. Hope you guys will find it useful in your projects. Thank you for reading and following us on virtuooza.

Share with your friends