What it does
The Pexels API lets you search the Pexels library of free stock photos and videos by keyword, orientation, size and colour, and get curated and popular collections, for example to add background images to a website or app. Each result comes with links to several image sizes and the name and page of the photographer. Responses are JSON; the API key goes in the Authorization header. Free with an API key, limited to 200 requests per hour and 20,000 per month, and apps must show a link to Pexels and credit photographers where possible. New API keys can currently not be requested.
At a glance
- API key
- Needed, free · More APIs with a free key
- Pricing
- Free with an API key, limited to 200 requests per hour and 20,000 per month, and apps must show a link to Pexels and credit photographers where possible.
- From the browser
- Yes (CORS)
- Formats
- JSON
- Interface
- REST, HTTP-GET
- Provider
- pexels.com
More information: https://www.pexels.com/api/documentation/
Compare: Unsplash API vs Pexels API · Pexels API vs Pixabay API
Is this your service? Show that it is listed
Put this badge on your website or in your README; it links to this page. About the badge
Example request
curl
curl 'https://api.pexels.com/v1/search?query=london&per_page=1' \
-H 'Authorization: YOUR_API_KEY'
JavaScript
const response = await fetch("https://api.pexels.com/v1/search?query=london&per_page=1", {
headers: {
"Authorization": "YOUR_API_KEY",
},
});
const data = await response.json();
console.log(data);
Python
import requests
response = requests.get(
"https://api.pexels.com/v1/search?query=london&per_page=1",
headers={
"Authorization": "YOUR_API_KEY",
},
timeout=30,
)
print(response.json())
Replace YOUR_API_KEY with your own key. The JavaScript works in a web page as well as in Node.js 18 or newer.