APIs / Search engines / Pexels

1 credit per call2 endpoints17 datapointsChecked working 6 Dec 2026

Pexels API

Pexels API for free stock photo search, and photo details with sizes, colours, tags, camera settings and view counts as JSON. 1 credit per successful call.

Pexels
GET/v1/pexels/search?query=mountain+lake
{
  "success": true,
  "data": {
    "query": "mountain lake",
    "items": [
      {
        "id": "41238365",
        "title": "Scenic Autumn View of Tovel Lake in Italy",
        "description": "Breathtaking autumn landscape at Tovel Lake with mountain reflections in Trentino, Italy.",
        "alt": "Breathtaking autumn landscape at Tovel Lake with mountain reflections in Trentino, Italy.",
        "width": 4640,
        "height": 6960,
        "aspect_ratio": 0.6666666666666666,
        "average_color": "#757263",
        "colors": [
          "#1b211d",
          "#626461",
          "#a49689"
        ],
        "tags": [
          "Alps",
          "Alps Mountains",
          "Autumn"
        ],
        "license": "Pexels",
        "license_url": "https://www.pexels.com/license/",
        "photographer": {
          "name": "Gio Spigo",
          "url": "https://www.pexels.com/@gio-spigo-276311867/"
        },
        "image": {
          "small": "https://images.pexels.com/photos/41238365/pexels-photo-41238365.jpeg?auto=compress&cs=tinysrgb&h=130",
          "medium": "https://images.pexels.com/photos/41238365/pexels-photo-41238365.jpeg?auto=compress&cs=tinysrgb&w=750",
          "large": "https://images.pexels.com/photos/41238365/pexels-photo-41238365.jpeg?auto=compress&cs=tinysrgb&w=1440",
          "original": "https://images.pexels.com/photos/41238365/pexels-photo-41238365.jpeg?cs=srgb&dl=pexels-gio-spigo-276311867-41238365.jpg&fm=jpg"
        },
        "created_at": "2026-11-24T09:34:50.000Z",
        "published_at": "2026-11-24T11:00:42.238Z",
        "url": "https://www.pexels.com/photo/scenic-autumn-view-of-tovel-lake-in-italy-41238365/"
      },
      {
        "id": "41238373",
        "title": "Serene Autumn Landscape at Lake Tovel",
        "description": "Scenic view of Lake Tovel in Trentino, Italy with autumn colors and misty mountains.",
        "alt": "Scenic view of Lake Tovel in Trentino, Italy with autumn colors and misty mountains.",
        "width": 4640,
        "height": 6960,
        "aspect_ratio": 0.6666666666666666,
        "average_color": "#615e57",
        "colors": [
          "#121615",
          "#555859",
          "#8b827b"
        ],
        "tags": [
          "Alpine Lake",
          "Alps",
          "Autumn"
        ],
        "license": "Pexels",
        "license_url": "https://www.pexels.com/license/",
        "photographer": {
          "name": "Gio Spigo",
          "url": "https://www.pexels.com/@gio-spigo-276311867/"
        },
        "image": {
          "small": "https://images.pexels.com/photos/41238373/pexels-photo-41238373.jpeg?auto=compress&cs=tinysrgb&h=130",
          "medium": "https://images.pexels.com/photos/41238373/pexels-photo-41238373.jpeg?auto=compress&cs=tinysrgb&w=750",
          "large": "https://images.pexels.com/photos/41238373/pexels-photo-41238373.jpeg?auto=compress&cs=tinysrgb&w=1440",
          "original": "https://images.pexels.com/photos/41238373/pexels-photo-41238373.jpeg?cs=srgb&dl=pexels-gio-spigo-276311867-41238373.jpg&fm=jpg"
        },
        "created_at": "2026-11-24T09:34:51.000Z",
        "published_at": "2026-11-24T11:00:42.238Z",
        "url": "https://www.pexels.com/photo/serene-autumn-landscape-at-lake-tovel-41238373/"
      },
      {
        "id": "27667695",
        "title": "Starting Point - Oeschinensee Lake Hike",
        "description": "Turquoise waters of Oeschinensee Lake amidst the Swiss Alps, Kandersteg. Ideal travel spot.",
        "alt": "Turquoise waters of Oeschinensee Lake amidst the Swiss Alps, Kandersteg. Ideal travel spot.",
        "width": 2700,
        "height": 4800,
        "aspect_ratio": 0.5625,
        "average_color": "#7b979b",
        "colors": [
          "#000000",
          "#008b8b",
          "#556b2f"
        ],
        "tags": [
          "4k Wallpaper",
          "Alpine",
          "Alpine Lake"
        ],
        "license": "Pexels",
        "license_url": "https://www.pexels.com/license/",
        "photographer": {
          "name": "Nanda Gopal Lakshman",
          "url": "https://www.pexels.com/@nanda-gopal-lakshman-1548481679/"
        },
        "image": {
          "small": "https://images.pexels.com/photos/27667695/pexels-photo-27667695.jpeg?auto=compress&cs=tinysrgb&h=130",
          "medium": "https://images.pexels.com/photos/27667695/pexels-photo-27667695.jpeg?auto=compress&cs=tinysrgb&w=750",
          "large": "https://images.pexels.com/photos/27667695/pexels-photo-27667695.jpeg?auto=compress&cs=tinysrgb&w=1440",
          "original": "https://images.pexels.com/photos/27667695/pexels-photo-27667695.jpeg?cs=srgb&dl=pexels-nanda-gopal-lakshman-1548481679-27667695.jpg&fm=jpg"
        },
        "created_at": "2024-08-09T14:20:44.000Z",
        "published_at": "2024-08-10T16:00:28.667Z",
        "url": "https://www.pexels.com/photo/starting-point-oeschinensee-lake-hike-27667695/"
      }
    ],
    "total_photos": 342912,
    "related_searches": [
      "alpine lake",
      "mountain river",
      "forest lake"
    ],
    "pagination": {
      "current_page": 1,
      "per_page": 24,
      "total_items": 10000,
      "total_pages": 334,
      "has_more": true
    }
  },
  "meta": {
    "request_id": "req_29d28ec8841b4e98ab8d45420e78200a",
    "credits_charged": 1,
    "credits_remaining": 170
  }
}
200 OKJSONX-Credits-Used: 1
Recorded from our API and shortened.

