# Pexels API

> Pexels returns stock photos and videos, available as a workflow and API.

Pexels Search photos returns matching photos and photographer details; it needs a subject query, optionally with orientation or page. Pexels Search videos returns matching videos and creator details; it needs a subject query, optionally with orientation or page.

- Page: https://fous.com/workflows/pexels
- Handle: `@pexels`
- Category: [Media processing](https://fous.com/workflows/category/media)
- Source website: https://pexels.com
- Last verified: Sep 29, 2026
- Fous is not affiliated with Pexels.

## Methods

### Search photos

Operation `search_photos`, version 1. 1 credit per call.

Search free stock photos on Pexels by subject, orientation, and page. Returns up to 80 photos in search order; Pexels may broaden searches with few exact matches.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `page` | integer | no | `2` | Results page, e.g. 2. |
| `query` | string | yes | `"desert landscape"` | What the photo should show, e.g. office teamwork. |
| `max_results` | integer | no | `6` | Most photos to return, e.g. 20. |
| `orientation` | string | no | `"portrait"` | Image orientation, e.g. landscape. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "query"
  ],
  "properties": {
    "page": {
      "type": "integer",
      "default": 1,
      "minimum": 1,
      "description": "Results page, e.g. 2.",
      "x-fous-developer": true,
      "examples": [
        2,
        3,
        1
      ]
    },
    "query": {
      "type": "string",
      "minLength": 1,
      "description": "What the photo should show, e.g. office teamwork.",
      "examples": [
        "desert landscape",
        "office teamwork",
        "coffee shop"
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 20,
      "maximum": 80,
      "minimum": 1,
      "description": "Most photos to return, e.g. 20.",
      "x-fous-developer": true,
      "examples": [
        6,
        5,
        80
      ]
    },
    "orientation": {
      "enum": [
        "any",
        "landscape",
        "portrait",
        "square"
      ],
      "type": "string",
      "default": "any",
      "description": "Image orientation, e.g. landscape.",
      "examples": [
        "portrait",
        "landscape",
        "square"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "page": 2,
      "query": "desert landscape",
      "max_results": 6,
      "orientation": "portrait"
    },
    {
      "query": "office teamwork"
    },
    {
      "page": 3,
      "query": "office teamwork",
      "max_results": 5,
      "orientation": "landscape"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `photos` | array |  | Photos in Pexels search order. |
| `photos[].width` | integer | `4160` | Original photo width in pixels. |
| `photos[].height` | integer | `6240` | Original photo height in pixels. |
| `photos[].photo_id` | integer | `34187676` | Pexels photo ID. |
| `photos[].description` | string or null | `"A solitary tree stands in a wide, arid desert landscape under clear daylight."` | Photo alt text. |
| `photos[].licence_note` | string | `"Free to use under the Pexels License"` | Pexels licence summary. |
| `photos[].photographer` | string or null | `"Cafer SEVİNÇ"` | Photographer name. |
| `photos[].average_colour` | string or null | `"#8E8179"` | Approximate main colour as a hex code. |
| `photos[].photo_page_link` | string | `"https://www.pexels.com/photo/lone-tree-in-vast-desert-landscape-34187676/"` | Photo page on Pexels. |
| `photos[].large_image_link` | string | `"https://images.pexels.com/photos/34187676/pexels-photo-34187676.jpeg?auto=compress&cs=tinysrgb&w=1880"` | Image link about 1880 pixels wide. |
| `photos[].original_image_link` | string | `"https://images.pexels.com/photos/34187676/pexels-photo-34187676.jpeg"` | Original image link. |
| `photos[].photographer_profile_link` | string or null | `"https://www.pexels.com/@cafer-sevi-nc-2150308909/"` | Photographer Pexels profile link. |

**Example input**

```json
{
  "page": 2,
  "query": "desert landscape",
  "max_results": 6,
  "orientation": "portrait"
}
```

**Example output**

```json
{
  "photos": [
    {
      "width": 4160,
      "height": 6240,
      "photo_id": 34187676,
      "description": "A solitary tree stands in a wide, arid desert landscape under clear daylight.",
      "licence_note": "Free to use under the Pexels License",
      "photographer": "Cafer SEVİNÇ",
      "average_colour": "#8E8179",
      "photo_page_link": "https://www.pexels.com/photo/lone-tree-in-vast-desert-landscape-34187676/",
      "large_image_link": "https://images.pexels.com/photos/34187676/pexels-photo-34187676.jpeg?auto=compress&cs=tinysrgb&w=1880",
      "original_image_link": "https://images.pexels.com/photos/34187676/pexels-photo-34187676.jpeg",
      "photographer_profile_link": "https://www.pexels.com/@cafer-sevi-nc-2150308909/"
    },
    {
      "width": 4000,
      "height": 6000,
      "photo_id": 33393969,
      "description": "Captivating view of hanging rock formation in Charyn Canyon, Tamerlik, Kazakhstan.",
      "licence_note": "Free to use under the Pexels License",
      "photographer": "Naimish Verma",
      "average_colour": "#ADACA8",
      "photo_page_link": "https://www.pexels.com/photo/hanging-rock-formation-in-charyn-canyon-kazakhstan-33393969/",
      "large_image_link": "https://images.pexels.com/photos/33393969/pexels-photo-33393969.jpeg?auto=compress&cs=tinysrgb&w=1880",
      "original_image_link": "https://images.pexels.com/photos/33393969/pexels-photo-33393969.jpeg",
      "photographer_profile_link": "https://www.pexels.com/@naimish17/"
    }
  ]
}
```

### Search videos

Operation `search_videos`, version 1. 1 credit per call.

Find free stock videos on Pexels by search words, with creator, duration, preview, and direct video file links. Results follow the order of Pexels video search; up to 80 videos can be collected starting at the selected results page.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `page` | integer | no | `2` | Pexels search page to start from, for example 2. |
| `query` | string | yes | `"city traffic at night"` | What the video should show, for example city traffic at night. |
| `max_results` | integer | no | `26` | Maximum number of videos to return, for example 20. |
| `orientation` | string | no | `"portrait"` | The video frame shape, for example portrait. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "query"
  ],
  "properties": {
    "page": {
      "type": "integer",
      "default": 1,
      "minimum": 1,
      "description": "Pexels search page to start from, for example 2.",
      "x-fous-developer": true,
      "examples": [
        2
      ]
    },
    "query": {
      "type": "string",
      "examples": [
        "city traffic at night"
      ],
      "minLength": 1,
      "description": "What the video should show, for example city traffic at night."
    },
    "max_results": {
      "type": "integer",
      "default": 20,
      "maximum": 80,
      "minimum": 1,
      "description": "Maximum number of videos to return, for example 20.",
      "x-fous-developer": true,
      "examples": [
        26,
        3
      ]
    },
    "orientation": {
      "enum": [
        "any",
        "landscape",
        "portrait",
        "square"
      ],
      "type": "string",
      "default": "any",
      "description": "The video frame shape, for example portrait.",
      "examples": [
        "portrait",
        "square"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "query": "city traffic at night"
    },
    {
      "page": 2,
      "query": "mountain sunrise",
      "max_results": 26,
      "orientation": "portrait"
    },
    {
      "query": "city traffic at night",
      "max_results": 3,
      "orientation": "square"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `videos` | array |  | Matching videos in Pexels search order. |
| `videos[].width` | integer or null | `2160` | Width in pixels of the selected video file. |
| `videos[].height` | integer or null | `2160` | Height in pixels of the selected video file. |
| `videos[].length` | string or null | `"0:06"` | Duration formatted as minutes and seconds, or hours, minutes and seconds. |
| `videos[].video_id` | integer | `34570729` | Pexels video ID. |
| `videos[].description` | string or null | `"Rainy night view through window, capturing blurry city lights and wet streets."` | Video description. |
| `videos[].creator_name` | string or null | `"Teju"` | Name of the video creator. |
| `videos[].licence_note` | string | `"Free to use under the Pexels License"` | Pexels video licence note. |
| `videos[].length_seconds` | integer or null | `6` | Video duration in seconds. |
| `videos[].video_file_link` | string or null | `"https://videos.pexels.com/video-files/34570729/14648269_2160_2160_30fps.mp4"` | Direct link to an HD 1920 × 1080 MP4, or the largest available MP4. |
| `videos[].video_page_link` | string | `"https://www.pexels.com/video/rainy-night-street-scene-through-window-34570729/"` | Pexels page for this video. |
| `videos[].preview_image_link` | string or null | `"https://images.pexels.com/videos/34570729/pexels-photo-34570729.jpeg?auto=compress&cs=tinysrgb&w=1440"` | Video preview image link. |
| `videos[].creator_profile_link` | string or null | `"https://www.pexels.com/@teju-215592370/"` | Link to the creator’s Pexels profile. |

**Example input**

```json
{
  "query": "city traffic at night",
  "max_results": 3,
  "orientation": "square"
}
```

**Example output**

```json
{
  "videos": [
    {
      "width": 2160,
      "height": 2160,
      "length": "0:06",
      "video_id": 34570729,
      "description": "Rainy night view through window, capturing blurry city lights and wet streets.",
      "creator_name": "Teju",
      "licence_note": "Free to use under the Pexels License",
      "length_seconds": 6,
      "video_file_link": "https://videos.pexels.com/video-files/34570729/14648269_2160_2160_30fps.mp4",
      "video_page_link": "https://www.pexels.com/video/rainy-night-street-scene-through-window-34570729/",
      "preview_image_link": "https://images.pexels.com/videos/34570729/pexels-photo-34570729.jpeg?auto=compress&cs=tinysrgb&w=1440",
      "creator_profile_link": "https://www.pexels.com/@teju-215592370/"
    },
    {
      "width": 1440,
      "height": 1440,
      "length": "0:24",
      "video_id": 20075716,
      "description": "A cute bulldog dressed warmly, outdoors at night in winter.",
      "creator_name": "누나 오봉",
      "licence_note": "Free to use under the Pexels License",
      "length_seconds": 24,
      "video_file_link": "https://videos.pexels.com/video-files/20075716/20075716-uhd_1440_1440_30fps.mp4",
      "video_page_link": "https://www.pexels.com/video/20075716/",
      "preview_image_link": "https://images.pexels.com/videos/20075716/---20075716.jpeg?auto=compress&cs=tinysrgb&w=1440",
      "creator_profile_link": "https://www.pexels.com/@936114228/"
    }
  ]
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@pexels",
  "visibility": "public",
  "operation": "search_photos",
  "version": 1,
  "input": {
    "page": 2,
    "query": "desert landscape",
    "max_results": 6,
    "orientation": "portrait"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@pexels\",\n  \"visibility\": \"public\",\n  \"operation\": \"search_photos\",\n  \"version\": 1,\n  \"input\": {\n    \"page\": 2,\n    \"query\": \"desert landscape\",\n    \"max_results\": 6,\n    \"orientation\": \"portrait\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@pexels",
  "visibility": "public",
  "operation": "search_photos",
  "version": 1,
  "input": {
    "page": 2,
    "query": "desert landscape",
    "max_results": 6,
    "orientation": "portrait"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@pexels","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## Use cases

- Find photos for a campaign concept
- Source video clips for a presentation
- Compare photo and video options by orientation
- Review creator and licence details before selecting media
- Collect image links for a content brief

## FAQ

### Is Fous affiliated with Pexels?

No. Fous is not affiliated with Pexels. This workflow reads the public pexels.com website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a Pexels account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from pexels.com when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 29, 2026.

### How can I find photos of a subject?

Search photos takes a subject query and returns matching photos with descriptions, photographer names, and image links.

### How can I find videos about a subject?

Search videos takes a subject query and returns matching videos with creator names, durations, previews, and video file links.

### Can I filter results by orientation?

Yes. Search photos and Search videos both accept an orientation to find results in the image or video frame shape you want.

## Related

- [Unsplash API](https://fous.com/workflows/unsplash.md): Discover photos shared on Unsplash.
- [Wikimedia Commons API](https://fous.com/workflows/wikimedia-commons.md): Discover freely licensed photos and other images from Wikimedia Commons.
- [Pinterest API](https://fous.com/workflows/pinterest.md): Pinterest helps people discover and save visual ideas, returning public search results from the first page and visible profile boards, with monthly views only when shown.
- [Google Search API](https://fous.com/workflows/google-search.md): Google Search returns public web, image, job, event, related-question, and autocomplete results in Google’s order, with answers and details when available; results may be fewer, omit information, or be empty.
- [YouTube API](https://fous.com/workflows/youtube.md): YouTube returns public video, caption, comment, channel and upload details, plus the latest weekly Top Songs chart; inferred dates and some counts may be approximate.
- [Vimeo API](https://fous.com/workflows/vimeo.md): Watch and share videos on Vimeo.
- [Dailymotion API](https://fous.com/workflows/dailymotion.md): Watch and share videos on Dailymotion.
- [Google Lens API](https://fous.com/workflows/google-lens.md): Identify images and find visually similar pages online.
- [All Media processing workflows](https://fous.com/workflows/category/media)
