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