Pixabay-api
All images and videos on Pixabay are released free of copyrights under Creative Commons CC0. You may download, modify, distribute, and use them royalty free for anything you like, even in commercial applications. Attribution is not required.
Pixabay API docs: https://pixabay.com/api/docs/
Installation
npm install pixabay-api
In order to get result of searchImages
or searchVideos
you need authenticate key,
which can be obtained by sign up on pixabay.com
Examples
Basic example
import { searchImages } from 'pixabay-api';
searchImages(AUTH_KEY, 'puppy').then((r) => console.log(r));
Searching for videos has same interface as searching for images
import { searchImages } from 'pixabay-api';
searchVideos(AUTH_KEY, 'puppy');
Bad values for some props will throw an error
await searchImages(AUTH_KEY, 'puppy', {per_page: 203});
To suppress those errors, turn off validation
await searchImages(AUTH_KEY, 'puppy', {per_page: 203}, false);
with Authenticate you no longer need to add auth_key within searchImages
import { authenticate } from 'pixabay-api';
const { searchImages, searchVideos } = authenticate(AUTH_KEY);
await searchImages('puppy');
await searchImages('birthday cake', {per_page: 20});
await searchVideos('dog');
FAQ
How to obtain Authenticate Key ?
sign up on pixabay.com
I cannot get response from searchImages or searchVideos
Probably you forget to add auth_key or you have bad one. First, make
sure that you have right auth_key by pasting this code (with your auth_key)
https://pixabay.com/api/?key={ KEY }&response_group=high_resolution&q=yellow+flower
in browser, you should see response similar to one in Example section.
How to retrieve high resolution images ?
request full api access