Pexels 搜索图文 API
Search Pexels for free stock photos by keyword. Returns image URLs in several sizes, dimensions, alt text, the photographer's name and profile, and the photo's Pexels page.
价格与服务商
Pexels 搜索图文 API 价格:一个 API,2 个可互换的服务商
最便宜的服务商优先响应。如果它失败,下一个会在同一次调用中接手。
每次请求封顶 US$0.06661 条结果US$0.0038511 条结果US$0.0368521 条结果US$0.0666(封顶)按实际返回的内容计费。调低返回数量上限即可少付,而且无论返回多少,单次请求都不会超过封顶价。2Gecko备用 1-US$4.66/千条结果每次请求最多 US$0.0932计量方式:每条结果,按实际返回基础费 US$0.0124 + 每条结果 US$0.00404
每次请求封顶 US$0.09321 条结果US$0.0164410 条结果US$0.052820 条结果US$0.0932(封顶)按实际返回的内容计费。调低返回数量上限即可少付,而且无论返回多少,单次请求都不会超过封顶价。
调用方式
一个请求获取 Pexels 搜索图文
import os, requests res = requests.post( "https://api.getanyapi.com/v1/run/pexels.search_photos", headers={"Authorization": f"Bearer {os.environ['ANYAPI_KEY']}"}, json={ "query": "coffee", "limit": 2 }, ) print(res.json())
{
"data": {
"photos": [
{
"alt": "example",
"color": "#1f4fe0",
"colors": [
"#1f4fe0"
],
"createdUtc": 12.5,
"downloadUrl": "https://example.com/page",
"height": 42,
"id": "a1b2c3d4",
"image": "https://example.com/image.jpg",
"imageMedium": "https://example.com/image.jpg",
"imageOriginal": "https://example.com/image.jpg",
"license": "example",
"orientation": "example",
"photographer": "https://example.com/image.jpg",
"photographerAvatarUrl": "https://example.com/image.jpg",
"photographerInstagramUsername": "https://example.com/image.jpg",
"photographerLocation": "https://example.com/image.jpg",
"photographerUrl": "https://example.com/image.jpg",
"photographerUsername": "https://example.com/image.jpg",
"publishedUtc": 12.5,
"tags": [
"example"
],
"thumbnail": "https://example.com/image.jpg",
"title": "Example title",
"url": "https://example.com/page",
"width": 1024
}
]
},
"found": true,
"reason": "not_found"
}完整的参数与响应参考:这个接口的每个字段、类型和示例。
参考
一个请求,一种响应结构。
你发送的每个字段和收到的每个字段,都附有真实示例。
最近验证于 2026-11-14 · 可用率和延迟按 30d 统计
请求体
JSON,POST 到这个接口。
- querystring
coffee
Keyword or phrase to search Pexels photos for, e.g. "coffee" or "city skyline".
- limitinteger
2
Maximum number of photos to return (1-20, default 20). You are billed per photo returned, so a lower limit costs less.
- minHeightinteger
Only return photos at least this many pixels tall.
- minWidthinteger
Only return photos at least this many pixels wide.
- orientationenum
Only return photos with this orientation. Omit for any orientation.
- peopleCountenum
Only return photos showing this many people: "0" for none, "1" or "2". Omit for any number.
- requireFieldsarray
Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `tags`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on a photo that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge.
响应
JSON,每个字段一个示例值。
Free Pexels photos matching the keyword, in Pexels' relevance order.
- altstring
Alt text describing the photo. Populated whenever the provider has data for the entity.
- colorstring
Dominant color as a hex code, e.g. "#918c79".
- colorsstring[]
Palette of the photo's main colors as hex codes.
- createdUtcnumber
When the photo was uploaded. UTC epoch timestamp in seconds (Unix time). Multiply by 1000 for a JS Date in milliseconds.
- downloadUrlstring
Direct download URL for the full-quality file.
- heightinteger
Original height in pixels. Populated whenever the provider has data for the entity.
- idstring
Photo id on the source site. Populated whenever the provider has data for the entity.
- imagestring
Display-size image URL, 1440 px wide. The query parameters set the size, so keep the URL intact. Populated whenever the provider has data for the entity.
- imageMediumstring
Medium image URL, 750 px wide.
- imageOriginalstring
Full-resolution original image URL. Populated whenever the provider has data for the entity.
- licensestring
License the photo is published under. "Pexels" means the Pexels License: free to use, attribution appreciated but not required. Populated whenever the provider has data for the entity.
- orientationstring
landscape, portrait, or square.
- photographerstring
Photographer's display name, for attribution. Populated whenever the provider has data for the entity.
- photographerAvatarUrlstring
Photographer's profile picture URL.
- photographerInstagramUsernamestring
Photographer's Instagram username, when they list one on Pexels.
- photographerLocationstring
Photographer's location as they state it on Pexels, when they list one.
- photographerUrlstring
Photographer's Pexels profile page, for attribution. Populated whenever the provider has data for the entity.
- photographerUsernamestring
Photographer's Pexels handle, without the leading @.
- publishedUtcnumber
When Pexels published the photo. UTC epoch timestamp in seconds (Unix time). Multiply by 1000 for a JS Date in milliseconds.
- tagsstring[]可设为必填
Pexels' tags for the photo. One source returns at most 25 tags; name tags in requireFields to be served the full list.
- thumbnailstring
Thumbnail image URL, 130 px tall.
- titlestring
Photo title set by the photographer.
- urlstring
The photo's page on pexels.com. Populated whenever the provider has data for the entity.
- widthinteger
Original width in pixels. Populated whenever the provider has data for the entity.
- foundboolean
- reason"not_found"
Present only when `found` is false, and says why there is no result. `not_found`: the source states the target does not exist, or returned nothing for it. A `found: false` answer is a successful call, not an error, and `costUsd` is what it actually cost.
常见问题
关于 Pexels 搜索图文 API
AnyAPI 的 Pexels 搜索图文 API 只需一次 POST 请求 /v1/run/pexels.search_photos,就以统一格式的 JSON 返回 Pexels 数据。Search Pexels for free stock photos by keyword. Returns image URLs in several sizes, dimensions, alt text, the photographer's name and profile, and the photo's Pexels page.AnyAPI 会在 2 个数据源之间路由每个请求,某个数据源失败时自动切换。费用:每千条结果 US$3.17,单次请求最多 US$0.0666,以美元计价,无需订阅,也没有每月最低消费。过去 30 天,通过 AnyAPI 发起的 Pexels 搜索图文 API 调用中有 99.7% 成功,响应时间中位数为 4.2 秒,共测量 1,437 次调用。