pexels.com APIpexels.com ↗
Access Pexels stock photos and videos via API. Search by keyword, filter by color/orientation, browse trending content, photographer galleries, and challenges.
curl -X GET 'https://api.parse.bot/scraper/f2821378-6172-4989-855b-48dce77e55be/search_photos?page=1&query=nature&per_page=2' \ -H 'X-API-Key: $PARSE_API_KEY'
Search for photos on Pexels by keyword. Returns paginated results with optional filters for color, orientation, and size.
| Param | Type | Description |
|---|---|---|
| page | integer | Page number for pagination |
| size | string | Filter by size: large, medium, small |
| color | string | Filter by dominant color (e.g. 'red', 'blue', 'green', 'orange', 'yellow', 'black', 'white') |
| queryrequired | string | Search keyword (e.g. 'nature', 'office', 'sunset') |
| per_page | integer | Number of results per page |
| orientation | string | Filter by orientation: landscape, portrait, square |
{
"type": "object",
"fields": {
"data": "array of photo objects with id, type, attributes (title, description, width, height, user, tags, image URLs)",
"pagination": "object with current_page, total_pages, total_results"
},
"sample": {
"data": {
"data": [
{
"id": "12377231",
"type": "photo",
"attributes": {
"id": 12377231,
"tags": [
"botanical",
"forest",
"nature"
],
"user": {
"id": 175964361,
"last_name": "Lysov",
"first_name": "Danil"
},
"image": {
"large": "https://images.pexels.com/photos/12377231/pexels-photo-12377231.jpeg?auto=compress&cs=tinysrgb&w=1440",
"small": "https://images.pexels.com/photos/12377231/pexels-photo-12377231.jpeg?auto=compress&cs=tinysrgb&h=130",
"medium": "https://images.pexels.com/photos/12377231/pexels-photo-12377231.jpeg?auto=compress&cs=tinysrgb&w=750"
},
"title": "A Green Trees in the Forest",
"width": 1965,
"height": 3488,
"description": "Dense greenery in a tranquil forest setting with tall trees and natural light."
}
}
],
"pagination": {
"total_pages": 4000,
"current_page": 1,
"total_results": 10000
}
},
"status": "success"
}
}About the pexels.com API
This API exposes 8 endpoints covering Pexels stock photos and videos, including keyword search, trending feeds, photographer galleries, and challenge listings. The search_photos endpoint accepts filters for color, orientation, and size and returns paginated photo objects with full image URLs, tags, dimensions, and uploader metadata. Video search follows the same pattern and includes direct MP4 source links.
Search and Filter
The search_photos and search_videos endpoints both accept a required query string and optional filters: orientation (landscape, portrait, square), size (large, medium, small), and — for photos — color (red, blue, green, orange, yellow, black, white). Both return a data array of media objects with id, type, attributes (title, description, width, height, user, tags, and URLs), plus a pagination object carrying current_page, total_pages, and total_results.
Media Details and Photographer Galleries
Use get_media_details with a numeric media_id (sourced from any search result) to retrieve the full attribute set for a single photo or video, including all tags, translation data, and every available image or video URL. The get_photographer_gallery endpoint accepts a user_id (the user.id field in any search result) and returns that photographer's full upload history in recency order, paginated with per_page and page controls.
Trending Feeds and Cursor Pagination
get_trending_photos and get_trending_videos return the content currently featured on Pexels. These endpoints use cursor-based pagination rather than page numbers — the response pagination object includes a cursor string and a more_data boolean. Pass the cursor value as the seed parameter to retrieve the next page. Video results include file source URLs and preview URLs.
Suggestions and Challenges
get_search_suggestions takes a query prefix (e.g. "mount") and returns an attributes object with the original prefix and an array of autocomplete suggestions. get_challenges lists active and past Pexels photo/video challenges with title, short_description, prize_title, end_date, medium_type, and media_count, filtered by state (active or past).
- Building a stock media search UI with keyword, color, and orientation filtering via
search_photos - Populating a trending content carousel using cursor-paginated results from
get_trending_photos - Displaying a photographer's full portfolio by fetching their gallery with
get_photographer_gallery - Embedding video backgrounds by retrieving MP4 source URLs from
search_videosorget_trending_videos - Implementing search autocomplete using prefix-based suggestions from
get_search_suggestions - Listing active creative challenges and their prize details using
get_challengeswith state=active - Fetching full metadata for a known media asset by ID using
get_media_detailsfor tags and dimensions
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 250 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Pexels have an official developer API?+
What does the `search_photos` color filter actually accept?+
color parameter accepts one of seven named values: red, blue, green, orange, yellow, black, or white. It filters results by the dominant color of the photo. Hex codes and other named colors are not supported by this parameter.How does pagination differ between search endpoints and trending endpoints?+
search_photos, search_videos, get_photographer_gallery, get_challenges) use standard page-number pagination with page, per_page, current_page, total_pages, and total_results. Trending endpoints (get_trending_photos, get_trending_videos) use cursor-based pagination: pass the cursor string from the previous response's pagination object as the seed input to retrieve the next batch, and check more_data to know if additional pages exist.Does the API return individual video file resolutions or quality variants?+
src URL and a preview_src URL per video object. Separate resolution variants (e.g. 1080p, 720p) are not enumerated as distinct fields in the current response shape. You can fork this API on Parse and revise it to add an endpoint that returns per-resolution file variants if your use case requires them.