0

Run multiple image searches

by
Published Oct 17, 2025

This endpoint runs up to 5 image searches in a single request and returns up to 20 results per search. You can provide global search parameters in the query parameters and override them for each search in the body parameter. The query and body parameters are the same as in the `GET /v2/images/search` endpoint.

Script shutterstock Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Shutterstock = {
3
  token: string;
4
};
5
/**
6
 * Run multiple image searches
7
 * This endpoint runs up to 5 image searches in a single request and returns up to 20 results per search. You can provide global search parameters in the query parameters and override them for each search in the body parameter. The query and body parameters are the same as in the `GET /v2/images/search` endpoint.
8
 */
9
export async function main(
10
  auth: Shutterstock,
11
  added_date: string | undefined,
12
  added_date_start: string | undefined,
13
  aspect_ratio_min: string | undefined,
14
  aspect_ratio_max: string | undefined,
15
  aspect_ratio: string | undefined,
16
  added_date_end: string | undefined,
17
  category: string | undefined,
18
  color: string | undefined,
19
  contributor: string | undefined,
20
  contributor_country: string | undefined,
21
  fields: string | undefined,
22
  height: string | undefined,
23
  height_from: string | undefined,
24
  height_to: string | undefined,
25
  image_type: string | undefined,
26
  keyword_safe_search: string | undefined,
27
  language:
28
    | "ar"
29
    | "bg"
30
    | "bn"
31
    | "cs"
32
    | "da"
33
    | "de"
34
    | "el"
35
    | "en"
36
    | "es"
37
    | "fi"
38
    | "fr"
39
    | "gu"
40
    | "he"
41
    | "hi"
42
    | "hr"
43
    | "hu"
44
    | "id"
45
    | "it"
46
    | "ja"
47
    | "kn"
48
    | "ko"
49
    | "ml"
50
    | "mr"
51
    | "nb"
52
    | "nl"
53
    | "or"
54
    | "pl"
55
    | "pt"
56
    | "ro"
57
    | "ru"
58
    | "sk"
59
    | "sl"
60
    | "sv"
61
    | "ta"
62
    | "te"
63
    | "th"
64
    | "tr"
65
    | "uk"
66
    | "ur"
67
    | "vi"
68
    | "zh"
69
    | "zh-Hant"
70
    | undefined,
71
  license: string | undefined,
72
  model: string | undefined,
73
  orientation: "horizontal" | "vertical" | undefined,
74
  page: string | undefined,
75
  per_page: string | undefined,
76
  people_model_released: string | undefined,
77
  people_age:
78
    | "infants"
79
    | "children"
80
    | "teenagers"
81
    | "20s"
82
    | "30s"
83
    | "40s"
84
    | "50s"
85
    | "60s"
86
    | "older"
87
    | undefined,
88
  people_ethnicity: string | undefined,
89
  people_gender: "male" | "female" | "both" | undefined,
90
  people_number: string | undefined,
91
  region: string | undefined,
92
  safe: string | undefined,
93
  sort: "newest" | "popular" | "relevance" | "random" | undefined,
94
  spellcheck_query: string | undefined,
95
  view: "minimal" | "full" | undefined,
96
  width: string | undefined,
97
  width_from: string | undefined,
98
  width_to: string | undefined,
99
  body: {
100
    added_date?: string;
101
    added_date_start?: string;
102
    aspect_ratio_min?: number;
103
    aspect_ratio_max?: number;
104
    aspect_ratio?: number;
105
    added_date_end?: string;
106
    authentic?: false | true;
107
    category?: string;
108
    color?: string;
109
    contributor?: string[];
110
    contributor_country?: string[];
111
    fields?: string;
112
    height?: number;
113
    height_from?: number;
114
    height_to?: number;
115
    image_type?: "photo" | "illustration" | "vector"[];
116
    keyword_safe_search?: false | true;
117
    language?:
118
      | "ar"
119
      | "bg"
120
      | "bn"
121
      | "cs"
122
      | "da"
123
      | "de"
124
      | "el"
125
      | "en"
126
      | "es"
127
      | "fi"
128
      | "fr"
129
      | "gu"
130
      | "he"
131
      | "hi"
132
      | "hr"
133
      | "hu"
134
      | "id"
135
      | "it"
136
      | "ja"
137
      | "kn"
138
      | "ko"
139
      | "ml"
140
      | "mr"
141
      | "nb"
142
      | "nl"
143
      | "or"
144
      | "pl"
145
      | "pt"
146
      | "ro"
147
      | "ru"
148
      | "sk"
149
      | "sl"
150
      | "sv"
151
      | "ta"
152
      | "te"
153
      | "th"
154
      | "tr"
155
      | "uk"
156
      | "ur"
157
      | "vi"
158
      | "zh"
159
      | "zh-Hant";
160
    license?: "commercial" | "editorial" | "enhanced"[];
161
    model?: string[];
162
    orientation?: "horizontal" | "vertical";
163
    page?: number;
164
    per_page?: number;
165
    people_model_released?: false | true;
166
    people_age?:
167
      | "infants"
168
      | "children"
169
      | "teenagers"
170
      | "20s"
171
      | "30s"
172
      | "40s"
173
      | "50s"
174
      | "60s"
175
      | "older";
176
    people_ethnicity?:
177
      | "african"
178
      | "african_american"
179
      | "black"
180
      | "brazilian"
181
      | "chinese"
182
      | "caucasian"
183
      | "east_asian"
184
      | "hispanic"
185
      | "japanese"
186
      | "middle_eastern"
187
      | "native_american"
188
      | "pacific_islander"
189
      | "south_asian"
190
      | "southeast_asian"
191
      | "other"
192
      | "NOT african"
193
      | "NOT african_american"
194
      | "NOT black"
195
      | "NOT brazilian"
196
      | "NOT chinese"
197
      | "NOT caucasian"
198
      | "NOT east_asian"
199
      | "NOT hispanic"
200
      | "NOT japanese"
201
      | "NOT middle_eastern"
202
      | "NOT native_american"
203
      | "NOT pacific_islander"
204
      | "NOT south_asian"
205
      | "NOT southeast_asian"
206
      | "NOT other"[];
207
    people_gender?: "male" | "female" | "both";
208
    people_number?: number;
209
    query?: string;
210
    region?: string;
211
    safe?: false | true;
212
    sort?: "newest" | "popular" | "relevance" | "random";
213
    spellcheck_query?: false | true;
214
    view?: "minimal" | "full";
215
    width?: number;
216
    width_from?: number;
217
    width_to?: number;
218
  }[],
219
) {
220
  const url = new URL(`https://api.shutterstock.com/v2/bulk_search/images`);
221
  for (const [k, v] of [
222
    ["added_date", added_date],
223
    ["added_date_start", added_date_start],
224
    ["aspect_ratio_min", aspect_ratio_min],
225
    ["aspect_ratio_max", aspect_ratio_max],
226
    ["aspect_ratio", aspect_ratio],
227
    ["added_date_end", added_date_end],
228
    ["category", category],
229
    ["color", color],
230
    ["contributor", contributor],
231
    ["contributor_country", contributor_country],
232
    ["fields", fields],
233
    ["height", height],
234
    ["height_from", height_from],
235
    ["height_to", height_to],
236
    ["image_type", image_type],
237
    ["keyword_safe_search", keyword_safe_search],
238
    ["language", language],
239
    ["license", license],
240
    ["model", model],
241
    ["orientation", orientation],
242
    ["page", page],
243
    ["per_page", per_page],
244
    ["people_model_released", people_model_released],
245
    ["people_age", people_age],
246
    ["people_ethnicity", people_ethnicity],
247
    ["people_gender", people_gender],
248
    ["people_number", people_number],
249
    ["region", region],
250
    ["safe", safe],
251
    ["sort", sort],
252
    ["spellcheck_query", spellcheck_query],
253
    ["view", view],
254
    ["width", width],
255
    ["width_from", width_from],
256
    ["width_to", width_to],
257
  ]) {
258
    if (v !== undefined && v !== "" && k !== undefined) {
259
      url.searchParams.append(k, v);
260
    }
261
  }
262
  const response = await fetch(url, {
263
    method: "POST",
264
    headers: {
265
      "Content-Type": "application/json",
266
      Authorization: "Bearer " + auth.token,
267
    },
268
    body: JSON.stringify(body),
269
  });
270
  if (!response.ok) {
271
    const text = await response.text();
272
    throw new Error(`${response.status} ${text}`);
273
  }
274
  return await response.json();
275
}
276