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