1 /**
2 * @oas [get] /admin/inventory-items
3 * operationId: GetInventoryItems
4 * summary: List Inventory Items
5 * description: Retrieve a list of inventory items. The inventory items can be filtered by fields such as `id`. The inventory items can also be sorted or paginated.
6 * x-authenticated: true
7 * parameters:
8 * - name: fields
9 * in: query
10 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
11 * fields. without prefix it will replace the entire default fields.
12 * required: false
13 * schema:
14 * type: string
15 * title: fields
16 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
17 * fields. without prefix it will replace the entire default fields.
18 * externalDocs:
19 * url: "#select-fields-and-relations"
20 * - name: offset
21 * in: query
22 * description: The number of items to skip when retrieving a list.
23 * required: false
24 * schema:
25 * type: number
26 * title: offset
27 * description: The number of items to skip when retrieving a list.
28 * externalDocs:
29 * url: "#pagination"
30 * - name: limit
31 * in: query
32 * description: Limit the number of items returned in the list.
33 * required: false
34 * schema:
35 * type: number
36 * title: limit
37 * description: Limit the number of items returned in the list.
38 * externalDocs:
39 * url: "#pagination"
40 * - name: order
41 * in: query
42 * description: The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`.
43 * required: false
44 * schema:
45 * type: string
46 * title: order
47 * description: The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`.
48 * - name: q
49 * in: query
50 * description: The inventory item's q.
51 * required: false
52 * schema:
53 * type: string
54 * title: q
55 * description: The inventory item's q.
56 * - name: id
57 * in: query
58 * required: false
59 * schema:
60 * oneOf:
61 * - type: string
62 * title: id
63 * description: The inventory item's ID.
64 * - type: array
65 * description: The inventory item's ID.
66 * items:
67 * type: string
68 * title: id
69 * description: The id's ID.
70 * - name: sku
71 * in: query
72 * required: false
73 * schema:
74 * oneOf:
75 * - type: string
76 * title: sku
77 * description: The inventory item's sku.
78 * - type: array
79 * description: The inventory item's sku.
80 * items:
81 * type: string
82 * title: sku
83 * description: The sku's details.
84 * - name: origin_country
85 * in: query
86 * required: false
87 * schema:
88 * oneOf:
89 * - type: string
90 * title: origin_country
91 * description: The inventory item's origin country.
92 * - type: array
93 * description: The inventory item's origin country.
94 * items:
95 * type: string
96 * title: origin_country
97 * description: The origin country's details.
98 * - name: mid_code
99 * in: query
100 * required: false
101 * schema:
102 * oneOf:
103 * - type: string
104 * title: mid_code
105 * description: The inventory item's mid code.
106 * - type: array
107 * description: The inventory item's mid code.
108 * items:
109 * type: string
110 * title: mid_code
111 * description: The mid code's details.
112 * - name: hs_code
113 * in: query
114 * required: false
115 * schema:
116 * oneOf:
117 * - type: string
118 * title: hs_code
119 * description: The inventory item's hs code.
120 * - type: array
121 * description: The inventory item's hs code.
122 * items:
123 * type: string
124 * title: hs_code
125 * description: The hs code's details.
126 * - name: material
127 * in: query
128 * required: false
129 * schema:
130 * oneOf:
131 * - type: string
132 * title: material
133 * description: The inventory item's material.
134 * - type: array
135 * description: The inventory item's material.
136 * items:
137 * type: string
138 * title: material
139 * description: The material's details.
140 * - name: requires_shipping
141 * in: query
142 * description: The inventory item's requires shipping.
143 * required: false
144 * schema:
145 * type: boolean
146 * title: requires_shipping
147 * description: The inventory item's requires shipping.
148 * - name: weight
149 * in: query
150 * description: Filter the inventory item's weight.
151 * required: false
152 * schema:
153 * description: Filter the inventory item's weight.
154 * properties:
155 * $eq:
156 * type: string
157 * description: Filter by an exact match.
158 * $ne:
159 * type: string
160 * description: Filter by values not matching this parameter.
161 * $in:
162 * type: array
163 * description: Filter by values in this array's items.
164 * items:
165 * type: string
166 * $nin:
167 * type: array
168 * description: Filter by values not in this array's items.
169 * items:
170 * type: string
171 * $like:
172 * type: string
173 * description: Apply a `like` filter. Useful for strings only.
174 * $ilike:
175 * type: string
176 * description: Apply a case-insensitive `like` filter. Useful for strings only.
177 * $re:
178 * type: string
179 * description: Apply a regex filter. Useful for strings only.
180 * $contains:
181 * type: array
182 * description: Filter arrays that contain some of the values of this parameter.
183 * items:
184 * type: string
185 * $gt:
186 * type: string
187 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
188 * $gte:
189 * type: string
190 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
191 * $lt:
192 * type: string
193 * description: Filter by values less than this parameter. Useful for numbers and dates only.
194 * $lte:
195 * type: string
196 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
197 * - name: length
198 * in: query
199 * description: Filter the inventory item's length.
200 * required: false
201 * schema:
202 * description: Filter the inventory item's length.
203 * properties:
204 * $eq:
205 * type: string
206 * description: Filter by an exact match.
207 * $ne:
208 * type: string
209 * description: Filter by values not matching this parameter.
210 * $in:
211 * type: array
212 * description: Filter by values in this array's items.
213 * items:
214 * type: string
215 * $nin:
216 * type: array
217 * description: Filter by values not in this array's items.
218 * items:
219 * type: string
220 * $like:
221 * type: string
222 * description: Apply a `like` filter. Useful for strings only.
223 * $ilike:
224 * type: string
225 * description: Apply a case-insensitive `like` filter. Useful for strings only.
226 * $re:
227 * type: string
228 * description: Apply a regex filter. Useful for strings only.
229 * $contains:
230 * type: array
231 * description: Filter arrays that contain some of the values of this parameter.
232 * items:
233 * type: string
234 * $gt:
235 * type: string
236 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
237 * $gte:
238 * type: string
239 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
240 * $lt:
241 * type: string
242 * description: Filter by values less than this parameter. Useful for numbers and dates only.
243 * $lte:
244 * type: string
245 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
246 * - name: height
247 * in: query
248 * description: Filter by the inventory item's height.
249 * required: false
250 * schema:
251 * description: Filter by the inventory item's height.
252 * properties:
253 * $eq:
254 * type: string
255 * description: Filter by an exact match.
256 * $ne:
257 * type: string
258 * description: Filter by values not matching this parameter.
259 * $in:
260 * type: array
261 * description: Filter by values in this array's items.
262 * items:
263 * type: string
264 * $nin:
265 * type: array
266 * description: Filter by values not in this array's items.
267 * items:
268 * type: string
269 * $like:
270 * type: string
271 * description: Apply a `like` filter. Useful for strings only.
272 * $ilike:
273 * type: string
274 * description: Apply a case-insensitive `like` filter. Useful for strings only.
275 * $re:
276 * type: string
277 * description: Apply a regex filter. Useful for strings only.
278 * $contains:
279 * type: array
280 * description: Filter arrays that contain some of the values of this parameter.
281 * items:
282 * type: string
283 * $gt:
284 * type: string
285 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
286 * $gte:
287 * type: string
288 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
289 * $lt:
290 * type: string
291 * description: Filter by values less than this parameter. Useful for numbers and dates only.
292 * $lte:
293 * type: string
294 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
295 * - name: width
296 * in: query
297 * description: Filter by the inventory item's width.
298 * required: false
299 * schema:
300 * description: Filter by the inventory item's width.
301 * properties:
302 * $eq:
303 * type: string
304 * description: Filter by an exact match.
305 * $ne:
306 * type: string
307 * description: Filter by values not matching this parameter.
308 * $in:
309 * type: array
310 * description: Filter by values in this array's items.
311 * items:
312 * type: string
313 * $nin:
314 * type: array
315 * description: Filter by values not in this array's items.
316 * items:
317 * type: string
318 * $like:
319 * type: string
320 * description: Apply a `like` filter. Useful for strings only.
321 * $ilike:
322 * type: string
323 * description: Apply a case-insensitive `like` filter. Useful for strings only.
324 * $re:
325 * type: string
326 * description: Apply a regex filter. Useful for strings only.
327 * $contains:
328 * type: array
329 * description: Filter arrays that contain some of the values of this parameter.
330 * items:
331 * type: string
332 * $gt:
333 * type: string
334 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
335 * $gte:
336 * type: string
337 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
338 * $lt:
339 * type: string
340 * description: Filter by values less than this parameter. Useful for numbers and dates only.
341 * $lte:
342 * type: string
343 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
344 * - name: location_levels
345 * in: query
346 * description: Filter by the inventory item's associated location IDs.
347 * required: false
348 * schema:
349 * type: object
350 * description: Filter by the inventory item's associated location IDs.
351 * properties:
352 * location_id:
353 * oneOf:
354 * - type: string
355 * title: location_id
356 * description: The associated location's ID.
357 * - type: array
358 * description: The location IDs to retrieve inventory items associated with them.
359 * items:
360 * type: string
361 * title: location_id
362 * description: A location's ID.
363 * - name: $and
364 * in: query
365 * required: false
366 * schema:
367 * type: array
368 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
369 * items:
370 * type: object
371 * title: $and
372 * - name: $or
373 * in: query
374 * required: false
375 * schema:
376 * type: array
377 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
378 * items:
379 * type: object
380 * title: $or
381 * - name: with_deleted
382 * in: query
383 * description: Whether to include deleted records in the result.
384 * required: false
385 * schema:
386 * type: boolean
387 * title: with_deleted
388 * description: Whether to include deleted records in the result.
389 * security:
390 * - api_token: []
391 * - cookie_auth: []
392 * - jwt_token: []
393 * x-codeSamples:
394 * - lang: JavaScript
395 * label: JS SDK
396 * source: |-
397 * import Medusa from "@medusajs/js-sdk"
398 *
399 * export const sdk = new Medusa({
400 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
401 * debug: import.meta.env.DEV,
402 * auth: {
403 * type: "session",
404 * },
405 * })
406 *
407 * sdk.admin.inventoryItem.list()
408 * .then(({ inventory_items, count, limit, offset }) => {
409 * console.log(inventory_items)
410 * })
411 * - lang: Shell
412 * label: cURL
413 * source: |-
414 * curl '{backend_url}/admin/inventory-items' \
415 * -H 'Authorization: Bearer {jwt_token}'
416 * tags:
417 * - Inventory Items
418 * responses:
419 * "200":
420 * description: OK
421 * content:
422 * application/json:
423 * schema:
424 * allOf:
425 * - type: object
426 * description: The paginated list of inventory items.
427 * required:
428 * - limit
429 * - offset
430 * - count
431 * properties:
432 * limit:
433 * type: number
434 * title: limit
435 * description: The maximum number of items returned.
436 * offset:
437 * type: number
438 * title: offset
439 * description: The number of items skipped before retrieving the returned items.
440 * count:
441 * type: number
442 * title: count
443 * description: The total number of items.
444 * - type: object
445 * description: The paginated list of inventory items.
446 * required:
447 * - inventory_items
448 * properties:
449 * inventory_items:
450 * type: array
451 * description: The inventory item's inventory items.
452 * items:
453 * $ref: "#/components/schemas/AdminInventoryItem"
454 * "400":
455 * $ref: "#/components/responses/400_error"
456 * "401":
457 * $ref: "#/components/responses/unauthorized"
458 * "404":
459 * $ref: "#/components/responses/not_found_error"
460 * "409":
461 * $ref: "#/components/responses/invalid_state_error"
462 * "422":
463 * $ref: "#/components/responses/invalid_request_error"
464 * "500":
465 * $ref: "#/components/responses/500_error"
466 *
467 */
468