Find an API

Search public APIs with auth details & Postman guides

← All APIs

Unsplash API

api.unsplash.com · Media

Media API Key Free Tier Photos Images Creative

High-resolution free stock photos — search 5M+ professional photographs, get random images, download triggers, and photo statistics. Free tier: 50 requests/hour.

Authentication

API Key Free API key at unsplash.com/developers. Pass as ?client_id= query parameter or Authorization: Client-ID YOUR_KEY header.

Sample Requests

GET Search photos

Search Unsplash for mountain photos.

https://api.unsplash.com/search/photos?query=mountains&per_page=3&client_id=YOUR_KEY

Hover any highlighted part to learn what it does

curl -X GET "https://api.unsplash.com/search/photos?query=mountains&per_page=3&client_id=YOUR_KEY"
import requests
params = {
    "query": "mountains",
    "per_page": "3",
    "client_id": "YOUR_KEY"
}
response = requests.get(
    "https://api.unsplash.com/search/photos",
    params=params,
)
print(response.json())
const url = new URL('https://api.unsplash.com/search/photos');
url.searchParams.set('query', 'mountains');
url.searchParams.set('per_page', '3');
url.searchParams.set('client_id', 'YOUR_KEY');

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://api.unsplash.com/search/photos")
	q := baseURL.Query()
	q.Set("query", "mountains")
	q.Set("per_page", "3")
	q.Set("client_id", "YOUR_KEY")
	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://api.unsplash.com/search/photos")
uri.query = URI.encode_www_form({
  "query" => "mountains",
  "per_page" => "3",
  "client_id" => "YOUR_KEY"
})

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://api.unsplash.com/search/photos?" . http_build_query([
    "query" => "mountains",
    "per_page" => "3",
    "client_id" => "YOUR_KEY"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET Get random photo

Get a random ocean photo.

https://api.unsplash.com/photos/random?query=ocean&client_id=YOUR_KEY

Hover any highlighted part to learn what it does

curl -X GET "https://api.unsplash.com/photos/random?query=ocean&client_id=YOUR_KEY"
import requests
params = {
    "query": "ocean",
    "client_id": "YOUR_KEY"
}
response = requests.get(
    "https://api.unsplash.com/photos/random",
    params=params,
)
print(response.json())
const url = new URL('https://api.unsplash.com/photos/random');
url.searchParams.set('query', 'ocean');
url.searchParams.set('client_id', 'YOUR_KEY');

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://api.unsplash.com/photos/random")
	q := baseURL.Query()
	q.Set("query", "ocean")
	q.Set("client_id", "YOUR_KEY")
	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://api.unsplash.com/photos/random")
uri.query = URI.encode_www_form({
  "query" => "ocean",
  "client_id" => "YOUR_KEY"
})

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://api.unsplash.com/photos/random?" . http_build_query([
    "query" => "ocean",
    "client_id" => "YOUR_KEY"
]);
$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. Register at unsplash.com/developers for a free access key
  2. Pass client_id=YOUR_KEY as query param
  3. Search: GET /search/photos?query=cityscape&client_id=YOUR_KEY
  4. Random: GET /photos/random?client_id=YOUR_KEY
  5. Attribution required — display photographer credit

Open documentation ↗