Find an API

Search public APIs with auth details & Postman guides

← All APIs

Pexels API

api.pexels.com · Media

Media API Key Free Tier Photos Videos Images

Free stock photos and videos — search millions of curated images and videos from Pexels contributors. Includes video search and curation endpoints. Completely free with API key.

Authentication

API Key Free API key at pexels.com/api. Pass as Authorization: YOUR_KEY header.

Sample Requests

GET Search photos

Search Pexels for sunset photos.

https://api.pexels.com/v1/search?query=sunset&per_page=3

Hover any highlighted part to learn what it does

Headers — extra info sent with the request
Authorization YOUR_API_KEY
curl -X GET "https://api.pexels.com/v1/search?query=sunset&per_page=3" \
  -H "Authorization: YOUR_API_KEY"
import requests
params = {
    "query": "sunset",
    "per_page": "3"
}
headers = {
    "Authorization": "YOUR_API_KEY"
}
response = requests.get(
    "https://api.pexels.com/v1/search",
    params=params,
    headers=headers,
)
print(response.json())
const url = new URL('https://api.pexels.com/v1/search');
url.searchParams.set('query', 'sunset');
url.searchParams.set('per_page', '3');

const response = await fetch(url, {
  headers: {
    'Authorization': 'YOUR_API_KEY'
  },
}); 
const data = await response.json();
console.log(data);
package main

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

func main() {
	baseURL, _ := url.Parse("https://api.pexels.com/v1/search")
	q := baseURL.Query()
	q.Set("query", "sunset")
	q.Set("per_page", "3")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)
	req.Header.Set("Authorization", "YOUR_API_KEY")

	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://api.pexels.com/v1/search")
uri.query = URI.encode_www_form({
  "query" => "sunset",
  "per_page" => "3"
})

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

req = Net::HTTP::Get.new(uri)
req["Authorization"] = "YOUR_API_KEY"

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.pexels.com/v1/search?" . http_build_query([
    "query" => "sunset",
    "per_page" => "3"
]);
$opts = ["http" => [
    "method" => "GET",
    "header" => implode("\r\n", [
        "Authorization: YOUR_API_KEY"
    ]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET Get curated photos

Get daily curated photos from Pexels.

https://api.pexels.com/v1/curated?per_page=5

Hover any highlighted part to learn what it does

Headers — extra info sent with the request
Authorization YOUR_API_KEY
curl -X GET "https://api.pexels.com/v1/curated?per_page=5" \
  -H "Authorization: YOUR_API_KEY"
import requests
params = {
    "per_page": "5"
}
headers = {
    "Authorization": "YOUR_API_KEY"
}
response = requests.get(
    "https://api.pexels.com/v1/curated",
    params=params,
    headers=headers,
)
print(response.json())
const url = new URL('https://api.pexels.com/v1/curated');
url.searchParams.set('per_page', '5');

const response = await fetch(url, {
  headers: {
    'Authorization': 'YOUR_API_KEY'
  },
}); 
const data = await response.json();
console.log(data);
package main

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

func main() {
	baseURL, _ := url.Parse("https://api.pexels.com/v1/curated")
	q := baseURL.Query()
	q.Set("per_page", "5")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)
	req.Header.Set("Authorization", "YOUR_API_KEY")

	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://api.pexels.com/v1/curated")
uri.query = URI.encode_www_form({
  "per_page" => "5"
})

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

req = Net::HTTP::Get.new(uri)
req["Authorization"] = "YOUR_API_KEY"

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://api.pexels.com/v1/curated?" . http_build_query([
    "per_page" => "5"
]);
$opts = ["http" => [
    "method" => "GET",
    "header" => implode("\r\n", [
        "Authorization: YOUR_API_KEY"
    ]),
]];
$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 pexels.com/api
  2. Set Authorization: YOUR_API_KEY header (no "Bearer" prefix)
  3. Search: GET /v1/search?query=coffee&per_page=5
  4. Videos: GET https://api.pexels.com/videos/search?query=rain&per_page=5
  5. No attribution required — but credit is appreciated

Open documentation ↗