Image API
3 image providers

Beautiful images,
one simple URL.

Fetch photos from Unsplash, Lorem Picsum and Openverse and get them back as an image, JSON, a redirect, or a browser view. No API key needed on your side.

Usage

Every provider has the same routes. Replace {provider} with a provider id from the list below, or get the list as JSON from /providers.

Route Description
/{provider}/random A random image.
/{provider}/search Search results as JSON, in the same shape for every provider.
/{provider}/photos/:id A single image by its provider id.
/providers The available providers as JSON.

Query parameters

Name Description
query Search term. q works too.
orientation landscape, portrait or squarish.
page1 Results page, for /search.
per_page10 Results per page, for /search. Each provider caps it at its own limit.
# Random landscape photo, small size, as JSON
/unsplash/random?query=nature&orientation=landscape&size=small&type=json
# Drop it straight into an <img> tag
<img src="/unsplash/random?query=mountains" />

Providers

Open providers need no key. API providers appear here once their key is configured on the worker.

Unsplash

unsplash API key

High-quality, freely usable photos from the Unsplash community. Website →

Extra parameterDescription
Unsplash endpointsAny Unsplash API endpoint under /unsplash/photos, /unsplash/collections, /unsplash/users or /unsplash/search is passed straight through, with the original query parameters.

Lorem Picsum

picsum Open

Placeholder photos, no API key needed. Picsum has no search, so query and orientation are ignored. Website →

Extra parameterDescription
grayscaleReturn the image in grayscale, e.g. ?grayscale.
blurBlur the image, from 1 to 10.

Openverse

openverse Open

Openly licensed images from WordPress Openverse, no API key needed. Anonymous use is rate limited. Website →

Extra parameterDescription
licenseComma-separated licenses, e.g. cc0,by.
license_typecommercial and/or modification.
sourceComma-separated sources, e.g. flickr,wikimedia.

Response options

These parameters work on /random and /photos/:id.

Format: type

Value Description
imagedefault Returns the image file itself.
json Returns the response as JSON.
view Opens the image page on the provider’s site.
redirect Redirects to the image URL.

Size: size

Value Description
regulardefault Regular size image.
raw Original, unprocessed image.
full Full size image.
small Small size image.
thumb Thumbnail size image.

Contact

Questions or need help? Get in touch.

Contact me →