Skip to content
pexels-media logo

Pexels Media Sourcing

pexels-media

Source royalty-free images and videos from Pexels API for design, placeholders, or content. Supports search, curated/popular content, collections, multiple resolutions, and ALWAYS creates detailed sidecar metadata files.

nicepkg/ai-workflow0installs284stars

SKILL.md

Full skill instructions

Pexels Media Sourcing

Source high-quality, royalty-free images and videos from Pexels for design work, placeholders, or content creation.

Prerequisites

This skill requires the PEXELS_API_KEY environment variable to be set.

# Check if API key is available
echo $PEXELS_API_KEY

If not set, obtain a free API key from Pexels API.

API Base URLs

  • Photos: https://api.pexels.com/​v1/
  • Videos: https://api.pexels.com/​videos/

Authentication

All requests require the Authorization header:

curl -H "Authorization: $PEXELS_API_KEY" "https://api.pexels.com/​v1/​search?query=nature"

Photo Endpoints

Search Photos

curl -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​v1/​search?query=QUERY&orientation=ORIENTATION&size=SIZE&color=COLOR&locale=LOCALE&page=PAGE&per_page=PER_PAGE"

Parameters:

ParameterRequiredValues
queryYesSearch term
orientationNolandscape, portrait, square
sizeNolarge (24MP), medium (12MP), small (4MP)
colorNored, orange, yellow, green, turquoise, blue, violet, pink, brown, black, gray, white, or hex code (e.g., #ffffff)
localeNoen-US, pt-BR, es-ES, de-DE, fr-FR, ja-JP, zh-CN, ko-KR, etc.
pageNoPage number (default: 1)
per_pageNoResults per page (default: 15, max: 80)

Curated Photos

Trending photos curated by the Pexels team (updated hourly):

curl -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​v1/​curated?page=1&per_page=15"

Get Photo by ID

curl -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​v1/​photos/​PHOTO_ID"

Video Endpoints

Search Videos

curl -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​videos/​search?query=QUERY&orientation=ORIENTATION&size=SIZE&min_width=MIN_WIDTH&min_height=MIN_HEIGHT&min_duration=MIN_DURATION&max_duration=MAX_DURATION&page=PAGE&per_page=PER_PAGE"

Additional Video Parameters:

ParameterDescription
min_widthMinimum width in pixels
min_heightMinimum height in pixels
min_durationMinimum duration in seconds
max_durationMaximum duration in seconds

Popular Videos

curl -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​videos/​popular?min_width=1920&min_duration=10&max_duration=60&page=1&per_page=15"

Get Video by ID

curl -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​videos/​videos/​VIDEO_ID"

Collections

Featured Collections

curl -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​v1/​collections/​featured?page=1&per_page=15"

Collection Media

curl -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​v1/​collections/​COLLECTION_ID?type=TYPE&page=1&per_page=15"

Type parameter: photos, videos, or omit for both.

Photo Sizes Available

When downloading photos, these sizes are available in the API response:

KeyDescription
originalOriginal size uploaded by photographer
large2xWidth 940px, height doubled
largeWidth 940px
mediumHeight 350px
smallHeight 130px
portraitWidth 800px, height 1200px
landscapeWidth 1200px, height 627px
tinyWidth 280px, height 200px

Video Files Available

Videos include multiple quality files in the response:

QualityTypical Resolution
hd1280x720
sd640x360
hlsAdaptive streaming
VariousFull HD, 4K when available

MANDATORY: Sidecar Metadata Files

CRITICAL REQUIREMENT: For EVERY downloaded file, you MUST create a sidecar metadata file.

Sidecar File Naming

For a downloaded file mountain-sunset.jpg, create mountain-sunset.jpg.meta.json.

Photo Sidecar Content

{
  "source": "pexels",
  "type": "photo",
  "id": 12345,
  "url": "https://www.pexels.com/​photo/​12345/",
  "download_url": "https://images.pexels.com/​photos/​12345/​pexels-photo-12345.jpeg",
  "downloaded_size": "large",
  "width": 1920,
  "height": 1080,
  "photographer": "John Doe",
  "photographer_url": "https://www.pexels.com/​@johndoe",
  "photographer_id": 67890,
  "avg_color": "#7E5835",
  "alt": "Brown mountain during sunset",
  "license": "Pexels License - Free for personal and commercial use",
  "attribution": "Photo by John Doe on Pexels",
  "attribution_html": "<a href=\"https://www.pexels.com/​photo/​12345/\">Photo</​a> by <a href=\"https://www.pexels.com/​@johndoe\">John Doe</​a> on <a href=\"https://www.pexels.com\">Pexels</​a>",
  "downloaded_at": "2025-12-02T14:30:00Z",
  "api_response": {
    // Full original API response for this photo
  }
}

Video Sidecar Content

{
  "source": "pexels",
  "type": "video",
  "id": 12345,
  "url": "https://www.pexels.com/​video/​12345/",
  "download_url": "https://videos.pexels.com/​video-files/​12345/​...",
  "downloaded_quality": "hd",
  "width": 1920,
  "height": 1080,
  "duration": 30,
  "user": {
    "id": 67890,
    "name": "John Doe",
    "url": "https://www.pexels.com/​@johndoe"
  },
  "video_files": [
    {
      "id": 1,
      "quality": "hd",
      "file_type": "video/​mp4",
      "width": 1920,
      "height": 1080,
      "link": "https://..."
    }
  ],
  "video_pictures": [
    {
      "id": 1,
      "picture": "https://...",
      "nr": 0
    }
  ],
  "license": "Pexels License - Free for personal and commercial use",
  "attribution": "Video by John Doe on Pexels",
  "downloaded_at": "2025-12-02T14:30:00Z",
  "api_response": {
    // Full original API response for this video
  }
}

Download Workflow

1. Search and Select

# Search for photos
RESPONSE=$(curl -s -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​v1/​search?query=office+workspace&orientation=landscape&per_page=5")

# Parse and display results
echo "$RESPONSE" | jq '.photos[] | {id, photographer, alt, url: .src.large}'

2. Download with Sidecar

# Get photo details
PHOTO_ID=12345
PHOTO_DATA=$(curl -s -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​v1/​photos/​$PHOTO_ID")

# Extract download URL (choose size)
DOWNLOAD_URL=$(echo "$PHOTO_DATA" | jq -r '.src.large')
FILENAME="pexels-$PHOTO_ID-large.jpg"

# Download the image
curl -L -o "$FILENAME" "$DOWNLOAD_URL"

# Create sidecar metadata (MANDATORY)
echo "$PHOTO_DATA" | jq '{
  source: "pexels",
  type: "photo",
  id: .id,
  url: .url,
  download_url: .src.large,
  downloaded_size: "large",
  width: .width,
  height: .height,
  photographer: .photographer,
  photographer_url: .photographer_url,
  photographer_id: .photographer_id,
  avg_color: .avg_color,
  alt: .alt,
  license: "Pexels License - Free for personal and commercial use",
  attribution: ("Photo by " + .photographer + " on Pexels"),
  downloaded_at: (now | todate),
  api_response: .
}' > "$FILENAME.meta.json"

Rate Limits

  • Default: 200 requests/​hour, 20,000 requests/​month
  • Check response headers for current limits:
    • X-Ratelimit-Limit
    • X-Ratelimit-Remaining
    • X-Ratelimit-Reset

Attribution Best Practices

While not legally required by the Pexels license, attribution is encouraged:

  • Minimal: "Photo by [Photographer] on Pexels"
  • With link: "Photo by Photographer on Pexels"
  • HTML: Use the attribution_html from the sidecar file

Example Use Cases

Placeholder Images for UI Design

# Get 5 abstract/​minimal images for placeholders
curl -s -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​v1/​search?query=minimal+abstract&orientation=square&size=small&per_page=5"

Hero Background Video

# Find short, wide landscape videos
curl -s -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​videos/​search?query=nature+aerial&orientation=landscape&min_width=1920&min_duration=5&max_duration=15"

Product Photography Backgrounds

# Search for clean, neutral backgrounds
curl -s -H "Authorization: $PEXELS_API_KEY" \
  "https://api.pexels.com/​v1/​search?query=white+background+texture&color=white&size=large"

Checklist

When using this skill:

  • Verify PEXELS_API_KEY is set
  • Choose appropriate endpoint (search, curated, popular, collection)
  • Apply relevant filters (orientation, size, color, duration)
  • Select appropriate resolution for use case
  • Download file to appropriate location
  • CREATE SIDECAR METADATA FILE (mandatory)
  • Consider attribution in final use

References

More skills from nicepkg

thumbnail-concept-generator logo
nicepkg/ai-workflow

thumbnail-concept-generator

Generate thumbnail concepts and ideas for YouTube, TikTok, and other video platforms. Creates detailed visual briefs with composition, text, colors, and emotion suggestions. Use when planning thumbnails, improving CTR, or briefing designers.

284 0
View
font-pairing-suggester logo
nicepkg/ai-workflow

font-pairing-suggester

Recommend font combinations for different use cases. Provide Google Fonts alternatives to premium fonts with hierarchy examples.

284 0
View
pptx logo
nicepkg/ai-workflow

pptx

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

284 0
View
resource-scout logo
nicepkg/vsync

resource-scout

Search and discover Claude Code skills and MCP servers from marketplaces, GitHub repositories, and registries. Use when (1) user asks to find skills for a specific task, (2) looking for MCP servers to connect external tools, (3) user mentions "find skill", "search MCP", "discover tools", or "what skills exist for X", (4) before creating a custom skill to check if one already exists.

62 0
View
youtube-transcript logo
nicepkg/ai-workflow

youtube-transcript

Download YouTube video transcripts when user provides a YouTube URL or asks to download/get/fetch a transcript from YouTube. Also use when user wants to transcribe or get captions/subtitles from a YouTube video.

284 0
View
youtube-seo-optimizer logo
nicepkg/ai-workflow

youtube-seo-optimizer

Optimize YouTube videos for search and discovery. Generates SEO-optimized titles, descriptions, tags, hashtags, and chapters. Includes keyword research and competitor analysis. Use when publishing videos, improving discoverability, or optimizing existing content.

284 0
View
presentation-design-enhancer logo
nicepkg/ai-workflow

presentation-design-enhancer

Transform text-heavy slides into visual storytelling. Suggest layout improvements, icon usage, and data visualization.

284 0
View
nano-banana-pro logo
nicepkg/ai-workflow

nano-banana-pro

Generate images using Google's Nano Banana Pro (gemini-3-pro-image-preview). Accepts text prompts and optionally images (for editing/transformation) as INPUT. Returns generated IMAGES as OUTPUT. Use when user asks to create, generate, edit, or draw images, infographics, visualizations, diagrams, charts, or illustrations. Excellent for data-accurate infographics and text rendering.

284 0
View
skill-creator logo
nicepkg/vsync

skill-creator

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.

62 0
View
video-script-writer logo
nicepkg/ai-workflow

video-script-writer

Write engaging video scripts for YouTube, TikTok, and other platforms. Creates complete scripts with hooks, main content, and CTAs. Supports various formats including tutorials, vlogs, reviews, explainers, and storytelling. Use when creating video scripts, writing YouTube content, or planning video structure.

284 0
View
team logo
nicepkg/ctxport

team

根据任务快速组建临时 AI Agent 团队协作。自动从 .claude/agents/ 中选择最合适的成员组队。

644 0
View
resource-scout logo
nicepkg/ai-workflow

resource-scout

Search and discover Claude Code skills and MCP servers from marketplaces, GitHub repositories, and registries. Use when (1) user asks to find skills for a specific task, (2) looking for MCP servers to connect external tools, (3) user mentions "find skill", "search MCP", "discover tools", or "what skills exist for X", (4) before creating a custom skill to check if one already exists.

284 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View