Pluralsight Logo
Author avatar

Nick Fisher

Author badge Author

Using the Unsplash API

Nick Fisher

Author BadgeAuthor
  • Jun 1, 2017
  • 41 Min read
  • 5,939 Views
  • Jun 1, 2017
  • 41 Min read
  • 5,939 Views
other

Getting started

This guide describes the componenents that comprise the official Unsplash JSON API, the most powerful photo engine in the world.

If you are familiar with Unsplash and have any problems or requests, please contact our API team.

Creating a developer account

To access the Unsplash API, first register as a developer.

Registering your application

Once your account has been registered for the API, log in and go to the Developers page. Go to "Your Applications", click "New Application", and fill in the required details.

Initially, your aplication will be in development mode and will be limited to 50 requests per hour. When you are ready to produce your app, upload screenshots of your application (focusing on the proper attribution and use of Unsplash photos in your app), then click the "Request Approval" button. If approved, your rate limit will be increased to the full amount allowed.

Preference will be given to applications that follow the API Guidelines, including properly providing attribution for the photographer and Unsplash.

Libraries

To make it as easy as possible to integrate the Unsplash API, see official libraries for PHP, Ruby, and Javascript.

Guidelines & Crediting

The Unsplash API is made available as a free API. To use the API you must abide by the terms and follow the API guidelines.

Hotlinking

Unlike most APIs, we prefer for the image URLs returned by the API to be directly used or embedded in your applications. This embedding process is generally referred to as hotlinking. By using our CDN and embedding the photo URLs in your application, we can better track photo views and pass those stats on to the photographer, providing them with context for how popular their photo is and how it's being used.

Schema

Location

The API is available at https://api.unsplash.com/. Responses are sent as JSON.

Version

All requests receive the v1 version of the API. We encourage you to specifically request this via the Accept-Version header:

Accept-Version: v1

Summary objects

When retrieving a list of objects, an abbreviated or summary version of that object is returned - i.e., a subset of its attributes. To get a full detailed version of that object, fetch it individually.

HTTP Verbs

The Unsplash API uses HTTP verbs appropriate to each action.

VerbDescription
GETRetrieving resources.
POSTCreating resources.
PUTUpdating resources.
DELETEDeleting resources.

Error messages

If an error occurs, whether on the server or client side, the error message(s) will be returned in an errors array. For example:

1
422 Unprocessable Entity
1
2
3
{
  "errors": ["Username is missing", "Password cannot be blank"]
}

Authorization

Public Actions

Many actions can be performed without requiring authentication from a specific user. For example, downloading a photo does not require a user to log in.

To authenticate requests in this way, pass your application ID via the HTTP Authorization header:

1
Authorization: Client-ID YOUR_APPLICATION_ID

You can also pass this value using a client_id query parameter:

1
https://api.unsplash.com/photos/?client_id=YOUR_APPLICATION_ID

If only your application ID is sent, attempting to perform non-public actions that require user authorization will result in a 401 Unauthorized response.

User Authentication

The Unsplash API uses OAuth2 to authenticate and authorize Unsplash users. Unsplash's OAuth2 paths live at https://unsplash.com/oauth/.

Authorization workflow

This process is described below in detail. However, many libraries exist to simplify the process. If you are using one of the Unsplash API client libraries, see their documentation for how to handle user authentication.

  1. Direct the user to https://unsplash.com/oauth/authorize with the following query parameters:
paramDescription
client_idYour application ID.
redirect_uriA URI you control that handles successful user authorization.
response_typeThe access response type you are requesting. The authorization workflow Unsplash supports requires the value "code" here.
scopeA +-separated list of requested scopes. e.g. public+read_user
1
If necessary the user will be asked to log in. They will be presented with the list of permission scopes being requested and asked to authorize.
  1. If the user accepts the request, the user will be redirected to the redirect_uri, with the authorization code in the code query parameter.

  2. Make a POST request to https://unsplash.com/oauth/token with the following parameters:
