GET /images
Proxies image search requests to Unsplash and returns the image bytes. Provides caching headers for optimal performance.Query parameters
Search query for the image (e.g., “sunset”, “technology”, “nature”). Maximum 100 characters after normalization
Image orientation filter. Defaults to
"landscape"Allowed values:landscapeportraitsquarish
Color filter for the imageAllowed values:
black_and_whiteblackwhiteyelloworangeredpurplemagentagreentealblue
Response
Returns the image bytes directly with appropriateContent-Type header (typically image/jpeg).
Caching
The endpoint implements aggressive caching:- Client cache: 24 hours (
max-age=86400) - CDN cache: 7 days (
s-maxage=604800) - Stale-while-revalidate: 24 hours
Error codes
Missing required
q query parameterNo image found matching the query
Unsplash API request failed or image fetch failed
Unexpected internal error
Example request
Example with color filter
Using in HTML
Using in CSS
Implementation details
- Queries are normalized: trimmed, lowercased, and truncated to 100 characters
- Only the first search result is returned (
per_page=1) - Content filter is set to
highfor safe content - Unsplash API version:
v1 - The endpoint streams image bytes directly without storing them