Bart Simons

Bart Simons

Thoughts, stories and ideas.

Bart Simons



Getting started with Unsplash Source on Node.JS

Bart SimonsBart Simons

What is Unsplash?

Unsplash is a dream that has come true to me - a free platform where free really means free: the artwork available on Unsplash is free-to-use for private and commercial use, without the need to citate the author (although it is respected if you do). Func fact: I also use Unsplash for my website's titles since January 2018.

So now that you know what Unsplash is: did you know that they have an API available with libraries for the most used programming languages? In this post I am going to dive deeper into the Node.JS module and the possibilities with it.

Colorful blue and pink powder and chalk dust across the floor
Photo by Nathan Roser / Unsplash

More about the API

The API of Unsplash is pretty cool: they have two APIs available:

The biggest difference between these two APIs is that the last one doesn't require you to authenticate, this makes it ideal to be used in for example client-side JavaScript applications.

I am going to discuss both APIs though, so I've got you covered on all the topics.

Using the Unsplash Source API

The Unsplash Source API is very simple and limited. As said before, it is only meant for fetching images and doing some simple inline editing tasks as well. Here's a list of what we can do with the API:

Of course there are more use cases, but these are 4 examples of what the possibilities are with this API.

A while ago, I found a JavaScript library that functions as a wrapper around the REST functionality of Unsplash Source. The bad news however is that it is meant to run in the browser, and not on Node.

So I forked to repository and implement the needed module export. My repository is available at


The returned URL is where your photo is located at, in my case it redirects to a random photo by Bernard Hermant on each visit.

You can read the readme markdown file in my repository for documentation and stuff. I have also included some more use cases over there.

Is the software provided in my repo helpful for your project? Don't forget to star it on GitHub to show your support 😉

Bart Simons

Bart Simons

View Comments