Pexafy Photos API
One photo at a time. One resource group of the Pexafy Stock Photos API (the name the provider publishes in its apis.json and OpenAPI).
One photo at a time. One resource group of the Pexafy Stock Photos API (the name the provider publishes in its apis.json and OpenAPI).
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/pexafy:pexafy-photos-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Pexafy Photos API
version: 1.3.0
summary: Semantic search over a catalogue of freely licensed stock photography.
description: 'Search runs on meaning rather than keywords, so queries read like sentences and filters narrow what the ranking already found.
Every response is an envelope: `success`, then `data`, then `pagination` on the list endpoints and `meta` everywhere. Failures use the same envelope with an `error` object whose `code` is stable across versions. Branch on the code, never on the message.
Enums marked `x-extensible-enum` grow between releases. Parse them as open strings; a client whose type is a closed set will fail the day a value is added.'
license:
name: MIT
identifier: MIT
contact:
name: Pexafy
url: https://pexafy.com
servers:
- url: https://api.pexafy.com/api/v1
description: Production
security:
- apiKey: []
tags:
- name: Photos
description: One photo at a time.
paths:
/photos/{photo_id}:
get:
operationId: getPhoto
tags:
- Photos
summary: Fetch one photo
parameters:
- name: photo_id
in: path
description: UUIDv7 of the photo.
schema:
type: string
format: uuid
required: true
responses:
'200':
description: The photo.
content:
application/json:
schema:
$ref: '#/components/schemas/PhotoEnvelope'
'401':
description: The API key is missing, malformed or revoked.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
example:
success: false
error:
code: unauthenticated
message: The API key is missing, malformed or revoked.
request_id: req_01J8Z3
'404':
description: No such resource.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
example:
success: false
error:
code: not_found
message: No such resource.
request_id: req_01J8Z3
'429':
description: Too many requests, or the plan quota is exhausted.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
example:
success: false
error:
code: rate_limited
message: Too many requests, or the plan quota is exhausted.
request_id: req_01J8Z3
/photos/{photo_id}/similar:
get:
operationId: getSimilarPhotos
tags:
- Photos
summary: Photos that look like this one
description: Nearest neighbours of the photo's own image vector. The photo itself is excluded from its own results, which is worth knowing if you are counting on per_page results and getting per_page minus one.
parameters:
- name: photo_id
in: path
description: UUIDv7 of the photo.
schema:
type: string
format: uuid
required: true
- name: color_name
in: query
description: Restrict to one dominant colour. The API filters on a single colour; passing several is rejected rather than silently using the last one.
schema:
$ref: '#/components/schemas/ColorName'
- name: color_hex
in: query
description: Restrict to photos near one hex colour, used with color_tolerance.
schema:
type: string
pattern: ^#?[0-9a-fA-F]{6}$
- name: color_tolerance
in: query
description: How far from color_hex a photo may sit, in the same units as the colour distance the indexer stores.
schema:
type: integer
minimum: 0
maximum: 100
default: 20
- name: orientation
in: query
description: One or more orientations. Repeat the parameter or pass a comma separated list.
schema:
type: array
items:
$ref: '#/components/schemas/Orientation'
maxItems: 3
- name: source
in: query
description: Restrict to one or more upstream libraries.
schema:
type: array
items:
$ref: '#/components/schemas/Source'
maxItems: 8
- name: license_type
in: query
description: Restrict to one or more licence families.
schema:
type: array
items:
$ref: '#/components/schemas/LicenseType'
maxItems: 8
- name: photographer
in: query
description: Restrict to one photographer, by username.
schema:
type: string
maxLength: 120
- name: per_page
in: query
description: Results per page.
schema:
type: integer
minimum: 1
maximum: 80
default: 20
- name: limit
in: query
description: Hard ceiling on results across all pages of this query.
schema:
type: integer
minimum: 1
maximum: 200
- name: score_threshold
in: query
description: Drop results whose relevance score is below this. Search is semantic, so every query returns something; this is how you decide it returned nothing useful.
schema:
type: number
minimum: 0
maximum: 1
- name: cursor
in: query
description: Opaque cursor from pagination.next_cursor. Cursors are tied to the query that produced them and expire; treat them as single use.
schema:
type: string
maxLength: 512
- name: fields
in: query
description: Comma separated list of Photo fields to return. Trims the payload, does not change ranking.
schema:
type: string
- name: after_date
in: query
description: Only photos uploaded on or after this date.
schema:
type: string
format: date
- name: sort_by
in: query
description: Ordering. Defaults to relevance.
schema:
$ref: '#/components/schemas/SortBy'
responses:
'200':
description: Neighbours, closest first.
headers:
X-Request-Id:
description: Echoed in error payloads; quote it in a support request.
schema:
type: string
X-RateLimit-Remaining:
description: Calls left in the current window.
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/SearchEnvelope'
example:
success: true
data:
- photo_id: 0192f3a1-6c1e-7a3b-9f2d-4c8e1b5a7d20
image_url: https://cdn.pexafy.com/p/0192f3a1/regular.jpg
urls:
thumb: https://cdn.pexafy.com/p/0192f3a1/thumb.jpg
small: https://cdn.pexafy.com/p/0192f3a1/small.jpg
regular: https://cdn.pexafy.com/p/0192f3a1/regular.jpg
large: https://cdn.pexafy.com/p/0192f3a1/large.jpg
full: https://cdn.pexafy.com/p/0192f3a1/full.jpg
width: 5472
height: 3648
orientation: landscape
color_name: blue
color_hex: '#2f4f6f'
photographer_username: a-photographer
source: unsplash
license_type: unsplash
alt_description: an empty office lit only by monitors
relevance_score: 0.71
pagination:
next_cursor: c2NvcmU6MC42MQ
per_page: 20
has_more: true
meta:
request_id: req_01J8Z3
took_ms: 61.4
'401':
description: The API key is missing, malformed or revoked.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
example:
success: false
error:
code: unauthenticated
message: The API key is missing, malformed or revoked.
request_id: req_01J8Z3
'404':
description: No such resource.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
example:
success: false
error:
code: not_found
message: No such resource.
request_id: req_01J8Z3
'422':
description: A parameter was rejected before the search ran.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
example:
success: false
error:
code: validation_failed
message: A parameter was rejected before the search ran.
request_id: req_01J8Z3
'429':
description: Too many requests, or the plan quota is exhausted.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorEnvelope'
example:
success: false
error:
code: rate_limited
message: Too many requests, or the plan quota is exhausted.
request_id: req_01J8Z3
/api/v1/photos/{photo_id}:
get:
tags:
- Photos
summary: Get a photo
operationId: get_photo_api_v1_photos__photo_id__get
parameters:
- name: photo_id
in: path
required: true
schema:
type: string
title: Photo Id
description: The photo's unique Pexafy identifier (a UUID), as returned by search.
- name: fields
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Fields
description: 'Comma-separated list to return only the fields you need (e.g. `photo_id,urls,attribution`). Omit to get everything.
Valid values: `photo_id`, `source_photo_id`, `image_url`, `urls`, `source_image_url`, `width`, `height`, `orientation`, `blur_hash`, `color_name`, `color_hex`, `source`, `license_type`, `photographer_username`, `photographer_full_name`, `photographer_url`, `source_description`, `description`, `alt_description`, `relevance_score`, `uploaded_on`, `attribution`. There is no `photographer` field — the credit is carried by `photographer_username`, `photographer_full_name` and `photographer_url`. An unknown name returns `400 INVALID_FIELDS` listing the values your plan accepts.'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/PhotoResponse'
example:
success: true
data:
photo_id: 019e1a0d-1a4f-7d62-856f-e6775b49785d
image_url: https://images.pexels.com/photos/20853949/pexels-photo-20853949.jpeg
urls:
thumb: https://images.pexels.com/photos/20853949/pexels-photo-20853949.jpeg?w=200
small: https://images.pexels.com/photos/20853949/pexels-photo-20853949.jpeg?w=400
regular: https://images.pexels.com/photos/20853949/pexels-photo-20853949.jpeg?w=1280
large: https://images.pexels.com/photos/20853949/pexels-photo-20853949.jpeg?w=1920
full: https://images.pexels.com/photos/20853949/pexels-photo-20853949.jpeg?w=2400
source_image_url: https://www.pexels.com/photo/red-fox-walking-in-snow-20853949
width: 8234
height: 5489
orientation: landscape
blur_hash: LIKe1dRPpd%N4mRjMxxut.oLDNf,
color_name: silver (metallic)
color_hex: '#AEABAF'
source: Pexels
license_type: free
photographer_username: dip-kheto
photographer_full_name: Dip Kheto
photographer_url: https://www.pexels.com/search/users/Dip%20Kheto/
source_description: A red fox gracefully walks through the snow, showcasing its striking fur in a serene winter scene.
description: In a snowy field, an orange fox is captured mid-stride, moving towards the right side of the frame with its tail visible behind it. The fox's fur contrasts beautifully against the white snow, and its ears are perked up in alertness. In the background, there are bushes and trees scattered across the landscape, adding depth to the scene.
alt_description: Red fox walking through a snowy field with bushes and trees behind it
uploaded_on: '2024-04-03'
attribution:
html: <span class="attribution">Photo by <a href="https://www.pexels.com/search/users/Dip%20Kheto/" target="_blank" rel="noopener">Dip Kheto</a> on <a href="https://pexafy.com/legal/licenses/#pexels" target="_blank" rel="noopener">Pexels</a></span>
plain: Photo by Dip Kheto on Pexels (https://pexafy.com/legal/licenses/#pexels)
meta:
request_id: a21107d4-54ab-46bd-8207-3a29974e4f8a
took_ms: 7.91
error: null
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- ApiKeyAuth: []
description: 'Retrieve the full details of a single photo by its Pexafy `photo_id` (the identifier returned by every search result).
You get everything search returns, plus extra metadata when available: exact `width` and `height`, the original `source_image_url`, the photographer''s `full_name` and profile `url`, and the upload date (`uploaded_on`). The `urls` object gives you the image in five ready-to-use sizes.'
/api/v1/photos/{photo_id}/similar:
get:
tags:
- Photos
summary: Find similar photos
operationId: photo_similar_api_v1_photos__photo_id__similar_get
parameters:
- name: photo_id
in: path
required: true
schema:
type: string
title: Photo Id
description: The reference photo's unique Pexafy identifier (a UUID).
- name: per_page
in: query
required: false
schema:
type: integer
maximum: 100
minimum: 1
default: 20
title: Per Page
description: Number of similar photos to return, from 1 to 100. Defaults to 20.
example: 20
- name: limit
in: query
required: false
schema:
anyOf:
- type: integer
maximum: 100
minimum: 1
- type: 'null'
description: Maximum TOTAL number of similar photos across all pages — NOT the page size (use `per_page` for that). Omit for no cap.
title: Limit
description: Maximum TOTAL number of similar photos across all pages — NOT the page size (use `per_page` for that). Omit for no cap.
- name: cursor
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Token to fetch the next page. Take `pagination.next_cursor` from a previous response and pass it back here. See the Pagination guide.
title: Cursor
description: Token to fetch the next page. Take `pagination.next_cursor` from a previous response and pass it back here. See the Pagination guide.
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/PhotoListResponse'
example:
success: true
data:
- photo_id: 019e1d9c-5cbd-7882-a966-0f3a4edb1348
image_url: https://images.unsplash.com/photo-1553107134-7bacacfd7f1a
urls:
thumb: https://images.unsplash.com/photo-1553107134-7bacacfd7f1a?w=200
small: https://images.unsplash.com/photo-1553107134-7bacacfd7f1a?w=400
regular: https://images.unsplash.com/photo-1553107134-7bacacfd7f1a?w=1280
large: https://images.unsplash.com/photo-1553107134-7bacacfd7f1a?w=1920
full: https://images.unsplash.com/photo-1553107134-7bacacfd7f1a?w=2400
source_image_url: https://unsplash.com/photos/brown-fox-on-snow--aORNxK6K4I
width: 6000
height: 4000
orientation: landscape
blur_hash: LMODh4fk_4%MM{tRWVWB_Nof9EbH
color_name: silver
color_hex: '#C8C5C3'
source: Unsplash
license_type: free
photographer_username: cartercaroline
photographer_full_name: Carter Caroline
photographer_url: https://unsplash.com/@cartercaroline
source_description: null
description: In a snowy landscape, an orange fox is captured mid-stride, moving towards the right side of the frame with its body angled slightly to the left and its head turned to the left. The fox's fur blends harmoniously with the surrounding snow, creating a sense of camouflage. The background features a serene winter scene with trees covered in snow on both sides, providing a natural backdrop for this captivating moment.
alt_description: Orange fox trotting across the snow between snow-covered trees
relevance_score: 0.9137
uploaded_on: '2019-03-20'
attribution:
html: <span class="attribution">Photo by <a href="https://unsplash.com/@cartercaroline" target="_blank" rel="noopener">Carter Caroline</a> on <a href="https://pexafy.com/legal/licenses/#unsplash" target="_blank" rel="noopener">Unsplash</a></span>
plain: Photo by Carter Caroline on Unsplash (https://pexafy.com/legal/licenses/#unsplash)
- photo_id: 019e1a0d-0ba5-72cb-a67b-54f7f15ba784
image_url: https://images.pexels.com/photos/34439880/pexels-photo-34439880.jpeg
urls:
thumb: https://images.pexels.com/photos/34439880/pexels-photo-34439880.jpeg?w=200
small: https://images.pexels.com/photos/34439880/pexels-photo-34439880.jpeg?w=400
regular: https://images.pexels.com/photos/34439880/pexels-photo-34439880.jpeg?w=1280
large: https://images.pexels.com/photos/34439880/pexels-photo-34439880.jpeg?w=1920
full: https://images.pexels.com/photos/34439880/pexels-photo-34439880.jpeg?w=2400
source_image_url: https://www.pexels.com/photo/red-fox-in-snowy-pine-forest-flagstaff-az-34439880
width: 3903
height: 3903
orientation: square
blur_hash: LXL;8KRio~tS%2xuogWr?wozVsV?
color_name: silver pink
color_hex: '#B29F9A'
source: Pexels
license_type: free
photographer_username: wes-guild
photographer_full_name: Wes Guild
photographer_url: https://www.pexels.com/search/users/Wes%20Guild/
source_description: A red fox with a fluffy tail sits on snowy ground surrounded by pine needles in Flagstaff, AZ.
description: In a snowy forest, an orange fox with black spots is sitting on its hind legs and looking directly at the camera. The fox's fur is a mix of brown and white colors, blending harmoniously with the surrounding environment. The fox appears to be in a relaxed position, possibly resting or observing its surroundings. The snow-covered ground beneath it adds to the wintery atmosphere of the scene.
alt_description: Red fox with a fluffy tail sitting on snowy ground in a pine forest
relevance_score: 0.8826
uploaded_on: '2025-10-25'
attribution:
html: <span class="attribution">Photo by <a href="https://www.pexels.com/search/users/Wes%20Guild/" target="_blank" rel="noopener">Wes Guild</a> on <a href="https://pexafy.com/legal/licenses/#pexels" target="_blank" rel="noopener">Pexels</a></span>
plain: Photo by Wes Guild on Pexels (https://pexafy.com/legal/licenses/#pexels)
meta:
request_id: 5ac11006-86b7-43a8-91c9-72bc5ba1164f
took_ms: 34.56
pagination:
next_cursor: eyJzaW0iOiIwMTllMWEwZC0xYTRmLTdkNjItODU2Zi1lNjc3NWI0OTc4NWQiLCJvZmYiOjIsImxpbSI6bnVsbH0=
per_page: 2
has_more: true
error: null
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- ApiKeyAuth: []
description: Return photos that look similar to a given one — a quick way to offer alternatives or build a visually consistent set. The reference photo itself is never included in the results. Each result has the same fields as a search result.
components:
schemas:
Attribution:
type: object
description: Credit line, ready to drop into a page. Most upstream licences require it even when they do not require a link.
properties:
html:
type: string
plain:
type: string
Pagination:
type: object
required:
- per_page
- has_more
description: 'Cursor paging. There is no total count: the result set is a ranked stream and counting it would cost more than returning it.'
properties:
next_cursor:
type:
- string
- 'null'
per_page:
type: integer
has_more:
type: boolean
Source:
type: string
enum:
- pexels
- unsplash
- pixabay
- wikimedia
x-extensible-enum: true
description: 'Upstream library. Extensible: this list grows as libraries are indexed, so parse it as an open string.'
PhotoEnvelope:
type: object
required:
- success
- data
properties:
success:
type: boolean
data:
$ref: '#/components/schemas/Photo'
meta:
$ref: '#/components/schemas/Meta'
example:
success: true
data:
photo_id: 0192f3a1-6c1e-7a3b-9f2d-4c8e1b5a7d20
urls:
regular: https://cdn.pexafy.com/p/0192f3a1/regular.jpg
source: unsplash
license_type: unsplash
meta:
request_id: req_01J8Z3
took_ms: 4.1
Meta:
type: object
properties:
request_id:
type: string
took_ms:
type: number
description: Server side time, excluding transfer.
ColorName:
type: string
enum:
- black
- white
- grey
- red
- orange
- yellow
- green
- teal
- blue
- purple
- pink
- brown
x-extensible-enum: true
description: Extensible.
Orientation:
type: string
enum:
- landscape
- portrait
- square
x-extensible-enum: true
description: 'Extensible: new orientations may be added.'
Photo:
type: object
required:
- photo_id
- urls
- source
- license_type
properties:
photo_id:
type: string
format: uuid
description: UUIDv7. Sortable by creation time, which is why it is not an integer.
image_url:
type: string
format: uri
urls:
$ref: '#/components/schemas/PhotoUrls'
width:
type: integer
minimum: 1
height:
type: integer
minimum: 1
blur_hash:
type:
- string
- 'null'
description: Placeholder while loading.
orientation:
$ref: '#/components/schemas/Orientation'
color_name:
$ref: '#/components/schemas/ColorName'
color_hex:
type: string
photographer_username:
type: string
photographer_full_name:
type:
- string
- 'null'
photographer_url:
type:
- string
- 'null'
format: uri
source:
$ref: '#/components/schemas/Source'
license_type:
$ref: '#/components/schemas/LicenseType'
source_image_url:
type:
- string
- 'null'
format: uri
source_description:
type:
- string
- 'null'
description:
type:
- string
- 'null'
alt_description:
type:
- string
- 'null'
description: Short text for an alt attribute. Null for a large part of the catalogue; fall back to description, then to source_description, then to nothing rather than to the filename.
uploaded_on:
type:
- string
- 'null'
format: date
relevance_score:
type:
- number
- 'null'
minimum: 0
maximum: 1
description: 'Only present on search results. Comparable within one response and not across responses: the scores are normalised per query.'
attribution:
$ref: '#/components/schemas/Attribution'
example:
photo_id: 0192f3a1-6c1e-7a3b-9f2d-4c8e1b5a7d20
urls:
regular: https://cdn.pexafy.com/p/0192f3a1/regular.jpg
source: unsplash
license_type: unsplash
LicenseType:
type: string
enum:
- cc0
- unsplash
- pexels
- pixabay
- cc-by
- cc-by-sa
x-extensible-enum: true
description: Extensible.
SortBy:
type: string
enum:
- relevance
- recent
- popular
default: relevance
x-extensible-enum: true
description: Extensible.
PhotoUrls:
type: object
required:
- thumb
- small
- regular
- large
- full
description: The same image at five widths. Pick the smallest one that fits; the CDN charges you nothing for it but the upstream library counts a view either way.
properties:
thumb:
type: string
format: uri
small:
type: string
format: uri
regular:
type: string
format: uri
large:
type: string
format: uri
full:
type: string
format: uri
SearchEnvelope:
type: object
required:
- success
- data
- pagination
properties:
success:
type: boolean
data:
type: array
items:
$ref: '#/components/schemas/Photo'
pagination:
$ref: '#/components/schemas/Pagination'
meta:
$ref: '#/components/schemas/Meta'
ErrorEnvelope:
type: object
required:
- success
- error
description: Every failure uses this shape, whatever the status code.
properties:
success:
type: boolean
enum:
- false
error:
type: object
required:
- code
- message
properties:
code:
type: string
description: 'Machine readable and stable across versions. Branch on this, not on the message. The set is extensible: treat an unrecognised code as a generic failure of its status class.'
example: validation_failed
message:
type: string
description: Human readable, not stable.
request_id:
type: string
field:
type:
- string
- 'null'
description: Which parameter was rejected, when the failure is about one.
ApiError:
type: object
properties:
code:
type: string
description: Machine-readable error code (e.g. `MISSING_PARAMS`, `PHOTO_NOT_FOUND`).
message:
type: string
description: Human-readable error message.
request_id:
type: string
required:
- code
- message
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
PhotoListResponse:
type: object
properties:
success:
type: boolean
data:
type: array
items:
$ref: '#/components/schemas/Photo'
meta:
$ref: '#/components/schemas/Meta'
error:
anyOf:
- $ref: '#/components/schemas/ApiError'
- type: 'null'
pagination:
anyOf:
- $ref: '#/components/schemas/Pagination'
- type: 'null'
PhotoResponse:
type: object
properties:
success:
type: boolean
data:
$ref: '#/components/schemas/Photo'
meta:
$ref: '#/components/schemas/Meta'
error:
anyOf:
- $ref: '#/components/schemas/ApiError'
- type: 'null'
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
type: object
required:
- loc
- msg
- type
title: ValidationError
securitySchemes:
apiKey:
type: http
scheme: bearer
description: Send the key as a bearer token. Keys carry scopes; a read scoped key gets a 403 on anything under /collections.
ApiKeyAuth:
type: apiKey
in: header
name: x-api-key
description: 'Pass your Pexafy API key in this header.
Get your API key at [pexafy.com/dashboard/api-keys/create](https://pexafy.com/dashboard/api-keys/create/).'