Pixabay API Documentation
Welcome to the Pixabay API documentation. Our API is a RESTful interface for searching and retrieving Pixabay images and videos released under Creative Commons CC0.
powered by If you make use of the API, show your users where the images and videos are from, whenever search results are displayed. A link to Pixabay is required and you may use our logo for this purpose. That's the one thing we kindly request in return for free API usage.
The API returns JSON-encoded objects. Hash keys and values are case-sensitive and character encoding is in UTF-8. Hash keys may be returned in any random order and new keys may be added at any time. We will do our best to notify our users before removing hash keys from results or adding required parameters, but we may occasionally do these things without notice. The Pixabay API has no warranty.
Rate Limit
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:
Header name | Description |
---|---|
X-RateLimit-Limit | The maximum number of requests that the consumer is permitted to make in 30 minutes. |
X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |
X-RateLimit-Reset | The remaining time in seconds after which the current rate limit window resets. |
To keep the Pixabay API fast for everyone, requests must be cached for 24 hours. Also, the API is made for real human requests; do not send lots of automated queries. Systematic mass downloads are not allowed.
Hotlinking
Returned image URLs may be used for temporarily displaying search results. However, permanent hotlinking of images (directly embedding them in your applications) is not allowed. If you intend to use the images, please download them to your server first. Videos may be embedded directly in your applications. Yet, we recommend storing them on your server.
Error Handling
If an error occurs, a response with propper HTTP error status code is returned. The body of this response contains a description of the issue in plain text. For example, once you go over the rate limit you will receive an HTTP error 429 ("Too Many Requests") with the message "API rate limit exceeded".
Search Images
Parameters
key (required) | str | Please login to see your API key here. Login | Sign up |
---|---|---|
q | str |
A URL encoded search term. If omitted, all images are returned. This value may not exceed 100 characters.
Example: "yellow+flower" |
lang | str |
Language code of the language to be searched in.
Accepted values: cs, da, de, en, es, fr, id, it, hu, nl, no, pl, pt, ro, sk, fi, sv, tr, vi, th, bg, ru, el, ja, ko, zh Default: "en" |
id | str | ID, hash ID, or a comma separated list of values for retrieving specific images. In a comma separated list, IDs and hash IDs cannot be used together. |
response_group | str |
Choose between retrieving high resolution images and image details.
When selecting details, you can access images up to a dimension of 960 x 720 px.
Accepted values: "image_details", "high_resolution" Default: "image_details" |
image_type | str |
Filter results by image type.
Accepted values: "all", "photo", "illustration", "vector" Default: "all" |
orientation | str |
Whether an image is wider than it is tall, or taller than it is wide.
Accepted values: "all", "horizontal", "vertical" Default: "all" |
category | str |
Filter results by category.
Accepted values: fashion, nature, backgrounds, science, education, people, feelings, religion, health, places, animals, industry, food, computer, sports, transportation, travel, buildings, business, music |
min_width | int |
Minimum image width.
Default: "0" |
min_height | int |
Minimum image height.
Default: "0" |
editors_choice | bool |
Select images that have received an Editor's Choice award.
Accepted values: "true", "false" Default: "false" |
safesearch | bool |
A flag indicating that only images suitable for all ages should be returned.
Accepted values: "true", "false" Default: "false" |
order | str |
How the results should be ordered.
Accepted values: "popular", "latest" Default: "popular" |
page | int |
Returned search results are paginated. Use this parameter to select the page number.
Default: 1 |
per_page | int |
Determine the number of results per page.
Accepted values: 3 - 200 Default: 20 |
callback | string | JSONP callback function name |
pretty | bool |
Indent JSON output. This option should not be used in production.
Accepted values: "true", "false" Default: "false" |
Example 1: Default image search
Retrieving web format photos about "yellow flowers". The search term q needs to be URL encoded. "{ KEY }" has to replaced with your API key.
Response for this request:
{ "total": 4692 "totalHits": 500, "hits": [ { "id": 195893, "pageURL": "https://pixabay.com/en/blossom-bloom-flower-yellow-close-195893/", "type": "photo", "tags": "blossom, bloom, flower", "previewURL": "https://static.pixabay.com/photo/2013/10/15/09/12/flower-195893_150.jpg" "previewWidth": 150, "previewHeight": 84, "webformatURL": "https://pixabay.com/get/35bbf209db8dc9f2fa36746403097ae226b796b9e13e39d2_640.jpg", "webformatWidth": 640, "webformatHeight": 360, "imageWidth": 4000, "imageHeight": 2250, "views": 7671, "downloads": 6439, "favorites": 1, "likes": 5, "comments": 2, "user_id": 48777, "user": "Josch13", "userImageURL": "https://static.pixabay.com/user/2013/11/05/02-10-23-764_250x250.jpg", }, { "id": 14724, ... }, ... ] }
Response key | Description |
---|---|
total | The total number of hits. |
totalHits | The number of images accessible through the API. By default, the API is limited to return a maximum of 500 images per query. |
id | A unique identifier for updating expired image URLs. |
pageURL | Source page on Pixabay, which provides a download link for the original image of the size imageWidth x imageHeight. |
previewURL | Low resolution images with a maximum width or height of 150 px (previewWidth x previewHeight). |
webformatURL |
Medium sized image with a maximum width or height of 640 px (webformatWidth x webformatHeight). URL valid for 24 hours. Replace '_640' in any webformatURL value to access other image sizes:Replace with '_180' or '_340' to get a 180 or 340 px tall version of the image, respectively. Replace with '_960' to get the image in a maximum dimension of 960 x 720 px. |
views | Total number of views. |
downloads | Total number of downloads. |
favorites | Total number of favorites. |
likes | Total number of likes. |
comments | Total number of comments. |
user_id, user | User ID and name of the contributor. Profile URL: https://pixabay.com/users/{ USERNAME }-{ ID }/ |
userImageURL | Profile picture URL (250 x 250 px). |
Example 2: High resolution image search
Use response_group=high_resolution for retrieving high-res images. Detailed data about the images, such as tags and page URL on Pixabay, are not available in this response.Response for this request:
{ "total": 4692 "totalHits": 500, "hits": [ { "id_hash": "98b12d28d77432a2", "type": "photo", "previewURL": "https://pixabay.com/get/ed6a9364aea79b54a6290d9388e0722ad543e89fd0a76647_150.jpg", "previewWidth": 150, "previewHeight": 84, "webformatURL": "https://pixabay.com/get/ed6a9364aea79b54a6290d9388e0722ad543e89fd0a76647_640.jpg", "webformatWidth": 640, "webformatHeight": 360, "largeImageURL": "https://pixabay.com/get/ed6a9364aea79b54a6290d9388e0722ad543e89fd0a76647_1280.jpg", "fullHDURL": "https://pixabay.com/get/ed6a9364aea79b54a6290d9388e0722ad543e89fd0a76647_1920.jpg", "imageWidth": 4000, "imageHeight": 2250, "imageURL": "https://pixabay.com/get/ed6a9364aea79b54a6290d9388e0722ad543e89fd0a76647.jpg", "user_id": 48777, "user": "Josch13" "userImageURL": "https://static.pixabay.com/user/2013/11/05/02-10-23-764_250x250.jpg", }, { "id_hash": "bb4d3acd9b2b4650", ... }, ... ] }
Response key | Description |
---|---|
id_hash | A unique identifier for updating expired image URLs. The hash ID may also be used to build URLs to pages on Pixabay. |
largeImageURL | Scaled image with a maximum width/height of 1280px. |
fullHDURL | Full HD scaled image with a maximum width/height of 1920px. |
imageURL | URL to the original image (imageWidth x imageHeight). |
vectorURL | URL to a vector resource if available, else omitted. |
Other response keys according to example 1. |
Example 3: Retrieving images by ID or hash ID
IDs and hash IDs may be used to refresh data of selected images. Multiple IDs or hash IDs may be separated by commas, however, you cannot use IDs and hash IDs together in a single request.
a) Fetching image details by ID; response according to example 1.
b) Fetching high resolution images by hash ID; response according to example 2.
Example 4: Using hash IDs for building Pixabay URLs
A hash ID may be used for creating a link to the appropriate image page on Pixabay. Non-authorized users are required to solve a captcha for accessing this page. URL pattern: https://pixabay.com/goto/{ ID_HASH }/
https://pixabay.com/goto/bb4d3acd9b2b4650/
Search Videos
Parameters
key (required) | str | Your API key |
---|---|---|
q | str |
A URL encoded search term. If omitted, all videos are returned. This value may not exceed 100 characters.
Example: "yellow+flower" |
lang | str |
Language code of the language to be searched in.
Accepted values: cs, da, de, en, es, fr, id, it, hu, nl, no, pl, pt, ro, sk, fi, sv, tr, vi, th, bg, ru, el, ja, ko, zh Default: "en" |
id | str | ID or a comma separated list of values for retrieving specific videos. |
video_type | str |
Filter results by video type.
Accepted values: "all", "film", "animation" Default: "all" |
category | str |
Filter results by category.
Accepted values: fashion, nature, backgrounds, science, education, people, feelings, religion, health, places, animals, industry, food, computer, sports, transportation, travel, buildings, business, music |
min_width | int |
Minimum video width.
Default: "0" |
min_height | int |
Minimum video height.
Default: "0" |
editors_choice | bool |
Select videos that have received an Editor's Choice award.
Accepted values: "true", "false" Default: "false" |
safesearch | bool |
A flag indicating that only videos suitable for all ages should be returned.
Accepted values: "true", "false" Default: "false" |
order | str |
How the results should be ordered.
Accepted values: "popular", "latest" Default: "popular" |
page | int |
Returned search results are paginated. Use this parameter to select the page number.
Default: 1 |
per_page | int |
Determine the number of results per page.
Accepted values: 3 - 200 Default: 20 |
callback | string | JSONP callback function name |
pretty | bool |
Indent JSON output. This option should not be used in production.
Accepted values: "true", "false" Default: "false" |
Example
Retrieving videos about "yellow flowers". The search term q needs to be URL encoded. "{ KEY }" has to replaced with your API key.
Response for this request:
{ "total": 42 "hits": [ { "id": 125, "pageURL": "https://pixabay.com/videos/id-125/", "type": "film", "tags": "flowers, yellow, blossom", "duration": 12, "picture_id": "529927645", "videos": { "large": { "url": "https://player.vimeo.com/external/135736646.hd.mp4?s=ed02d71c92dd0df7d1110045e6eb65a6", "width": 1920, "height": 1080, "size": 6615235 }, "medium": { "url": "https://player.vimeo.com/external/135736646.hd.mp4?s=ed02d71c92dd0df7d1110045e6eb65a6", "width": 1280, "height": 720, "size": 3562083 }, "small": { "url": "https://player.vimeo.com/external/135736646.sd.mp4?s=db2924c48ef91f17fc05da74603d5f89", "width": 640, "height": 360, "size": 1030736 } }, "views": 169, "downloads": 66, "favorites": 7, "likes": 3, "comments": 2, "user_id": 1281706, "user": "CoverrFreeFootage", "userImageURL": "https://static.pixabay.com/user/2015/10/16/09-28-45-303_250x250.png" }, { "id": 14724, ... }, ... ] }
Response key | Description |
---|---|
total | The total number of hits. |
id | A unique identifier for this video. |
pageURL | Source page on Pixabay. |
picture_id |
This value may be used to retrieve static preview images of the video in various sizes:
https://i.vimeocdn.com/video/{ PICTURE_ID }_{ SIZE }.jpg Available sizes: 100x75, 200x150, 295x166, 640x360, 960x540, 1920x1080 Exampe: https://i.vimeocdn.com/video/529927645_295x166.jpg |
views | Total number of views. |
downloads | Total number of downloads. |
favorites | Total number of favorites. |
likes | Total number of likes. |
comments | Total number of comments. |
user_id, user | User ID and name of the contributor. Profile URL: https://pixabay.com/users/{ USERNAME }-{ ID }/ |
userImageURL | Profile picture URL (250 x 250 px). |
JavaScript Example
var API_KEY = 'YOUR_API_KEY'; var URL = "https://pixabay.com/api/?key="+API_KEY+"&q="+encodeURIComponent('red roses'); $.getJSON(URL, function(data){ if (parseInt(data.totalHits) > 0) $.each(data.hits, function(i, hit){ console.log(hit.pageURL); }); else console.log('No hits'); });
Support
Request full API access for retrieving high resolution images.
Contact us if you have any questions about the API.Developer Freebies
Download free tools, jQuery and vanilla JavaScript plugins, and other useful software - developed by Pixabay.
Pixabay Goodies