1 /**
2 * @oas [get] /admin/orders
3 * operationId: GetOrders
4 * summary: List Orders
5 * description: Retrieve a list of orders. The orders can be filtered by fields such as `id`. The orders 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: id
49 * in: query
50 * required: false
51 * schema:
52 * oneOf:
53 * - type: string
54 * title: id
55 * description: Filter by an order ID.
56 * - type: array
57 * description: Filter by order IDs.
58 * items:
59 * type: string
60 * title: id
61 * description: An order's ID.
62 * - name: status
63 * in: query
64 * required: false
65 * schema:
66 * oneOf:
67 * - type: string
68 * title: status
69 * description: Filter by the order's status.
70 * - type: array
71 * description: Filter by order statuses.
72 * items:
73 * type: string
74 * title: status
75 * description: An order's status.
76 * - name: $and
77 * in: query
78 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
79 * required: false
80 * schema:
81 * type: array
82 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
83 * items:
84 * type: object
85 * title: $and
86 * - name: $or
87 * in: query
88 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
89 * required: false
90 * schema:
91 * type: array
92 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
93 * items:
94 * type: object
95 * title: $or
96 * - name: sales_channel_id
97 * in: query
98 * description: Filter by sales channel IDs to retrieve the orders associated with them.
99 * required: false
100 * schema:
101 * type: array
102 * description: Filter by sales channel IDs to retrieve the orders associated with them.
103 * items:
104 * type: string
105 * title: sales_channel_id
106 * description: A sales channel's ID.
107 * - name: region_id
108 * in: query
109 * description: Filter by region IDs to retrieve their associated orders.
110 * required: false
111 * schema:
112 * oneOf:
113 * - type: string
114 * title: region_id
115 * description: The order's region id.
116 * - type: array
117 * description: The order's region id.
118 * items:
119 * type: string
120 * title: region_id
121 * description: The region id's details.
122 * - name: q
123 * in: query
124 * description: Search term to filter the order's searchable properties.
125 * required: false
126 * schema:
127 * type: string
128 * title: q
129 * description: Search term to filter the order's searchable properties.
130 * - name: created_at
131 * in: query
132 * description: Filter by the order's creation date.
133 * required: false
134 * schema:
135 * type: object
136 * description: Filter by the order's creation date.
137 * properties:
138 * $and:
139 * type: array
140 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
141 * items:
142 * type: object
143 * title: $and
144 * $or:
145 * type: array
146 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
147 * items:
148 * type: object
149 * title: $or
150 * $eq:
151 * oneOf:
152 * - type: string
153 * title: $eq
154 * description: Filter by an exact match.
155 * - type: array
156 * description: Filter by multiple exact matches.
157 * items:
158 * type: string
159 * title: $eq
160 * description: An exact match.
161 * $ne:
162 * type: string
163 * title: $ne
164 * description: Filter by values not equal to this parameter.
165 * $in:
166 * type: array
167 * description: Filter by values in this array.
168 * items:
169 * type: string
170 * title: $in
171 * description: The value to match.
172 * $nin:
173 * type: array
174 * description: Filter by values not in this array.
175 * items:
176 * type: string
177 * title: $nin
178 * description: The value not to match.
179 * $not:
180 * oneOf:
181 * - type: string
182 * title: $not
183 * description: Filter by values not matching this parameter.
184 * - type: object
185 * description: Filter by values not matching the conditions in this parameter.
186 * properties:
187 * $and:
188 * type: array
189 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
190 * items:
191 * type: object
192 * title: $and
193 * $or:
194 * type: array
195 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
196 * items:
197 * type: object
198 * title: $or
199 * $eq:
200 * oneOf:
201 * - type: string
202 * title: $eq
203 * description: Filter by an exact match.
204 * - type: array
205 * description: Filter by multiple exact matches.
206 * items:
207 * type: string
208 * title: $eq
209 * description: The value to match.
210 * $ne:
211 * type: string
212 * title: $ne
213 * description: Filter by values not matching this parameter.
214 * $in:
215 * type: array
216 * description: Filter by values in this array.
217 * items:
218 * type: string
219 * title: $in
220 * description: The value to match.
221 * $nin:
222 * type: array
223 * description: Filter by values not in this array.
224 * items:
225 * type: string
226 * title: $nin
227 * description: The value to not match
228 * $not:
229 * oneOf:
230 * - type: string
231 * title: $not
232 * description: Filter by values not matching this parameter
233 * - type: object
234 * description: Filter by values not matching the conditions in this parameter.
235 * - type: array
236 * description: Filter by values not matching the values of this parameter.
237 * items:
238 * type: string
239 * title: $not
240 * description: The values to not match.
241 * $gt:
242 * type: string
243 * title: $gt
244 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
245 * $gte:
246 * type: string
247 * title: $gte
248 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
249 * $lt:
250 * type: string
251 * title: $lt
252 * description: Filter by values less than this parameter. Useful for numbers and dates only.
253 * $lte:
254 * type: string
255 * title: $lte
256 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
257 * $like:
258 * type: string
259 * title: $like
260 * description: Apply a `like` filter. Useful for strings only.
261 * $re:
262 * type: string
263 * title: $re
264 * description: Apply a regex filter. Useful for strings only.
265 * $ilike:
266 * type: string
267 * title: $ilike
268 * description: Apply a case-insensitive `like` filter. Useful for strings only.
269 * $fulltext:
270 * type: string
271 * title: $fulltext
272 * description: Filter to apply on full-text properties.
273 * $overlap:
274 * type: array
275 * description: Filter arrays that have overlapping values with this parameter.
276 * items:
277 * type: string
278 * title: $overlap
279 * description: The value to match.
280 * $contains:
281 * type: array
282 * description: Filter arrays that contain some of the values of this parameter.
283 * items:
284 * type: string
285 * title: $contains
286 * description: The values to match.
287 * $contained:
288 * type: array
289 * description: Filter arrays that contain all values of this parameter.
290 * items:
291 * type: string
292 * title: $contained
293 * description: The values to match.
294 * $exists:
295 * type: boolean
296 * title: $exists
297 * description: Filter by whether a value for this parameter exists (not `null`).
298 * - type: array
299 * description: Filter by values not matching those in this parameter.
300 * items:
301 * type: string
302 * title: $not
303 * description: The values to not match.
304 * $gt:
305 * type: string
306 * title: $gt
307 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
308 * $gte:
309 * type: string
310 * title: $gte
311 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
312 * $lt:
313 * type: string
314 * title: $lt
315 * description: Filter by values less than this parameter. Useful for numbers and dates only.
316 * $lte:
317 * type: string
318 * title: $lte
319 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
320 * $like:
321 * type: string
322 * title: $like
323 * description: Apply a `like` filter. Useful for strings only.
324 * $re:
325 * type: string
326 * title: $re
327 * description: Apply a regex filter. Useful for strings only.
328 * $ilike:
329 * type: string
330 * title: $ilike
331 * description: Apply a case-insensitive `like` filter. Useful for strings only.
332 * $fulltext:
333 * type: string
334 * title: $fulltext
335 * description: Filter to apply on full-text properties.
336 * $overlap:
337 * type: array
338 * description: Filter arrays that have overlapping values with this parameter.
339 * items:
340 * type: string
341 * title: $overlap
342 * description: The values to match.
343 * $contains:
344 * type: array
345 * description: Filter arrays that contain some of the values of this parameter.
346 * items:
347 * type: string
348 * title: $contains
349 * description: The values to match.
350 * $contained:
351 * type: array
352 * description: Filter arrays that contain all values of this parameter.
353 * items:
354 * type: string
355 * title: $contained
356 * description: The values to match.
357 * $exists:
358 * type: boolean
359 * title: $exists
360 * description: Filter by whether a value for this parameter exists (not `null`).
361 * title: created_at
362 * - name: updated_at
363 * in: query
364 * description: Filter by the order's update date.
365 * required: false
366 * schema:
367 * type: object
368 * description: Filter by the order's update date.
369 * properties:
370 * $and:
371 * type: array
372 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
373 * items:
374 * type: object
375 * title: $and
376 * $or:
377 * type: array
378 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
379 * items:
380 * type: object
381 * title: $or
382 * $eq:
383 * oneOf:
384 * - type: string
385 * title: $eq
386 * description: Filter by an exact match.
387 * - type: array
388 * description: Filter by multiple exact matches.
389 * items:
390 * type: string
391 * title: $eq
392 * description: An exact match.
393 * $ne:
394 * type: string
395 * title: $ne
396 * description: Filter by values not equal to this parameter.
397 * $in:
398 * type: array
399 * description: Filter by values in this array.
400 * items:
401 * type: string
402 * title: $in
403 * description: The value to match.
404 * $nin:
405 * type: array
406 * description: Filter by values not in this array.
407 * items:
408 * type: string
409 * title: $nin
410 * description: The value not to match.
411 * $not:
412 * oneOf:
413 * - type: string
414 * title: $not
415 * description: Filter by values not matching this parameter.
416 * - type: object
417 * description: Filter by values not matching the conditions in this parameter.
418 * properties:
419 * $and:
420 * type: array
421 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
422 * items:
423 * type: object
424 * title: $and
425 * $or:
426 * type: array
427 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
428 * items:
429 * type: object
430 * title: $or
431 * $eq:
432 * oneOf:
433 * - type: string
434 * title: $eq
435 * description: Filter by an exact match.
436 * - type: array
437 * description: Filter by multiple exact matches.
438 * items:
439 * type: string
440 * title: $eq
441 * description: The value to match.
442 * $ne:
443 * type: string
444 * title: $ne
445 * description: Filter by values not matching this parameter.
446 * $in:
447 * type: array
448 * description: Filter by values in this array.
449 * items:
450 * type: string
451 * title: $in
452 * description: The value to match.
453 * $nin:
454 * type: array
455 * description: Filter by values not in this array.
456 * items:
457 * type: string
458 * title: $nin
459 * description: The value to not match
460 * $not:
461 * oneOf:
462 * - type: string
463 * title: $not
464 * description: Filter by values not matching this parameter
465 * - type: object
466 * description: Filter by values not matching the conditions in this parameter.
467 * - type: array
468 * description: Filter by values not matching the values of this parameter.
469 * items:
470 * type: string
471 * title: $not
472 * description: The values to not match.
473 * $gt:
474 * type: string
475 * title: $gt
476 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
477 * $gte:
478 * type: string
479 * title: $gte
480 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
481 * $lt:
482 * type: string
483 * title: $lt
484 * description: Filter by values less than this parameter. Useful for numbers and dates only.
485 * $lte:
486 * type: string
487 * title: $lte
488 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
489 * $like:
490 * type: string
491 * title: $like
492 * description: Apply a `like` filter. Useful for strings only.
493 * $re:
494 * type: string
495 * title: $re
496 * description: Apply a regex filter. Useful for strings only.
497 * $ilike:
498 * type: string
499 * title: $ilike
500 * description: Apply a case-insensitive `like` filter. Useful for strings only.
501 * $fulltext:
502 * type: string
503 * title: $fulltext
504 * description: Filter to apply on full-text properties.
505 * $overlap:
506 * type: array
507 * description: Filter arrays that have overlapping values with this parameter.
508 * items:
509 * type: string
510 * title: $overlap
511 * description: The value to match.
512 * $contains:
513 * type: array
514 * description: Filter arrays that contain some of the values of this parameter.
515 * items:
516 * type: string
517 * title: $contains
518 * description: The values to match.
519 * $contained:
520 * type: array
521 * description: Filter arrays that contain all values of this parameter.
522 * items:
523 * type: string
524 * title: $contained
525 * description: The values to match.
526 * $exists:
527 * type: boolean
528 * title: $exists
529 * description: Filter by whether a value for this parameter exists (not `null`).
530 * - type: array
531 * description: Filter by values not matching those in this parameter.
532 * items:
533 * type: string
534 * title: $not
535 * description: The values to not match.
536 * $gt:
537 * type: string
538 * title: $gt
539 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
540 * $gte:
541 * type: string
542 * title: $gte
543 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
544 * $lt:
545 * type: string
546 * title: $lt
547 * description: Filter by values less than this parameter. Useful for numbers and dates only.
548 * $lte:
549 * type: string
550 * title: $lte
551 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
552 * $like:
553 * type: string
554 * title: $like
555 * description: Apply a `like` filter. Useful for strings only.
556 * $re:
557 * type: string
558 * title: $re
559 * description: Apply a regex filter. Useful for strings only.
560 * $ilike:
561 * type: string
562 * title: $ilike
563 * description: Apply a case-insensitive `like` filter. Useful for strings only.
564 * $fulltext:
565 * type: string
566 * title: $fulltext
567 * description: Filter to apply on full-text properties.
568 * $overlap:
569 * type: array
570 * description: Filter arrays that have overlapping values with this parameter.
571 * items:
572 * type: string
573 * title: $overlap
574 * description: The values to match.
575 * $contains:
576 * type: array
577 * description: Filter arrays that contain some of the values of this parameter.
578 * items:
579 * type: string
580 * title: $contains
581 * description: The values to match.
582 * $contained:
583 * type: array
584 * description: Filter arrays that contain all values of this parameter.
585 * items:
586 * type: string
587 * title: $contained
588 * description: The values to match.
589 * $exists:
590 * type: boolean
591 * title: $exists
592 * description: Filter by whether a value for this parameter exists (not `null`).
593 * title: updated_at
594 * - name: customer_id
595 * in: query
596 * required: false
597 * schema:
598 * oneOf:
599 * - type: string
600 * title: customer_id
601 * description: The order's customer id.
602 * - type: array
603 * description: The order's customer id.
604 * items:
605 * type: string
606 * title: customer_id
607 * description: The customer id's details.
608 * - name: with_deleted
609 * in: query
610 * description: Whether to include deleted records in the result.
611 * required: false
612 * schema:
613 * type: boolean
614 * title: with_deleted
615 * description: Whether to include deleted records in the result.
616 * security:
617 * - api_token: []
618 * - cookie_auth: []
619 * - jwt_token: []
620 * x-codeSamples:
621 * - lang: JavaScript
622 * label: JS SDK
623 * source: |-
624 * import Medusa from "@medusajs/js-sdk"
625 *
626 * export const sdk = new Medusa({
627 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
628 * debug: import.meta.env.DEV,
629 * auth: {
630 * type: "session",
631 * },
632 * })
633 *
634 * sdk.admin.order.list()
635 * .then(({ orders, count, limit, offset }) => {
636 * console.log(orders)
637 * })
638 * - lang: Shell
639 * label: cURL
640 * source: |-
641 * curl '{backend_url}/admin/orders' \
642 * -H 'Authorization: Bearer {jwt_token}'
643 * tags:
644 * - Orders
645 * responses:
646 * "200":
647 * description: OK
648 * content:
649 * application/json:
650 * schema:
651 * allOf:
652 * - type: object
653 * description: The paginated list of orders
654 * required:
655 * - limit
656 * - offset
657 * - count
658 * properties:
659 * limit:
660 * type: number
661 * title: limit
662 * description: The maximum number of items returned.
663 * offset:
664 * type: number
665 * title: offset
666 * description: The number of items skipped before the returned items.
667 * count:
668 * type: number
669 * title: count
670 * description: The total count of items.
671 * - type: object
672 * description: The paginated list of orders.
673 * required:
674 * - orders
675 * properties:
676 * orders:
677 * type: array
678 * description: The list of orders.
679 * items:
680 * $ref: "#/components/schemas/AdminOrder"
681 * "400":
682 * $ref: "#/components/responses/400_error"
683 * "401":
684 * $ref: "#/components/responses/unauthorized"
685 * "404":
686 * $ref: "#/components/responses/not_found_error"
687 * "409":
688 * $ref: "#/components/responses/invalid_state_error"
689 * "422":
690 * $ref: "#/components/responses/invalid_request_error"
691 * "500":
692 * $ref: "#/components/responses/500_error"
693 * x-workflow: getOrdersListWorkflow
694 * x-events: []
695 *
696 */
697