Pexels API

If your company wants to get access to our API, you can request access here. We're excited to hear about your idea!

Guidelines

  • Whenever you are doing an API request make sure to show a prominent link to Pexels. 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).
  • Always credit our photographers when possible (e.g. "Photo by John Doe on Pexels" with a link to the photo page on Pexels).
  • Do not copy core functionality of Pexels.
  • Do not abuse the API. The API is rate-limited to 200 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

https://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, max: 40)
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: "https://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",
      large2x: "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.

Curated photos

https://api.pexels.com/v1/curated?per_page=15&page=1

We add at least one new photo per hour to our curated list so that you get a changing selection of trending photos. For more information about the request parameters and response structure have a look at the search method above.

Get a photo

https://api.pexels.com/v1/photos/:id

If you have the id of a photo, you can retrieve the data of it.

Search videos

https://api.pexels.com/videos/search?query=example+query&per_page=15&page=1

Popular videos

https://api.pexels.com/videos/popular?per_page=15&page=1

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.
large2x This image has a maximum width of 1880px and a maximum height of 1300px. 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.

Request statistics

To see how many requests you have left in this current period, you can look at the HTTP response header called "X-Ratelimit-Remaining" that comes with every response you receive.

Try it out

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

Unofficial API wrappers

Disclaimer

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

Contact

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

Choose your language: English Deutsch