paramDescription
client_idYour application ID.
client_secretYour application secret.
redirect_uriYour application's redirect URI.
codeThe authorization code supplied to the callback by Unsplash.
grant_typeValue "authorization_code".
1
2
3
4
5
6
7
8
9
10
11
If successful, the response body will be a JSON representation of your user's access token:


    {
      "access_token": "091343ce13c8ae780065ecb3b13dc903475dd22cb78a05503c2e0c69c5e98044",
      "token_type": "bearer",
      "scope": "public read_photos write_photos",
      "created_at": 1436544465
    }

Access tokens do not expire.
  1. On future requests, send OAuth Bearer access token via the HTTP Authorization header:

    1
    Authorization: Bearer ACCESS_TOKEN

Permission scopes

To write data on behalf of a user or to access their private data, you must request additional permission scopes from them. The scopes are:

ScopeDescription
publicDefault. Read public data.
read_userAccess user's private data.
write_userUpdate the user's profile.
read_photosRead private data from the user's photos.
write_photosUpdate photos on the user's behalf.
write_likesLike or unlike a photo on the user's behalf.
write_followersFollow or unfollow a user on the user's behalf.
read_collectionsView a user's private collections.
write_collectionsCreate and update a user's collections.

When authorizing your application, the user will be presented with a list of permission scopes being requested.

Pagination

Requests that return multiple items (a list of all photos, for example) will be paginated into pages of 10 items by default, up to a maximum of 30. The optional page and per_page query parameters can be supplied to define which page and the number of items per page to be returned, respectively.

If page is not supplied, the first page will be returned.

Pagination headers

Additional pagination information is returned in the response headers:

Per-page and Total

The X-Per-Page and X-Total headers give the number of elements returned on each page and the total number of elements respectively.

Link

URL's for the first, last, next, and previous pages are supplied, if applicable. They are comma-separated and differentiated with a rel attribute.

For example, after requesting page 3 of the photo list:

1
2
3
4
Link: <https://api.unsplash.com/photos?page=1>; rel="first",
<https://api.unsplash.com/photos?page=2>; rel="prev",
<https://api.unsplash.com/photos?page=346>; rel="last",
<https://api.unsplash.com/photos?page=4>; rel="next"

Rate Limiting

For applications in development mode, the Unsplash API currently places a limit of <%= RateLimit::HourlyRateLimit::DEVELOPMENT_RATE_LIMIT %> requests per hour. After approval for production, this limit is increased to <%= RateLimit::HourlyRateLimit::PRODUCTION_RATE_LIMIT %> requests per hour. On each request, your current rate limit status is returned in the response headers:

1
2
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999

Note that only the JSON requests (i.e., those to api.unsplash.com) are counted. Image file requests (images.unsplash.com) do not count against your rate limit.

If you think you'll need a higher rate limit, contact us.

Current User

Get the user's profile

1
GET /me

Note: To access a user's private data, the user is required to authorize the read_user scope. Without it, this request will return a 403 Forbidden response.

Note: Without a Bearer token (i.e. using a Client-ID token) this request will return a 401 Unauthorized response.

No parameters are necessary here.

Response

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "private_user.json" %>

Update the current user's profile

1
PUT /me

Note: This action requires the write_user scope. Without it, it will return a 403 Forbidden response.

Parameters

All parameters are optional.

paramDescription
usernameUsername.
first_nameFirst name.
last_nameLast name.
emailEmail.
urlPortfolio/personal URL.
locationLocation.
bioAbout/bio.
instagram_usernameInstagram username.

Response

Returns the updated user profile.

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "private_user.json" %>

Users

Link relations

Users have the following link relations:

relDescription
selfAPI location of this user.
htmlHTML location of this user.
photosAPI location of this user's photos.
portfolioAPI location of this user's external portfolio.
followersAPI location of this user's followers.
followingAPI location of users this user is following.

Get a user's public profile

Retrieve public details on a given user.

1
GET /users/:username

Parameters

paramDescription
usernameThe user's username. Required.
wProfile image width in pixels.
hProfile image height in pixels.

Response

This response includes only the user's publicly-available information. For private details on the current user, use GET /me.

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "public_user.json" %>

Note: Supplying the optional w or h parameters will result in the custom photo URL being added to the profile_image object:

