Find an API

Search public APIs with auth details & Postman guides

← All APIs

Pixabay API

pixabay.com · Media

Media API Key Free Tier Photos Videos Illustrations

4M+ free stock images, videos, and vectors. Download permitted, no hotlink restrictions, can be self-hosted. Free API key required.

Authentication

API Key Free API key at pixabay.com/api/docs (requires account). Pass as ?key= query parameter.

Sample Requests

GET Search images

Search Pixabay for coffee photos.

https://pixabay.com/api?q=coffee&key=YOUR_KEY&per_page=5&image_type=photo

Hover any highlighted part to learn what it does

curl -X GET "https://pixabay.com/api/?q=coffee&key=YOUR_KEY&per_page=5&image_type=photo"
import requests
params = {
    "q": "coffee",
    "key": "YOUR_KEY",
    "per_page": "5",
    "image_type": "photo"
}
response = requests.get(
    "https://pixabay.com/api/",
    params=params,
)
print(response.json())
const url = new URL('https://pixabay.com/api/');
url.searchParams.set('q', 'coffee');
url.searchParams.set('key', 'YOUR_KEY');
url.searchParams.set('per_page', '5');
url.searchParams.set('image_type', 'photo');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://pixabay.com/api/")
	q := baseURL.Query()
	q.Set("q", "coffee")
	q.Set("key", "YOUR_KEY")
	q.Set("per_page", "5")
	q.Set("image_type", "photo")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://pixabay.com/api/")
uri.query = URI.encode_www_form({
  "q" => "coffee",
  "key" => "YOUR_KEY",
  "per_page" => "5",
  "image_type" => "photo"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://pixabay.com/api/?" . http_build_query([
    "q" => "coffee",
    "key" => "YOUR_KEY",
    "per_page" => "5",
    "image_type" => "photo"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET Search videos

Search Pixabay for ocean videos.

https://pixabay.com/api/videos?q=ocean&key=YOUR_KEY&per_page=3

Hover any highlighted part to learn what it does

curl -X GET "https://pixabay.com/api/videos/?q=ocean&key=YOUR_KEY&per_page=3"
import requests
params = {
    "q": "ocean",
    "key": "YOUR_KEY",
    "per_page": "3"
}
response = requests.get(
    "https://pixabay.com/api/videos/",
    params=params,
)
print(response.json())
const url = new URL('https://pixabay.com/api/videos/');
url.searchParams.set('q', 'ocean');
url.searchParams.set('key', 'YOUR_KEY');
url.searchParams.set('per_page', '3');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://pixabay.com/api/videos/")
	q := baseURL.Query()
	q.Set("q", "ocean")
	q.Set("key", "YOUR_KEY")
	q.Set("per_page", "3")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://pixabay.com/api/videos/")
uri.query = URI.encode_www_form({
  "q" => "ocean",
  "key" => "YOUR_KEY",
  "per_page" => "3"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://pixabay.com/api/videos/?" . http_build_query([
    "q" => "ocean",
    "key" => "YOUR_KEY",
    "per_page" => "3"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. Get a free API key at pixabay.com/api/docs
  2. Pass key=YOUR_KEY on every request
  3. Search: GET https://pixabay.com/api/?key=YOUR_KEY&q=forest&image_type=photo
  4. image_type: photo, illustration, vector
  5. Videos: GET https://pixabay.com/api/videos/?key=YOUR_KEY&q=nature

Open documentation ↗