1 /**
2 * @oas [get] /admin/collections
3 * operationId: GetCollections
4 * summary: List Collections
5 * description: Retrieve a list of collections. The collections can be filtered by fields such as `id`. The collections 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: deleted_at
49 * in: query
50 * description: Filter by the collection's deletion date.
51 * required: false
52 * schema:
53 * type: object
54 * description: Filter by the collection's deletion date.
55 * properties:
56 * $and:
57 * type: array
58 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
59 * items:
60 * type: object
61 * title: $and
62 * $or:
63 * type: array
64 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
65 * items:
66 * type: object
67 * title: $or
68 * $eq:
69 * oneOf:
70 * - type: string
71 * title: $eq
72 * description: Filter by an exact match.
73 * - type: array
74 * description: Filter by multiple exact matches.
75 * items:
76 * type: string
77 * title: $eq
78 * description: An exact match.
79 * $ne:
80 * type: string
81 * title: $ne
82 * description: Filter by values not equal to this parameter.
83 * $in:
84 * type: array
85 * description: Filter by values in this array.
86 * items:
87 * type: string
88 * title: $in
89 * description: The value to match.
90 * $nin:
91 * type: array
92 * description: Filter by values not in this array.
93 * items:
94 * type: string
95 * title: $nin
96 * description: The value not to match.
97 * $not:
98 * oneOf:
99 * - type: string
100 * title: $not
101 * description: Filter by values not matching this parameter.
102 * - type: object
103 * description: Filter by values not matching the conditions in this parameter.
104 * properties:
105 * $and:
106 * type: array
107 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
108 * items:
109 * type: object
110 * title: $and
111 * $or:
112 * type: array
113 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
114 * items:
115 * type: object
116 * title: $or
117 * $eq:
118 * oneOf:
119 * - type: string
120 * title: $eq
121 * description: Filter by an exact match.
122 * - type: array
123 * description: Filter by multiple exact matches.
124 * items:
125 * type: string
126 * title: $eq
127 * description: The value to match.
128 * $ne:
129 * type: string
130 * title: $ne
131 * description: Filter by values not matching this parameter.
132 * $in:
133 * type: array
134 * description: Filter by values in this array.
135 * items:
136 * type: string
137 * title: $in
138 * description: The value to match.
139 * $nin:
140 * type: array
141 * description: Filter by values not in this array.
142 * items:
143 * type: string
144 * title: $nin
145 * description: The value to not match
146 * $not:
147 * oneOf:
148 * - type: string
149 * title: $not
150 * description: Filter by values not matching this parameter
151 * - type: object
152 * description: Filter by values not matching the conditions in this parameter.
153 * - type: array
154 * description: Filter by values not matching the values of this parameter.
155 * items:
156 * type: string
157 * title: $not
158 * description: The values to not match.
159 * $gt:
160 * type: string
161 * title: $gt
162 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
163 * $gte:
164 * type: string
165 * title: $gte
166 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
167 * $lt:
168 * type: string
169 * title: $lt
170 * description: Filter by values less than this parameter. Useful for numbers and dates only.
171 * $lte:
172 * type: string
173 * title: $lte
174 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
175 * $like:
176 * type: string
177 * title: $like
178 * description: Apply a `like` filter. Useful for strings only.
179 * $re:
180 * type: string
181 * title: $re
182 * description: Apply a regex filter. Useful for strings only.
183 * $ilike:
184 * type: string
185 * title: $ilike
186 * description: Apply a case-insensitive `like` filter. Useful for strings only.
187 * $fulltext:
188 * type: string
189 * title: $fulltext
190 * description: Filter to apply on full-text properties.
191 * $overlap:
192 * type: array
193 * description: Filter arrays that have overlapping values with this parameter.
194 * items:
195 * type: string
196 * title: $overlap
197 * description: The value to match.
198 * $contains:
199 * type: array
200 * description: Filter arrays that contain some of the values of this parameter.
201 * items:
202 * type: string
203 * title: $contains
204 * description: The values to match.
205 * $contained:
206 * type: array
207 * description: Filter arrays that contain all values of this parameter.
208 * items:
209 * type: string
210 * title: $contained
211 * description: The values to match.
212 * $exists:
213 * type: boolean
214 * title: $exists
215 * description: Filter by whether a value for this parameter exists (not `null`).
216 * - type: array
217 * description: Filter by values not matching those in this parameter.
218 * items:
219 * type: string
220 * title: $not
221 * description: The values to not match.
222 * $gt:
223 * type: string
224 * title: $gt
225 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
226 * $gte:
227 * type: string
228 * title: $gte
229 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
230 * $lt:
231 * type: string
232 * title: $lt
233 * description: Filter by values less than this parameter. Useful for numbers and dates only.
234 * $lte:
235 * type: string
236 * title: $lte
237 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
238 * $like:
239 * type: string
240 * title: $like
241 * description: Apply a `like` filter. Useful for strings only.
242 * $re:
243 * type: string
244 * title: $re
245 * description: Apply a regex filter. Useful for strings only.
246 * $ilike:
247 * type: string
248 * title: $ilike
249 * description: Apply a case-insensitive `like` filter. Useful for strings only.
250 * $fulltext:
251 * type: string
252 * title: $fulltext
253 * description: Filter to apply on full-text properties.
254 * $overlap:
255 * type: array
256 * description: Filter arrays that have overlapping values with this parameter.
257 * items:
258 * type: string
259 * title: $overlap
260 * description: The values to match.
261 * $contains:
262 * type: array
263 * description: Filter arrays that contain some of the values of this parameter.
264 * items:
265 * type: string
266 * title: $contains
267 * description: The values to match.
268 * $contained:
269 * type: array
270 * description: Filter arrays that contain all values of this parameter.
271 * items:
272 * type: string
273 * title: $contained
274 * description: The values to match.
275 * $exists:
276 * type: boolean
277 * title: $exists
278 * description: Filter by whether a value for this parameter exists (not `null`).
279 * title: deleted_at
280 * - name: q
281 * in: query
282 * description: Search term to filter the collection's searchable properties by.
283 * required: false
284 * schema:
285 * type: string
286 * title: q
287 * description: Search term to filter the collection's searchable properties by.
288 * - name: id
289 * in: query
290 * required: false
291 * schema:
292 * oneOf:
293 * - type: string
294 * title: id
295 * description: Filter by a collection's ID.
296 * - type: array
297 * description: Filter by collection IDs.
298 * items:
299 * type: string
300 * title: id
301 * description: The collection's ID.
302 * - name: handle
303 * in: query
304 * required: false
305 * schema:
306 * oneOf:
307 * - type: string
308 * title: handle
309 * description: Filter by a collection's handle.
310 * - type: array
311 * description: Filter by collection handles.
312 * items:
313 * type: string
314 * title: handle
315 * description: The collection's handle.
316 * - name: title
317 * in: query
318 * required: false
319 * schema:
320 * oneOf:
321 * - type: string
322 * title: title
323 * description: Filter by a collection's title.
324 * - type: array
325 * description: Filter by collection titles.
326 * items:
327 * type: string
328 * title: title
329 * description: The collection's title.
330 * - name: created_at
331 * in: query
332 * description: Filter by the collection's creation date.
333 * required: false
334 * schema:
335 * type: object
336 * description: Filter by the collection's creation date.
337 * properties:
338 * $and:
339 * type: array
340 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
341 * items:
342 * type: object
343 * title: $and
344 * $or:
345 * type: array
346 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
347 * items:
348 * type: object
349 * title: $or
350 * $eq:
351 * oneOf:
352 * - type: string
353 * title: $eq
354 * description: Filter by an exact match.
355 * - type: array
356 * description: Filter by multiple exact matches.
357 * items:
358 * type: string
359 * title: $eq
360 * description: An exact match.
361 * $ne:
362 * type: string
363 * title: $ne
364 * description: Filter by values not equal to this parameter.
365 * $in:
366 * type: array
367 * description: Filter by values in this array.
368 * items:
369 * type: string
370 * title: $in
371 * description: The value to match.
372 * $nin:
373 * type: array
374 * description: Filter by values not in this array.
375 * items:
376 * type: string
377 * title: $nin
378 * description: The value not to match.
379 * $not:
380 * oneOf:
381 * - type: string
382 * title: $not
383 * description: Filter by values not matching this parameter.
384 * - type: object
385 * description: Filter by values not matching the conditions in this parameter.
386 * properties:
387 * $and:
388 * type: array
389 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
390 * items:
391 * type: object
392 * title: $and
393 * $or:
394 * type: array
395 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
396 * items:
397 * type: object
398 * title: $or
399 * $eq:
400 * oneOf:
401 * - type: string
402 * title: $eq
403 * description: Filter by an exact match.
404 * - type: array
405 * description: Filter by multiple exact matches.
406 * items:
407 * type: string
408 * title: $eq
409 * description: The value to match.
410 * $ne:
411 * type: string
412 * title: $ne
413 * description: Filter by values not matching this parameter.
414 * $in:
415 * type: array
416 * description: Filter by values in this array.
417 * items:
418 * type: string
419 * title: $in
420 * description: The value to match.
421 * $nin:
422 * type: array
423 * description: Filter by values not in this array.
424 * items:
425 * type: string
426 * title: $nin
427 * description: The value to not match
428 * $not:
429 * oneOf:
430 * - type: string
431 * title: $not
432 * description: Filter by values not matching this parameter
433 * - type: object
434 * description: Filter by values not matching the conditions in this parameter.
435 * - type: array
436 * description: Filter by values not matching the values of this parameter.
437 * items:
438 * type: string
439 * title: $not
440 * description: The values to not match.
441 * $gt:
442 * type: string
443 * title: $gt
444 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
445 * $gte:
446 * type: string
447 * title: $gte
448 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
449 * $lt:
450 * type: string
451 * title: $lt
452 * description: Filter by values less than this parameter. Useful for numbers and dates only.
453 * $lte:
454 * type: string
455 * title: $lte
456 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
457 * $like:
458 * type: string
459 * title: $like
460 * description: Apply a `like` filter. Useful for strings only.
461 * $re:
462 * type: string
463 * title: $re
464 * description: Apply a regex filter. Useful for strings only.
465 * $ilike:
466 * type: string
467 * title: $ilike
468 * description: Apply a case-insensitive `like` filter. Useful for strings only.
469 * $fulltext:
470 * type: string
471 * title: $fulltext
472 * description: Filter to apply on full-text properties.
473 * $overlap:
474 * type: array
475 * description: Filter arrays that have overlapping values with this parameter.
476 * items:
477 * type: string
478 * title: $overlap
479 * description: The value to match.
480 * $contains:
481 * type: array
482 * description: Filter arrays that contain some of the values of this parameter.
483 * items:
484 * type: string
485 * title: $contains
486 * description: The values to match.
487 * $contained:
488 * type: array
489 * description: Filter arrays that contain all values of this parameter.
490 * items:
491 * type: string
492 * title: $contained
493 * description: The values to match.
494 * $exists:
495 * type: boolean
496 * title: $exists
497 * description: Filter by whether a value for this parameter exists (not `null`).
498 * - type: array
499 * description: Filter by values not matching those in this parameter.
500 * items:
501 * type: string
502 * title: $not
503 * description: The values to not match.
504 * $gt:
505 * type: string
506 * title: $gt
507 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
508 * $gte:
509 * type: string
510 * title: $gte
511 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
512 * $lt:
513 * type: string
514 * title: $lt
515 * description: Filter by values less than this parameter. Useful for numbers and dates only.
516 * $lte:
517 * type: string
518 * title: $lte
519 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
520 * $like:
521 * type: string
522 * title: $like
523 * description: Apply a `like` filter. Useful for strings only.
524 * $re:
525 * type: string
526 * title: $re
527 * description: Apply a regex filter. Useful for strings only.
528 * $ilike:
529 * type: string
530 * title: $ilike
531 * description: Apply a case-insensitive `like` filter. Useful for strings only.
532 * $fulltext:
533 * type: string
534 * title: $fulltext
535 * description: Filter to apply on full-text properties.
536 * $overlap:
537 * type: array
538 * description: Filter arrays that have overlapping values with this parameter.
539 * items:
540 * type: string
541 * title: $overlap
542 * description: The values to match.
543 * $contains:
544 * type: array
545 * description: Filter arrays that contain some of the values of this parameter.
546 * items:
547 * type: string
548 * title: $contains
549 * description: The values to match.
550 * $contained:
551 * type: array
552 * description: Filter arrays that contain all values of this parameter.
553 * items:
554 * type: string
555 * title: $contained
556 * description: The values to match.
557 * $exists:
558 * type: boolean
559 * title: $exists
560 * description: Filter by whether a value for this parameter exists (not `null`).
561 * title: created_at
562 * - name: updated_at
563 * in: query
564 * description: Filter by the collection's update date.
565 * required: false
566 * schema:
567 * type: object
568 * description: Filter by the collection's update date.
569 * properties:
570 * $and:
571 * type: array
572 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
573 * items:
574 * type: object
575 * title: $and
576 * $or:
577 * type: array
578 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
579 * items:
580 * type: object
581 * title: $or
582 * $eq:
583 * oneOf:
584 * - type: string
585 * title: $eq
586 * description: Filter by an exact match.
587 * - type: array
588 * description: Filter by multiple exact matches.
589 * items:
590 * type: string
591 * title: $eq
592 * description: An exact match.
593 * $ne:
594 * type: string
595 * title: $ne
596 * description: Filter by values not equal to this parameter.
597 * $in:
598 * type: array
599 * description: Filter by values in this array.
600 * items:
601 * type: string
602 * title: $in
603 * description: The value to match.
604 * $nin:
605 * type: array
606 * description: Filter by values not in this array.
607 * items:
608 * type: string
609 * title: $nin
610 * description: The value not to match.
611 * $not:
612 * oneOf:
613 * - type: string
614 * title: $not
615 * description: Filter by values not matching this parameter.
616 * - type: object
617 * description: Filter by values not matching the conditions in this parameter.
618 * properties:
619 * $and:
620 * type: array
621 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
622 * items:
623 * type: object
624 * title: $and
625 * $or:
626 * type: array
627 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
628 * items:
629 * type: object
630 * title: $or
631 * $eq:
632 * oneOf:
633 * - type: string
634 * title: $eq
635 * description: Filter by an exact match.
636 * - type: array
637 * description: Filter by multiple exact matches.
638 * items:
639 * type: string
640 * title: $eq
641 * description: The value to match.
642 * $ne:
643 * type: string
644 * title: $ne
645 * description: Filter by values not matching this parameter.
646 * $in:
647 * type: array
648 * description: Filter by values in this array.
649 * items:
650 * type: string
651 * title: $in
652 * description: The value to match.
653 * $nin:
654 * type: array
655 * description: Filter by values not in this array.
656 * items:
657 * type: string
658 * title: $nin
659 * description: The value to not match
660 * $not:
661 * oneOf:
662 * - type: string
663 * title: $not
664 * description: Filter by values not matching this parameter
665 * - type: object
666 * description: Filter by values not matching the conditions in this parameter.
667 * - type: array
668 * description: Filter by values not matching the values of this parameter.
669 * items:
670 * type: string
671 * title: $not
672 * description: The values to not match.
673 * $gt:
674 * type: string
675 * title: $gt
676 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
677 * $gte:
678 * type: string
679 * title: $gte
680 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
681 * $lt:
682 * type: string
683 * title: $lt
684 * description: Filter by values less than this parameter. Useful for numbers and dates only.
685 * $lte:
686 * type: string
687 * title: $lte
688 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
689 * $like:
690 * type: string
691 * title: $like
692 * description: Apply a `like` filter. Useful for strings only.
693 * $re:
694 * type: string
695 * title: $re
696 * description: Apply a regex filter. Useful for strings only.
697 * $ilike:
698 * type: string
699 * title: $ilike
700 * description: Apply a case-insensitive `like` filter. Useful for strings only.
701 * $fulltext:
702 * type: string
703 * title: $fulltext
704 * description: Filter to apply on full-text properties.
705 * $overlap:
706 * type: array
707 * description: Filter arrays that have overlapping values with this parameter.
708 * items:
709 * type: string
710 * title: $overlap
711 * description: The value to match.
712 * $contains:
713 * type: array
714 * description: Filter arrays that contain some of the values of this parameter.
715 * items:
716 * type: string
717 * title: $contains
718 * description: The values to match.
719 * $contained:
720 * type: array
721 * description: Filter arrays that contain all values of this parameter.
722 * items:
723 * type: string
724 * title: $contained
725 * description: The values to match.
726 * $exists:
727 * type: boolean
728 * title: $exists
729 * description: Filter by whether a value for this parameter exists (not `null`).
730 * - type: array
731 * description: Filter by values not matching those in this parameter.
732 * items:
733 * type: string
734 * title: $not
735 * description: The values to not match.
736 * $gt:
737 * type: string
738 * title: $gt
739 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
740 * $gte:
741 * type: string
742 * title: $gte
743 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
744 * $lt:
745 * type: string
746 * title: $lt
747 * description: Filter by values less than this parameter. Useful for numbers and dates only.
748 * $lte:
749 * type: string
750 * title: $lte
751 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
752 * $like:
753 * type: string
754 * title: $like
755 * description: Apply a `like` filter. Useful for strings only.
756 * $re:
757 * type: string
758 * title: $re
759 * description: Apply a regex filter. Useful for strings only.
760 * $ilike:
761 * type: string
762 * title: $ilike
763 * description: Apply a case-insensitive `like` filter. Useful for strings only.
764 * $fulltext:
765 * type: string
766 * title: $fulltext
767 * description: Filter to apply on full-text properties.
768 * $overlap:
769 * type: array
770 * description: Filter arrays that have overlapping values with this parameter.
771 * items:
772 * type: string
773 * title: $overlap
774 * description: The values to match.
775 * $contains:
776 * type: array
777 * description: Filter arrays that contain some of the values of this parameter.
778 * items:
779 * type: string
780 * title: $contains
781 * description: The values to match.
782 * $contained:
783 * type: array
784 * description: Filter arrays that contain all values of this parameter.
785 * items:
786 * type: string
787 * title: $contained
788 * description: The values to match.
789 * $exists:
790 * type: boolean
791 * title: $exists
792 * description: Filter by whether a value for this parameter exists (not `null`).
793 * title: updated_at
794 * - name: $and
795 * in: query
796 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
797 * required: false
798 * schema:
799 * type: array
800 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
801 * items:
802 * type: object
803 * title: $and
804 * - name: $or
805 * in: query
806 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
807 * required: false
808 * schema:
809 * type: array
810 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
811 * items:
812 * type: object
813 * title: $or
814 * - name: with_deleted
815 * in: query
816 * description: Whether to include deleted records in the result.
817 * required: false
818 * schema:
819 * type: boolean
820 * title: with_deleted
821 * description: Whether to include deleted records in the result.
822 * - name: external_id
823 * in: query
824 * required: false
825 * schema:
826 * oneOf:
827 * - type: string
828 * title: external_id
829 * description: Filter by an external ID.
830 * - type: array
831 * description: Filter by multiple external IDs.
832 * items:
833 * type: string
834 * title: external_id
835 * description: An external ID.
836 * security:
837 * - api_token: []
838 * - cookie_auth: []
839 * - jwt_token: []
840 * x-codeSamples:
841 * - lang: JavaScript
842 * label: JS SDK
843 * source: |-
844 * import Medusa from "@medusajs/js-sdk"
845 *
846 * export const sdk = new Medusa({
847 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
848 * debug: import.meta.env.DEV,
849 * auth: {
850 * type: "session",
851 * },
852 * })
853 *
854 * sdk.admin.productCollection.list()
855 * .then(({ collections, count, limit, offset }) => {
856 * console.log(collections)
857 * })
858 * - lang: Shell
859 * label: cURL
860 * source: |-
861 * curl '{backend_url}/admin/collections' \
862 * -H 'Authorization: Bearer {jwt_token}'
863 * tags:
864 * - Collections
865 * responses:
866 * "200":
867 * description: OK
868 * content:
869 * application/json:
870 * schema:
871 * $ref: "#/components/schemas/AdminCollectionListResponse"
872 * "400":
873 * $ref: "#/components/responses/400_error"
874 * "401":
875 * $ref: "#/components/responses/unauthorized"
876 * "404":
877 * $ref: "#/components/responses/not_found_error"
878 * "409":
879 * $ref: "#/components/responses/invalid_state_error"
880 * "422":
881 * $ref: "#/components/responses/invalid_request_error"
882 * "500":
883 * $ref: "#/components/responses/500_error"
884 *
885 */
886