|
1
|
openapi: 3.0.0 |
|
2
|
info: |
|
3
|
version: 2.0.0 |
|
4
|
title: Medusa Storefront API |
|
5
|
license: |
|
6
|
name: MIT |
|
7
|
url: https://github.com/medusajs/medusa/blob/master/LICENSE |
|
8
|
tags: |
|
9
|
- name: Auth |
|
10
|
description: | |
|
11
|
Auth API routes allow you to manage a customer's authentication. |
|
12
|
- name: Carts |
|
13
|
description: > |
|
14
|
A cart is a virtual shopping bag that customers can use to add items they |
|
15
|
want to purchase. |
|
16
|
|
|
17
|
|
|
18
|
A cart is then used to checkout and place an order. |
|
19
|
|
|
20
|
|
|
21
|
These API routes allow customers to create and manage their cart, and |
|
22
|
place an order. |
|
23
|
externalDocs: |
|
24
|
description: How to implement cart functionality in a storefront. |
|
25
|
url: https://docs.medusajs.com/resources/storefront-development/cart |
|
26
|
x-associatedSchema: |
|
27
|
$ref: "#/components/schemas/StoreCart" |
|
28
|
- name: Collections |
|
29
|
description: > |
|
30
|
A product collection organizes products into a collection for marketing |
|
31
|
purposes. For example, a summer collection. |
|
32
|
|
|
33
|
|
|
34
|
These API routes allow customers to browse collections and their products. |
|
35
|
externalDocs: |
|
36
|
description: How to list product collections in a storefront. |
|
37
|
url: https://docs.medusajs.com/resources/storefront-development/products/collections/list |
|
38
|
x-associatedSchema: |
|
39
|
$ref: "#/components/schemas/StoreCollection" |
|
40
|
- name: Currencies |
|
41
|
description: > |
|
42
|
A store has multiple currencies, and product prices can be different for |
|
43
|
each currency. |
|
44
|
|
|
45
|
|
|
46
|
When retrieving product variant prices, you specify either the ID of a |
|
47
|
region or a currency that the customer selected. |
|
48
|
|
|
49
|
|
|
50
|
These API routes allow customers to browse currencies. |
|
51
|
externalDocs: |
|
52
|
description: How to retrieve product variant prices in a storefront. |
|
53
|
url: https://docs.medusajs.com/resources/storefront-development/products/price |
|
54
|
x-associatedSchema: |
|
55
|
$ref: "#/components/schemas/StoreCurrency" |
|
56
|
- name: Customers |
|
57
|
description: > |
|
58
|
Customers can place orders as guest customers or register. |
|
59
|
|
|
60
|
|
|
61
|
When a customer registers, they can manage their profile, save addresses |
|
62
|
for later usage, and more. |
|
63
|
|
|
64
|
|
|
65
|
These API routes allow customers to create and manage their accounts. |
|
66
|
externalDocs: |
|
67
|
description: How to implement customer account functionalities in a storefront. |
|
68
|
url: https://docs.medusajs.com/resources/storefront-development/customers |
|
69
|
x-associatedSchema: |
|
70
|
$ref: "#/components/schemas/StoreCustomer" |
|
71
|
- name: Gift Cards |
|
72
|
description: > |
|
73
|
A gift card is a prepaid card that customers can use to purchase products |
|
74
|
in the store. |
|
75
|
|
|
76
|
Customers can purchase gift cards for themselves or others, and then use |
|
77
|
them to pay for their orders. |
|
78
|
|
|
79
|
These API routes allow logged-in customers to create and manage their gift |
|
80
|
cards. |
|
81
|
|
|
82
|
<Note> |
|
83
|
|
|
84
|
Gift Cards are available through the [Loyalty |
|
85
|
Plugin](https://docs.medusajs.com/resources/commerce-modules/loyalty). |
|
86
|
|
|
87
|
</Note> |
|
88
|
x-associatedSchema: |
|
89
|
$ref: "#/components/schemas/StoreGiftCard" |
|
90
|
- name: Locales |
|
91
|
description: > |
|
92
|
A locale is a language that content is translated into for customers to |
|
93
|
view in a storefront. |
|
94
|
|
|
95
|
Medusa installs locales by default. These API routes allow you to retrieve |
|
96
|
supported locales in the store. |
|
97
|
externalDocs: |
|
98
|
description: Learn more about locales and translations. |
|
99
|
url: https://docs.medusajs.com/resources/commerce-modules/translation/concepts |
|
100
|
x-associatedSchema: |
|
101
|
$ref: "#/components/schemas/StoreLocale" |
|
102
|
- name: Multi-Factor Authentication (MFA) Factors |
|
103
|
description: > |
|
104
|
Multi-factor authentication (MFA) factors are additional ways to verify a |
|
105
|
customer's identity during login, in addition to their password. Examples |
|
106
|
of MFA factors include authenticator apps, SMS messages, and email. |
|
107
|
|
|
108
|
These API routes allow customers to manage their MFA factors, such as |
|
109
|
enabling an authenticator app or generating recovery codes. |
|
110
|
externalDocs: |
|
111
|
description: Learn more about MFA in Medusa |
|
112
|
url: https://docs.medusajs.com/resources/commerce-modules/auth/mfa |
|
113
|
- name: Orders |
|
114
|
description: | |
|
115
|
Guest and registered customers can view orders they placed. |
|
116
|
|
|
117
|
These API routes allow customers to view their orders. |
|
118
|
x-associatedSchema: |
|
119
|
$ref: "#/components/schemas/StoreOrder" |
|
120
|
- name: Payment Collections |
|
121
|
description: > |
|
122
|
A cart must have a payment collection with an authorized payment session. |
|
123
|
|
|
124
|
|
|
125
|
Use these API routes during checkout to set the cart's payment provider |
|
126
|
and authorize its payment session. |
|
127
|
externalDocs: |
|
128
|
description: How to implement payment during checkout. |
|
129
|
url: https://docs.medusajs.com/resources/storefront-development/checkout/payment |
|
130
|
x-associatedSchema: |
|
131
|
$ref: "#/components/schemas/StorePaymentCollection" |
|
132
|
- name: Payment Providers |
|
133
|
description: > |
|
134
|
Each region has a set of payment providers enabled. |
|
135
|
|
|
136
|
|
|
137
|
During checkout, you retrieve the available payment providers in the |
|
138
|
customer's region to show them to the customer. Customers then choose |
|
139
|
their preferred provider to authorize their payment and place their order. |
|
140
|
|
|
141
|
|
|
142
|
These API routes allow customers to view available payment providers in |
|
143
|
their region. |
|
144
|
externalDocs: |
|
145
|
description: How to implement payment during checkout. |
|
146
|
url: https://docs.medusajs.com/resources/storefront-development/checkout/payment |
|
147
|
x-associatedSchema: |
|
148
|
$ref: "#/components/schemas/StorePaymentProvider" |
|
149
|
- name: Product Categories |
|
150
|
description: | |
|
151
|
Products can be categorized into categories. |
|
152
|
|
|
153
|
These API routes allow customers to browse categories and their products. |
|
154
|
externalDocs: |
|
155
|
description: How to list product categories in a storefront. |
|
156
|
url: https://docs.medusajs.com/resources/storefront-development/products/categories/list |
|
157
|
x-associatedSchema: |
|
158
|
$ref: "#/components/schemas/StoreProductCategory" |
|
159
|
- name: Product Options |
|
160
|
x-associatedSchema: |
|
161
|
$ref: "#/components/schemas/StoreProductOption" |
|
162
|
description: > |
|
163
|
A product option is a way to define different options for a product, such |
|
164
|
as "Size" or "Color". Product options can be created globally and used by |
|
165
|
multiple products, or they can be exclusive to a specific product. |
|
166
|
|
|
167
|
These API routes allow customers to view product options. |
|
168
|
externalDocs: |
|
169
|
description: Use Product Options in a Storefront |
|
170
|
url: https://docs.medusajs.com/resources/storefront-development/products/options |
|
171
|
- name: Product Tags |
|
172
|
x-associatedSchema: |
|
173
|
$ref: "#/components/schemas/StoreProductTag" |
|
174
|
- name: Product Types |
|
175
|
x-associatedSchema: |
|
176
|
$ref: "#/components/schemas/StoreProductType" |
|
177
|
- name: Product Variants |
|
178
|
x-associatedSchema: |
|
179
|
$ref: "#/components/schemas/StoreProductVariant" |
|
180
|
- name: Products |
|
181
|
description: > |
|
182
|
Customers browse products for their purchase. |
|
183
|
|
|
184
|
|
|
185
|
A product has variants for different option values. The customer chooses |
|
186
|
from these variants before adding it to the cart. |
|
187
|
|
|
188
|
|
|
189
|
These API routes allow customers to browse products. |
|
190
|
externalDocs: |
|
191
|
description: How to list products, get their prices, and more in a storefront. |
|
192
|
url: https://docs.medusajs.com/resources/storefront-development/products |
|
193
|
x-associatedSchema: |
|
194
|
$ref: "#/components/schemas/StoreProduct" |
|
195
|
- name: Regions |
|
196
|
description: > |
|
197
|
Regions are different countries or geographical regions that the commerce |
|
198
|
store serves customers in. |
|
199
|
|
|
200
|
|
|
201
|
Customers can choose what region they're in to view prices of that |
|
202
|
region's currency. |
|
203
|
|
|
204
|
|
|
205
|
Use these API routes to retrieve available regions in the store. |
|
206
|
externalDocs: |
|
207
|
description: How to retrieve and store selected region in a storefront. |
|
208
|
url: https://docs.medusajs.com/resources/storefront-development/regions |
|
209
|
x-associatedSchema: |
|
210
|
$ref: "#/components/schemas/StoreRegion" |
|
211
|
- name: Return Reasons |
|
212
|
description: > |
|
213
|
A return reason is a possible reason a customer wants to return an item. |
|
214
|
|
|
215
|
|
|
216
|
Use these API routes when implementing return creation flow in your |
|
217
|
storefront to allow customers to select their return reason. |
|
218
|
x-associatedSchema: |
|
219
|
$ref: "#/components/schemas/StoreReturnReason" |
|
220
|
- name: Returns |
|
221
|
description: > |
|
222
|
Customers can request to return items in their order. The admin user then |
|
223
|
receives and handles the return. |
|
224
|
|
|
225
|
|
|
226
|
These API routes allows customers to create a return. |
|
227
|
x-associatedSchema: |
|
228
|
$ref: "#/components/schemas/StoreReturn" |
|
229
|
- name: Search |
|
230
|
description: > |
|
231
|
Search the indexes that your application exposes to the storefront. |
|
232
|
|
|
233
|
|
|
234
|
An index is only searchable through these API routes once it's allowed |
|
235
|
with the `configureStoreSearch` middleware. |
|
236
|
- name: Shipping Options |
|
237
|
description: > |
|
238
|
A shipping option is a way of shipping an item to or from the customer. |
|
239
|
|
|
240
|
|
|
241
|
During the checkout flow, the customer selects their preferred shipping |
|
242
|
option to receive their order. |
|
243
|
|
|
244
|
|
|
245
|
These API routes allow customers to retrieve available shipping options |
|
246
|
for their context. |
|
247
|
externalDocs: |
|
248
|
description: How to implement shipping during checkout. |
|
249
|
url: https://docs.medusajs.com/resources/storefront-development/checkout/shipping |
|
250
|
x-associatedSchema: |
|
251
|
$ref: "#/components/schemas/StoreShippingOption" |
|
252
|
- name: Store Credit Accounts |
|
253
|
x-associatedSchema: |
|
254
|
description: > |
|
255
|
A store credit account is a way for customers to manage their store |
|
256
|
credit balance. Customers can use their store credit to pay for orders, |
|
257
|
and view their store credit balance. |
|
258
|
|
|
259
|
These API routes allow customers to view their store credit accounts. |
|
260
|
|
|
261
|
<Note> |
|
262
|
|
|
263
|
Store Credit Accounts are only available through the [Loyalty |
|
264
|
Plugin](https://docs.medusajs.com/resources/commerce-modules/loyalty). |
|
265
|
|
|
266
|
</Note> |
|
267
|
$ref: "#/components/schemas/StoreStoreCreditAccount" |
|
268
|
servers: |
|
269
|
- url: http://localhost:9000 |
|
270
|
- url: https://api.medusajs.com |
|
271
|
paths: {} |
|
272
|
components: |
|
273
|
schemas: |
|
274
|
Error: |
|
275
|
title: Response Error |
|
276
|
type: object |
|
277
|
properties: |
|
278
|
code: |
|
279
|
type: string |
|
280
|
description: A slug code to indicate the type of the error. |
|
281
|
enum: |
|
282
|
- invalid_state_error |
|
283
|
- invalid_request_error |
|
284
|
- api_error |
|
285
|
- unknown_error |
|
286
|
message: |
|
287
|
type: string |
|
288
|
description: Description of the error that occurred. |
|
289
|
example: first_name must be a string |
|
290
|
type: |
|
291
|
type: string |
|
292
|
description: A slug indicating the type of the error. |
|
293
|
enum: |
|
294
|
- QueryRunnerAlreadyReleasedError |
|
295
|
- TransactionAlreadyStartedError |
|
296
|
- TransactionNotStartedError |
|
297
|
- conflict |
|
298
|
- unauthorized |
|
299
|
- payment_authorization_error |
|
300
|
- duplicate_error |
|
301
|
- not_allowed |
|
302
|
- invalid_data |
|
303
|
- not_found |
|
304
|
- database_error |
|
305
|
- unexpected_state |
|
306
|
- invalid_argument |
|
307
|
- unknown_error |
|
308
|
responses: |
|
309
|
default_error: |
|
310
|
description: Default Error |
|
311
|
content: |
|
312
|
application/json: |
|
313
|
schema: |
|
314
|
$ref: "#/components/schemas/Error" |
|
315
|
example: |
|
316
|
code: unknown_error |
|
317
|
message: An unknown error occurred. |
|
318
|
type: unknown_error |
|
319
|
invalid_state_error: |
|
320
|
description: Invalid State Error |
|
321
|
content: |
|
322
|
application/json: |
|
323
|
schema: |
|
324
|
$ref: "#/components/schemas/Error" |
|
325
|
example: |
|
326
|
code: unknown_error |
|
327
|
message: The request conflicted with another request. You may retry the request |
|
328
|
with the provided Idempotency-Key. |
|
329
|
type: QueryRunnerAlreadyReleasedError |
|
330
|
invalid_request_error: |
|
331
|
description: Invalid Request Error |
|
332
|
content: |
|
333
|
application/json: |
|
334
|
schema: |
|
335
|
$ref: "#/components/schemas/Error" |
|
336
|
example: |
|
337
|
code: invalid_request_error |
|
338
|
message: Discount with code TEST already exists. |
|
339
|
type: duplicate_error |
|
340
|
not_found_error: |
|
341
|
description: Not Found Error |
|
342
|
content: |
|
343
|
application/json: |
|
344
|
schema: |
|
345
|
$ref: "#/components/schemas/Error" |
|
346
|
example: |
|
347
|
message: Entity with id 1 was not found |
|
348
|
type: not_found |
|
349
|
400_error: |
|
350
|
description: Client Error |
|
351
|
content: |
|
352
|
application/json: |
|
353
|
schema: |
|
354
|
$ref: "#/components/schemas/Error" |
|
355
|
examples: |
|
356
|
not_allowed: |
|
357
|
$ref: "#/components/examples/not_allowed_error" |
|
358
|
invalid_data: |
|
359
|
$ref: "#/components/examples/invalid_data_error" |
|
360
|
500_error: |
|
361
|
description: Server Error |
|
362
|
content: |
|
363
|
application/json: |
|
364
|
schema: |
|
365
|
$ref: "#/components/schemas/Error" |
|
366
|
examples: |
|
367
|
database: |
|
368
|
$ref: "#/components/examples/database_error" |
|
369
|
unexpected_state: |
|
370
|
$ref: "#/components/examples/unexpected_state_error" |
|
371
|
invalid_argument: |
|
372
|
$ref: "#/components/examples/invalid_argument_error" |
|
373
|
default_error: |
|
374
|
$ref: "#/components/examples/default_error" |
|
375
|
unauthorized: |
|
376
|
description: User is not authorized. Must log in first |
|
377
|
content: |
|
378
|
text/plain: |
|
379
|
schema: |
|
380
|
type: string |
|
381
|
default: Unauthorized |
|
382
|
example: Unauthorized |
|
383
|
incorrect_credentials: |
|
384
|
description: User does not exist or incorrect credentials |
|
385
|
content: |
|
386
|
text/plain: |
|
387
|
schema: |
|
388
|
type: string |
|
389
|
default: Unauthorized |
|
390
|
example: Unauthorized |
|
391
|
examples: |
|
392
|
not_allowed_error: |
|
393
|
summary: Not Allowed Error |
|
394
|
value: |
|
395
|
message: Discount must be set to dynamic |
|
396
|
type: not_allowed |
|
397
|
invalid_data_error: |
|
398
|
summary: Invalid Data Error |
|
399
|
value: |
|
400
|
message: first_name must be a string |
|
401
|
type: invalid_data |
|
402
|
multiple_errors: |
|
403
|
summary: Multiple Errors |
|
404
|
value: |
|
405
|
message: Provided request body contains errors. Please check the data and retry |
|
406
|
the request |
|
407
|
errors: |
|
408
|
- message: first_name must be a string |
|
409
|
type: invalid_data |
|
410
|
- message: Discount must be set to dynamic |
|
411
|
type: not_allowed |
|
412
|
database_error: |
|
413
|
summary: Database Error |
|
414
|
value: |
|
415
|
code: api_error |
|
416
|
message: An error occured while hashing password |
|
417
|
type: database_error |
|
418
|
unexpected_state_error: |
|
419
|
summary: Unexpected State Error |
|
420
|
value: |
|
421
|
message: cart.total must be defined |
|
422
|
type: unexpected_state |
|
423
|
invalid_argument_error: |
|
424
|
summary: Invalid Argument Error |
|
425
|
value: |
|
426
|
message: cart.total must be defined |
|
427
|
type: unexpected_state |
|
428
|
default_error: |
|
429
|
summary: Default Error |
|
430
|
value: |
|
431
|
code: unknown_error |
|
432
|
message: An unknown error occurred. |
|
433
|
type: unknown_error |
|
434
|
securitySchemes: |
|
435
|
jwt_token: |
|
436
|
type: http |
|
437
|
x-displayName: JWT Token |
|
438
|
scheme: bearer |
|
439
|
cookie_auth: |
|
440
|
type: apiKey |
|
441
|
x-displayName: Cookie Session ID |
|
442
|
in: cookie |
|
443
|
name: connect.sid |
|
444
|
reset_password: |
|
445
|
type: http |
|
446
|
x-displayName: Reset Password Token |
|
447
|
scheme: bearer |
|
448
|
x-is-auth: false |