Sample data

What one call returns

A recorded run of search: the fields and shapes you will get, shortened to 3 items.

#idstringtitlestringdescriptionstringaltstringwidthintegerheightintegeraspect_rationumberaverage_colorstringcolorsstring[]tagsstring[]licensestringlicense_urlurlphotographerobjectimageobjectcreated_atstringpublished_atstringurlurl
141238365Scenic Autumn View of Tovel Lake in ItalyBreathtaking autumn landscape at Tovel Lake with mountain reflections in Trentino, Italy.Breathtaking autumn landscape at Tovel Lake with mountain reflections in Trentino, Italy.464069600.6666666666666666#757263[3 items][3 items]Pexelshttps://www.pexels.com/license/{2 fields}{4 fields}2026-11-24T09:34:50.000Z2026-11-24T11:00:42.238Zhttps://www.pexels.com/photo/scenic-autumn-view-of-tovel-lake-in-italy-41238365/
241238373Serene Autumn Landscape at Lake TovelScenic view of Lake Tovel in Trentino, Italy with autumn colors and misty mountains.Scenic view of Lake Tovel in Trentino, Italy with autumn colors and misty mountains.464069600.6666666666666666#615e57[3 items][3 items]Pexelshttps://www.pexels.com/license/{2 fields}{4 fields}2026-11-24T09:34:51.000Z2026-11-24T11:00:42.238Zhttps://www.pexels.com/photo/serene-autumn-landscape-at-lake-tovel-41238373/
327667695Starting Point - Oeschinensee Lake HikeTurquoise waters of Oeschinensee Lake amidst the Swiss Alps, Kandersteg. Ideal travel spot.Turquoise waters of Oeschinensee Lake amidst the Swiss Alps, Kandersteg. Ideal travel spot.270048000.5625#7b979b[3 items][3 items]Pexelshttps://www.pexels.com/license/{2 fields}{4 fields}2024-08-09T14:20:44.000Z2024-08-10T16:00:28.667Zhttps://www.pexels.com/photo/starting-point-oeschinensee-lake-hike-27667695/

