# Unsplash Photo Search API

> Search Unsplash 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 Unsplash page.

Source: https://www.sandbase.ai/apis/unsplash/search-photos
API reference: https://www.sandbase.ai/apis/unsplash/search-photos#api

## Facts

- Provider: Unsplash
- Type: Data API
- Endpoint: `POST https://api.sandbase.ai/v1/api/unsplash/search-photos`
- Price: From $0.0033 per call
- Capabilities: api, unsplash, images, stock photos
- Billing: pay per use from one SandBase balance; no provider account or subscription needed

## Call it

`POST https://api.sandbase.ai/v1/api/unsplash/search-photos` with `Authorization: Bearer $SANDBASE_API_KEY` and the parameters as a JSON body.

| Parameter | Type | Required | Allowed values |
| --- | --- | --- | --- |
| `query` | string | yes |  |
| `color` | string | no | black_and_white, black, white, yellow, orange, red, purple, magenta, green, teal, blue |
| `limit` | integer | no |  |
| `sortBy` | string | no | relevant, recent |
| `orientation` | string | no | landscape, portrait, square |

## FAQ

### How do I use the Unsplash Photo Search API?

Send a POST request to https://api.sandbase.ai/v1/api/unsplash/search-photos with your SandBase API key in the Authorization header (Bearer) and the parameters as a JSON body. You can also try it in the Playground on this page without writing code.

### How much does the Unsplash Photo Search API cost?

From $0.0033 per call, billed from your SandBase balance. You are only charged for calls you make; there is no subscription.

### What parameters does the Unsplash Photo Search API accept?

Required: query (string). Optional: color (one of black_and_white, black, white, yellow, orange, red, purple, magenta, green, teal, blue), limit (integer), sortBy (one of relevant, recent) and orientation (one of landscape, portrait, square). The Parameters table and the Playground on this page list every field.

### What does the Unsplash Photo Search API return?

A JSON response returned in the same HTTP request (synchronous).

### Do I need a Unsplash developer account or API key?

No. Unsplash Photo Search runs through SandBase, so one SandBase API key covers this endpoint and every other API and model in the catalog. You do not need to apply for Unsplash API access separately.

## README

### Unsplash Photo Search API

Search Unsplash 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 Unsplash page.

#### Request

```bash
curl -X POST "https://api.sandbase.ai/v1/run" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "unsplash/search-photos", "limit": 2, "query": "coffee"}'
```

The result is returned in `outputs[0].data`. Lookups that find nothing fail with a not-found error.

#### Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `query` | string | Yes | Keyword or phrase to search Unsplash photos for, e.g. "coffee" or "minimal workspace". |
| `color` | string | No | Only return photos with this dominant color tone. Omit for any color. One of: `black_and_white`, `black`, `white`, `yellow`, `orange`, `red`, `purple`, `magenta`, `green`, `teal`, `blue`. |
| `limit` | integer | No | Maximum number of photos to return (1-20, default 20). You are billed per photo returned, so a lower limit costs less. |
| `orientation` | string | No | Only return photos with this orientation. Omit for any orientation. One of: `landscape`, `portrait`, `square`. |
| `sortBy` | string | No | Order results by best match (relevant, the default) or newest first (recent). One of: `relevant`, `recent`. |

#### Pricing

Billed at the actual cost of each call: about $0.00165 per result returned, up to $0.0336 per request (about $0.0033 for the request above). A call can cost more when the first data source fails and another one answers. Failed calls and lookups that find nothing are not charged.