1
2
3
4
5
6
7
8
9
{
  // ...
  "profile_image": {
    "small":    ...
    "medium": ...
    "large":   ...
    "custom":  "https://images.unsplash.com/your-custom-image.jpg?q=80&fm=jpg&crop=faces&fit=crop&h=100&w=100"
  }
}

Get a user's portfolio link

Retrieve a single user's portfolio link.

1
GET /users/:username/portfolio

Parameters

paramDescription
usernameThe user's username. Required.

Response

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
2
3
{
  "url": "http://example.com"
}

List a user's photos

Get a list of photos uploaded by a user.

1
GET /users/:username/photos

Note: See the note on hotlinking.

Parameters

paramDescription
usernameThe user's username. Required.
pagePage number to retrieve. (Optional; default: 1)
per_pageNumber of items per page. (Optional; default: 10)
order_byHow to sort the photos. Optional. (Valid values: latest, oldest, popular; default: latest)
statsShow the stats for each user's photo. (Optional; default: false)
resolutionThe frequency of the stats. (Optional; default: "days")
quantityThe amount of for each stat. (Optional; default: 30)

Response

The photo objects returned here are abbreviated. For full details use GET /photos/:id

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "photo_list.json" %>

Note: If the optional stats param is set to true, each photo's stats are included in the response:

1
<%= render "photo_list_with_stats.json" %>

List a user's liked photos

Get a list of photos liked by a user.

1
GET /users/:username/likes

Note: See the note on hotlinking.

Parameters

paramDescription
usernameThe user's username. Required.
pagePage number to retrieve. (Optional; default: 1)
per_pageNumber of items per page. (Optional; default: 10)
order_byHow to sort the photos. Optional. (Valid values: latest, oldest, popular; default: latest)

Response

The photo objects returned here are abbreviated. For full details use GET /photos/:id

1
2
3
4
200 OK
Link: <https://api.unsplash.com/users/ashbot/likes>; rel="first", <https://api.unsplash.com/photos/users/ashbot/likes?page=1>; rel="prev", <https://api.unsplash.com/photos/users/ashbot/likes?page=5>; rel="last", <https://api.unsplash.com/photos/users/ashbot/likes?page=3>; rel="next"
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "photo_list.json" %>

List a user's collections

Get a list of collections created by the user.

1
GET /users/:username/collections

Parameters

paramDescription
usernameThe user's username. Required.
pagePage number to retrieve. (Optional; default: 1)
per_pageNumber of items per page. (Optional; default: 10)

Response

1
2
3
4
200 OK
Link: <https://api.unsplash.com/users/fableandfolk/collections>; rel="first", <https://api.unsplash.com/photos/users/fableandfolk/collections?page=1>; rel="prev", <https://api.unsplash.com/photos/users/fableandfolk/collections?page=5>; rel="last", <https://api.unsplash.com/photos/users/fableandfolk/collections?page=3>; rel="next"
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "collection_list.json" %>

Get a user's statistics

Retrieve the consolidated number of downloads, views and likes of all user's photos, as well as the historical breakdown and average of these stats in a specific timeframe. The default time is 30 days.

1
GET /users/:username/statistics

Parameters

paramDescription
usernameThe user's username. Required.
resolutionThe frequency of the stats. (Optional; default: "days")
quantityThe amount of for each stat. (Optional; default: 30)

Currently, the only resolution param supported is "days". The quantity param can be any number between 1 and 30.

Response

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "user_statistics.json" %>

Photos

Link relations

Photos have the following link relations:

relDescription
selfAPI location of this photo.
htmlHTML location of this photo.
downloadDownload location of this photo.

List photos

Get a single page from the list of all photos.

1
GET /photos

Note: See the note on hotlinking.

Parameters

paramDescription
pagePage number to retrieve. (Optional; default: 1)
per_pageNumber of items per page. (Optional; default: 10)
order_byHow to sort the photos. Optional. (Valid values: latest, oldest, popular; default: latest)

Response

The photo objects returned here are abbreviated. For full details use GET /photos/:id

