Orders API Routes

Guest and registered customers can view orders they placed.

These API routes allow customers to view their orders.

GET /store/orders#

List Logged-in Customer's Orders

Retrieve the orders of the logged-in customer. The orders can be filtered by fields such as id. The orders can also be sorted or paginated.

Authentication: cookie session, JWT bearer token.

Header parameters

x-publishable-api-keystring
Publishable API Key created in the Medusa Admin.
x-medusa-localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Query parameters

fieldsstringOptional
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 fields. without prefix it will replace the entire default fields.
offsetnumberOptional
The number of items to skip when retrieving a list.
limitnumberOptional
Limit the number of items returned in the list.
orderstringOptional
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 -.
idstring | string[]Optional
Filter by an order ID.
$andobject[]Optional
The order's $and.
$orobject[]Optional
The order's $or.
status"canceled" | "requires_action" | "pending" | "completed" | "draft" | "archived" | ("canceled")[] | ("requires_action")[] | ("pending")[] | ("completed")[] | ("draft")[] | ("archived")[]Optional
The order's status.
with_deletedbooleanOptional
Whether to include deleted records in the result.
localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Request examples

Responses

200 OK

limitnumber
The maximum number of items returned.
offsetnumber
The number of items skipped before retrieving the returned items.
countnumber
The total number of items.
ordersobject[]
The order's orders.

400, 401, 404, 409, 422, 500: an error response is returned.


GET /store/orders/{id}#

Get an Order

Retrieve an order by its ID. You can expand the order's relations or select the fields that should be returned. This API route doesn't require customer authentication, so that guest customers can view their order confirmation page after placing an order. To restrict access to this API route, refer to the Restrict Order Retrieval guide.

Authentication: none.

Path parameters

idstring
The order's ID.

Header parameters

x-publishable-api-keystring
Publishable API Key created in the Medusa Admin.
x-medusa-localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Query parameters

fieldsstringOptional
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 fields. without prefix it will replace the entire default fields.
localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Request examples

Responses

200 OK

orderobject
The order's details.

400, 401, 404, 409, 422, 500: an error response is returned.


POST /store/orders/{id}/transfer/accept#

Accept Order Transfer

Accept an order to be transfered to a customer's account, which was specified when the transfer request was created. The transfer is requested previously either by the customer using the Request Order Transfer Store API route, or by the admin using the Request Order Transfer Admin API route.

Authentication: none.

Path parameters

idstring
The order's ID.

Header parameters

x-publishable-api-keystring
Publishable API Key created in the Medusa Admin.
x-medusa-localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Query parameters

fieldsstringOptional
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 fields. without prefix it will replace the entire default fields.
localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Request body (application/json)

tokenstring
The order transfer's token issued when the transfer was requested.

Request examples

Responses

200 OK

orderobject
The order's details.

400, 401, 404, 409, 422, 500: an error response is returned.


POST /store/orders/{id}/transfer/cancel#

Cancel Order Transfer

Cancel an order transfer that the logged-in customer previously requested using the Request Order Transfer API route.

Authentication: cookie session, JWT bearer token.

Path parameters

idstring
The order's ID.

Header parameters

x-publishable-api-keystring
Publishable API Key created in the Medusa Admin.
x-medusa-localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Query parameters

fieldsstringOptional
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 fields. without prefix it will replace the entire default fields.
localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Request examples

Responses

200 OK

orderobject
The order's details.

400, 401, 404, 409, 422, 500: an error response is returned.


POST /store/orders/{id}/transfer/decline#

Decline Order Transfer

Decline an order transfer previously requested, typically by the admin user using the Request Order Transfer Admin API route.

Authentication: none.

Path parameters

idstring
The order's ID.

Header parameters

x-publishable-api-keystring
Publishable API Key created in the Medusa Admin.
x-medusa-localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Query parameters

fieldsstringOptional
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 fields. without prefix it will replace the entire default fields.
localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Request body (application/json)

tokenstring
The order transfer's token issued when the transfer was requested.

Request examples

Responses

200 OK

orderobject
The order's details.

400, 401, 404, 409, 422, 500: an error response is returned.


POST /store/orders/{id}/transfer/request#

Request Order Transfer

Request an order to be transfered to the logged-in customer's account. The transfer is confirmed using the Accept Order Transfer API route.

Authentication: cookie session, JWT bearer token.

Path parameters

idstring
The order's ID.

Header parameters

x-publishable-api-keystring
Publishable API Key created in the Medusa Admin.
x-medusa-localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Query parameters

fieldsstringOptional
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 fields. without prefix it will replace the entire default fields.
localestringOptional
The locale in BCP 47 format to retrieve localized content.
Example: en-US

Request body (application/json)

descriptionstringOptional
The transfer's description, which can be shown to the other customer receiving the request.
update_order_emailbooleanOptional
Whether to update the order's email to the receiving customer's email. By default, the order's email will not be updated.

Default: false

Request examples

Responses

200 OK

orderobject
The order's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Found a problem with this page?Report Issue
Edited Nov 14·Edit this page