Domain knowledge for the Pexels stock photo and video API.
Pexels API
Pexels provides a large library of high-quality stock photos and videos licensed under the Pexels License (personal and commercial use, no attribution required but appreciated).
Data Model
Photo Resource
Field
Type
Description
id
integer
Unique numeric photo identifier
width
integer
Original width in pixels
height
integer
Original height in pixels
url
string
Pexels web page URL for this photo
photographer
string
Photographer display name
photographer_url
string
Photographer's Pexels profile URL
photographer_id
integer
Photographer's numeric ID
avg_color
string
Hex color (e.g. #978E82), useful as image placeholder
A Photo belongs to a Photographer (via photographer_id).
A Video belongs to a User/Videographer (via user.id).
A Collection contains mixed Photo and Video objects. Collection media items include an extra type field ("Photo" or "Video") to discriminate.
Collections are read-only via API — create/edit on pexels.com, iOS, or Android app.
API Endpoints
Photos (base: /v1/)
Endpoint
Method
Description
/v1/search?query=...
GET
Full-text search with orientation, size, color, locale filters
/v1/curated
GET
Trending editor-curated photos, updated hourly
/v1/photos/:id
GET
Single Photo by numeric ID
Videos (base: /v1/videos/)
Endpoint
Method
Description
/v1/videos/search?query=...
GET
Full-text search with orientation, size, locale filters
/v1/videos/popular
GET
Trending videos with min_width, min_height, min_duration, max_duration filters
/v1/videos/videos/:id
GET
Single Video by numeric ID
Collections (base: /v1/collections/)
Endpoint
Method
Description
/v1/collections/featured
GET
Editor-curated themed collections
/v1/collections
GET
Your saved collections
/v1/collections/:id
GET
All media in a collection, filterable by type (photos/videos) and sort (asc/desc)
Pagination
All list endpoints accept page (default 1) and per_page (default 15, max 80). Responses include page, per_page, total_results, and optional next_page/prev_page URL strings. The total_results for search endpoints is capped at a high number (e.g. 8000) even when more results exist.
Size filter means different things: for photos, large = 24MP+, medium = 12MP+, small = 4MP+; for videos, large = 4K, medium = Full HD, small = HD.
Video quality field may be null for newer video files — use width/height to determine actual resolution.
Collection IDs are alphanumeric strings (not integers like photo/video IDs).
The deprecated video base URL https://api.pexels.com/videos/ still works but should not be used — use /v1/videos/ instead.
Attribution
Best practice: link to the photo/video page on Pexels and credit the photographer/videographer (e.g. "Photo by John Doe on Pexels"). Use the url field from the response for attribution links.