1
2
3
4
200 OK
Link: <https://api.unsplash.com/photos?page=1>; rel="first", <https://api.unsplash.com/photos?page=1>; rel="prev", <https://api.unsplash.com/photos?page=346>; rel="last", <https://api.unsplash.com/photos?page=3>; rel="next"
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "photo_list.json" %>

List curated photos

Get a single page from the list of the curated photos.

1
GET /photos/curated

Note: See the note on hotlinking.

Parameters

paramDescription
pagePage number to retrieve. (Optional; default: 1)
per_pageNumber of items per page. (Optional; default: 10)
order_byHow to sort the photos. Optional. (Valid values: latest, oldest, popular; default: latest)

Response

The photo objects returned here are abbreviated. For full details use GET /photos/:id

1
2
3
4
200 OK
Link: <https://api.unsplash.com/photos/curated?page=1>; rel="first", <https://api.unsplash.com/photos/curated?page=1>; rel="prev", <https://api.unsplash.com/photos/curated?page=346>; rel="last", <https://api.unsplash.com/photos/curated?page=3>; rel="next"
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "photo_list.json" %>

Get a photo

Retrieve a single photo.

1
GET /photos/:id

Note: See the note on hotlinking.

Parameters

paramDescription
idThe photo's ID. Required.
wImage width in pixels.
hImage height in pixels.
rect4 comma-separated integers representing x, y, width, height of the cropped rectangle.

Response

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "full_photo.json" %>

<%= render "custom_url.json" %>

Get a random photo

Retrieve a single random photo, given optional filters.

1
GET /photos/random

Note: See the note on hotlinking.

Parameters

All parameters are optional, and can be combined to narrow the pool of photos from which a random one will be chosen.

paramDescription
collectionsPublic collection ID('s) to filter selection. If multiple, comma-separated
featuredLimit selection to featured photos.
usernameLimit selection to a single user.
queryLimit selection to photos matching a search term.
wImage width in pixels.
hImage height in pixels.
orientationFilter search results by photo orientation. Valid values are landscape, portrait, and squarish.
countThe number of photos to return. (Default: 1; max: 30)

Note: You can't use the collections and query parameters in the same request

Note: When supplying a count parameter - and only then - the response will be an array of photos, even if the value of count is 1.

Response

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
Without the count parameter:
1
<%= render "full_photo.json" %>
With the count parameter:
1
<%= render "random_multiple.json" %>

<%= render "custom_url.json" %>

Get a photo's statistics

Retrieve total number of downloads, views and likes of a single photo, as well as the historical breakdown of these stats in a specific timeframe (default is 30 days).

1
GET /photos/:id/statistics

Parameters

paramDescription
idThe public id of the photo. Required.
resolutionThe frequency of the stats. (Optional; default: "days")
quantityThe amount of for each stat. (Optional; default: 30)

Currently, the only resolution param supported is "days". The quantity param can be any number between 1 and 30.

Response

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "photo_statistics.json" %>

Get a photo's download link

Retrieve a single photo's download link.

Preferably hit this endpoint if a photo is downloaded in your application for use (example: to be displayed on a blog article, to be shared on social media, to be remixed, etc.).

Note: This is different than the concept of a view, which is tracked automatically when you hotlinking an image

1
GET /photos/:id/download

Parameters

paramDescription
idThe photo's ID. Required.

Response

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
2
3
{
  "url": "https://image.unsplash.com/example"
}

Update a photo

Update a photo on behalf of the logged-in user. This requires the write_photos scope.

1
PUT /photos/:id

Parameters

paramDescription
idThe photo's ID. Required.
location[latitude]The photo location's latitude (Optional)
location[longitude]The photo location's longitude (Optional)
location[name]The photo location's name (Optional)
location[city]The photo location's city (Optional)
location[country]The photo location's country (Optional)
location[confidential]The photo location's confidentiality (Optional)
exif[make]Camera's brand (Optional)
exif[model]Camera's model (Optional)
exif[exposure_time]Camera's exposure time (Optional)
exif[aperture_value]Camera's aperture value (Optional)
exif[focal_length]Camera's focal length (Optional)
exif[iso_speed_ratings]Camera's iso (Optional)

Response

Responds with the uploaded photo:

1
2
3
201 Created
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "full_photo.json" %>

Like a photo

Upvote or like a photo on behalf of the logged-in user. This requires the write_likes scope.

Note: This action is idempotent; sending the POST request to a single photo multiple times has no additional effect.

1
POST /photos/:id/like

Parameters

paramDescription
idThe photo's ID. Required.

Response

Responds with the abbreviated versions of the user and the liked photo.

1
2
3
201 Created
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
  "photo": {
    "id": "LF8gK8-HGSg",
    "width": 5245,
    "height": 3497,
    "color": "#60544D",
    "likes": 10,
    "liked_by_user": true,
    "urls": {
      "raw": "https://images.unsplash.com/1/type-away.jpg",
      "full": "https://images.unsplash.com/1/type-away.jpg?q=80&fm=jpg",
      "regular": "https://images.unsplash.com/1/type-away.jpg?q=80&fm=jpg&w=1080&fit=max",
      "small": "https://images.unsplash.com/1/type-away.jpg?q=80&fm=jpg&w=400&fit=max",
      "thumb": "https://images.unsplash.com/1/type-away.jpg?q=80&fm=jpg&w=200&fit=max"
    },
    "links": {
      "self": "http://api.unsplash.com/photos/LF8gK8-HGSg",
      "html": "http://unsplash.com/photos/LF8gK8-HGSg",
      "download": "http://unsplash.com/photos/LF8gK8-HGSg/download"
    }
  },
  "user": {
    "id": "8VpB0GYJMZQ",
    "username": "williamnot",
    "name": "Thomas R.",
    "links": {
      "self": "http://api.unsplash.com/users/williamnot",
      "html": "http://api.unsplash.com/williamnot",
      "photos": "http://api.unsplash.com/users/williamnot/photos",
      "likes": "http://api.unsplash.com/users/williamnot/likes"
    }
  }
}

