Pexels API

To get access to our API write us an email to [email protected]. Please explain briefly how and where you want to integrate our photos. We're excited to hear about your idea!

Guidelines

  • Whenever you are doing an API request make sure to show a prominent link to our website. You can use a text link (e.g. "Photos provided by Pexels") or a link with our logo (Download our logo in white or black).
  • Do not copy core functionality of Pexels.
  • Do not abuse the API. The API is rate-limited to 400 requests per hour and 20,000 requests per month. (For higher limits contact us)

Documentation

Authorization

After you received your API key you can start using this API. To get access you have to add a HTTP Authorization header to each of your requests:

Authorization: YOUR_API_KEY

Search Photos

http://api.pexels.com/v1/search?query=example+query&per_page=15&page=1
query Get photos related to this query. (required)
per_page Defines the number of results per page. (optional, default: 15)
page Defines the number of the page. (optional, default: 1)

If the request is successful, the response body will be a JSON with the following data:

{
  page: 1,
  per_page: 15,
  total_results: 236,
  url: "https://www.pexels.com/search/example%20query/",
  next_page: "http://api.pexels.com/v1/search/?page=2&per_page=15&query=example+query"
  photos: [{
    width: 1000,
    height: 1000,
    url: "https://www.pexels.com/photo/12345",
    photographer: "Name",
    src: {
      original: "https://*.jpg",
      large: "https://*.jpg",
      medium: "https://*.jpg",
      small: "https://*.jpg",
      portrait: "https://*.jpg",
      landscape: "https://*.jpg",
      tiny: "https://*.jpg"
    }, (NEXT PHOTOS)]
  }
}

The next_page/prev_page attributes are only present if it's not the last/first page.

Get Popular Photos

http://api.pexels.com/v1/popular?per_page=15&page=1

For more information have a look at the search method above.

Image formats

original The size of the original image is given with the attributes width and height.
large This image has a maximum width of 940px and a maximum height of 650px. It has the aspect ratio of the original image.
medium This image has a height of 350px and a flexible width. It has the aspect ratio of the original image.
small This image has a height of 130px and a flexible width. It has the aspect ratio of the original image.
portrait This image has a width of 800px and a height of 1200px.
landscape This image has a width of 1200px and height of 627px.
tiny This image has a width of 280px and height of 200px.

Try it out

curl -H "Authorization: YOUR_API_KEY" "http://api.pexels.com/v1/search?query=people"

Disclaimer

We don't have an uptime or availability guarantee. And some features may change in the future.

Contact

If you have any question or feedback write us to [email protected].

Wähle Deine Sprache: En English De Deutsch