Recorded from our API · 3 items shown · 17 datapoints per itemGET /v1/pexels/search?query=mountain+lake

17 datapoints

Identity

  • idstring
  • titlestring

Contact

  • license_urlurl
  • urlurl

Reputation

  • photographerobject
  • imageobject

Other

  • descriptionstring
  • altstring
  • widthinteger
  • heightinteger
  • aspect_rationumber
  • average_colorstring
  • colorsstring[]
  • tagsstring[]
  • licensestring
  • created_atstring
  • published_atstring

Playground

Run this API

cURLshell
curl "https://api.perceptlayer.com/v1/pexels/search?query=mountain+lake" \
  -H "X-API-Key: $API_KEY"

Pexels · 2 endpoints

Endpoints

Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.

EndpointRequired parametersReturnsCost
GET/v1/pexels/photo
none+2 optional
idtitledescriptionaltwidthheight+15 more
1 credit
GET/v1/pexels/search
query+1 optional
itemsrelated_searchespagination
1 credit

Overview

About the Pexels API

What you can get

The Pexels API returns free Pexels stock photos and their details as JSON through 2 endpoints.

  • Search: search takes a query (for example mountain lake) and page (1 to 20, 24 photos a page).
  • Photos: photo takes a numeric photo id or a pexels.com photo url, in any language.

The recorded search for "mountain lake" returns items, each with id, title, description, alt, width, height, aspect_ratio, average_color, colors, tags, license, license_url, photographer, image (small, medium, large and original links), created_at, published_at and url. It also returns total_photos (342,912 in that recording), related_searches and pagination. photographer holds the photographer's display name and profile link only. photo adds camera (make, model, aperture, focal length, ISO and when it was taken), file_size, stats (views, downloads and likes) and similar photos. Photo 2014422, taken on an iPhone 6s, had 1,742,390 views, 610 downloads and 62 likes.

How a call works

Search, then look up: GET /v1/pexels/search?query=mountain%20lake with your key in the X-API-Key header returns each photo's id; photo takes it, for example GET /v1/pexels/photo?id=2014422. Check pagination.has_more before asking for the next page; pages stop at 20, so a search returns up to 480 photos. Answers come from a cache for up to an hour, so view and download counts can be up to an hour old. Every successful call costs 1 credit; failed calls cost nothing.

Search enginesJSONRESTMCP

More search engines APIs

Use cases

Find free photos for a blog post, landing page or slide deck by keyword

Use the Pexels API to find free photos for a blog post, landing page or slide deck by keyword

Pick images that match a palette using `average_color` and `colors`

Use the Pexels API to pick images that match a palette using `average_color` and `colors`

Fill in alt text from each photo's `alt` and `description`

Use the Pexels API to fill in alt text from each photo's `alt` and `description`

Choose the right size for a layout with `width`, `height` and the four image links

Use the Pexels API to choose the right size for a layout with `width`, `height` and the four image links

FAQ

Questions

How much does the Pexels API cost?

Each successful call costs one credit, and each search page of 24 photos is one call. New accounts get free credits to start, and credit packs bring the price down as you scale.

Can I use the photos for free?

The photos are under the Pexels licence, given in `license` and `license_url` on each photo. Read it for what it allows. Crediting the photographer with `photographer.name` and `photographer.url` is a good habit.

What does it return about the photographer?

Only their display name and a link to their Pexels profile, in `photographer`. It returns no email address or other contact details.

Do I need a Pexels account?

No. You call this Pexels API with your Perceptlayer key in the `X-API-Key` header, with no Pexels account or Pexels API key.

Is this the official Pexels API?

No. Perceptlayer is an independent service and is not affiliated with Pexels. It returns Pexels data as JSON with a Perceptlayer key, so there is no Pexels developer account, app review or partner approval to get first. It only reads data: if Pexels has an official API and you need to act on your own Pexels account, such as posting, managing orders or reading private data, use that one.

Should I build a Pexels scraper instead?

You can, but a Pexels scraper is code you maintain: page changes break it, requests get blocked, and Pexels's terms govern how you collect data. The Pexels API gives you 2 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first.

Try the Pexels API with 100 free credits

No credit card. Failed calls are never billed.