Unlike a photo

Undo a "like" on a photo.

Note: This action is idempotent; sending the DELETE request to a single photo multiple times has no additional effect.

1
DELETE /photos/:id/like

Parameters

paramDescription
idThe photo's ID. Required.

Response

Responds with a 204 status and an empty body.

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
  "photo": {
    "id": "LF8gK8-HGSg",
    "width": 5245,
    "height": 3497,
    "color": "#60544D",
    "likes": 10,
    "liked_by_user": false,
    "urls": {
      "raw": "https://images.unsplash.com/1/type-away.jpg",
      "full": "https://images.unsplash.com/1/type-away.jpg?q=80&fm=jpg",
      "regular": "https://images.unsplash.com/1/type-away.jpg?q=80&fm=jpg&w=1080&fit=max",
      "small": "https://images.unsplash.com/1/type-away.jpg?q=80&fm=jpg&w=400&fit=max",
      "thumb": "https://images.unsplash.com/1/type-away.jpg?q=80&fm=jpg&w=200&fit=max"
    },
    "links": {
      "self": "http://api.unsplash.com/photos/LF8gK8-HGSg",
      "html": "http://unsplash.com/photos/LF8gK8-HGSg",
      "download": "http://unsplash.com/photos/LF8gK8-HGSg/download"
    }
  },
  "user": {
    "id": "8VpB0GYJMZQ",
    "username": "williamnot",
    "name": "Thomas R.",
    "links": {
      "self": "http://api.unsplash.com/users/williamnot",
      "html": "http://api.unsplash.com/williamnot",
      "photos": "http://api.unsplash.com/users/williamnot/photos",
      "likes": "http://api.unsplash.com/users/williamnot/likes"
    }
  }
}

Collections

Link relations

Collections have the following link relations:

relDescription
selfAPI location of this collection.
htmlHTML location of this collection.
photosAPI location of this collection's photos.
relatedAPI location of this collection's related collections. (Non-curated collections only)
downloadDownload location of this collection's zip file. (Curated collections only)

List collections

Get a single page from the list of all collections.

1
GET /collections

Parameters

paramDescription
pagePage number to retrieve. (Optional; default: 1)
per_pageNumber of items per page. (Optional; default: 10)

Response

1
2
3
4
200 OK
Link: <https://api.unsplash.com/collections?page=8>; rel="last", <https://api.unsplash.com/collections?page=2>; rel="next"
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "collection_list.json" %>

List featured collections

Get a single page from the list of featured collections.

1
GET /collections/featured

Parameters

paramDescription
pagePage number to retrieve. (Optional; default: 1)
per_pageNumber of items per page. (Optional; default: 10)

Response

1
2
3
4
200 OK
Link: <https://api.unsplash.com/collections/featured?page=8>; rel="last", <https://api.unsplash.com/collections/featured?page=2>; rel="next"
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "collection_list.json" %>

List curated collections

Get a single page from the list of curated collections.

1
GET /collections/curated

Parameters

paramDescription
pagePage number to retrieve. (Optional; default: 1)
per_pageNumber of items per page. (Optional; default: 10)

Response

1
2
3
4
200 OK
Link: <https://api.unsplash.com/collections/curated?page=8>; rel="last", <https://api.unsplash.com/collections/curated?page=2>; rel="next"
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "collection_list.json" %>

Get a collection

Retrieve a single collection. Viewing a user's private collections requires the read_collections scope.

1
GET /collections/:id

Or, for a curated collection:

1
GET /collections/curated/:id

Note: See the note on hotlinking.

Parameters

paramDescription
idThe collections's ID. Required.

Response

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "collection.json" %>

Get photos in a collection

Use the command below to retrieve a collection's photos.

1
GET /collections/:id/photos

Or, for a curated collection:

1
GET /collections/curated/:id/photos

Note: See the note on hotlinking.

Parameters

paramDescription
idThe collection's ID. Required.
pagePage number to retrieve. (Optional; default: 1)
per_pageNumber of items per page. (Optional; default: 10)

Response

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "photo_list.json" %>

List a collection's related collections

Retrieve a list of collections related to this one.

1
GET /collections/:id/related

Parameters

paramDescription
idThe collection's ID. Required.

Response

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "collection_list.json" %>

Create a new collection

Create a new collection. This requires the write_collections scope.

1
POST /collections

Parameters

paramDescription
titleThe title of the collection. (Required.)
descriptionThe collection's description. (Optional.)
privateWhether to make this collection private. (Optional; default false).

Response

Responds with the new collection:

1
2
3
201 Created
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "collection.json" %>

Update an existing collection

Update an existing collection belonging to the logged-in user. This requires the write_collections scope.

1
PUT /collections/:id

Parameters

paramDescription
titleThe title of the collection. (Optional.)
descriptionThe collection's description. (Optional.)
privateWhether to make this collection private. (Optional.)

Response

Responds with the updated collection:

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "collection.json" %>

Delete a collection

Delete a collection belonging to the logged-in user. This requires the write_collections scope.

1
DELETE /collections/:id

Parameters

paramDescription
idThe collection's ID. Required.

Response

Responds with a 204 status and an empty body.

1
2
3
204 No Content
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999

Add a photo to a collection

Add a photo to one of the logged-in user's collections. Requires the write_collections scope.

1
POST /collections/:collection_id/add

Note: If the photo is already in the collection, this acion has no effect.

Parameters

paramDescription
collection_idThe collection's ID. Required.
photo_idThe photo's ID. Required.

Response

1
2
3
201 Created
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "collected_photo.json" %>

Remove a photo from a collection

Remove a photo from one of the logged-in user's collections. Requires the write_collections scope.

1
DELETE /collections/:collection_id/remove

Parameters

paramDescription
collection_idThe collection's ID. Required.
photo_idThe photo's ID. Required.

Response

1
2
3
200 Success
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
<%= render "collected_photo.json" %>

Stats

Totals

Get a list of counts for all of Unsplash.

1
GET /stats/total

Response

1
2
3
200 OK
X-Ratelimit-Limit: 1000
X-Ratelimit-Remaining: 999
1
2
3
4
{
  "total_photos": 88350,
  "photo_downloads": 40775186
}

Conclusion

Hopefully you found this guide detailing tha various Unsplash API components to be useful and easy to follow. Thanks for reading!

3