There are two ways to send authenticated requests to the Medusa server: Using a user's API token, or using a Cookie Session ID.
API Token
Use a user's API Token to send authenticated requests.
How to Add API Token to a User
At the moment, there's no direct way of adding an API Token for a user. The only way it can be done is through directly editing the database.
If you're using a PostgreSQL database, you can run the following commands in your command line to add API token:
psql -d <DB_NAME> -U <DB_USER>
UPDATE public.user SET api_token='<API_TOKEN>' WHERE email='<USER_EMAIL>';
Where:
<DB_NAME>
is the name of the database schema you use for the Medusa server.<DB_USER>
is the name of the user that has privileges over the database schema.<API_TOKEN>
is the API token you want to associate with the user. You can use this tool to generate a random token.<USER_EMAIL>
is the email address of the admin user you want to have this API token.
How to Use the API Token
The API token can be used for Bearer Authentication. It's passed in the Authorization
header as the following:
Authorization: Bearer {api_token}
In this API reference, you'll find in the cURL request samples the use of {api_token}
. This is where you must pass the API token.
If you're following along with the JS Client request samples, you must provide the apiKey
option when creating the Medusa client:
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3, apiKey: '{api_token}' })
If you're using Medusa React, you can pass the apiKey
prop to MedusaProvider
:
<MedusaProvider
apiKey='api_token}'
//...
>
bearer
In many endpoints you'll find an expand
query parameter that can be passed to the endpoint. You can use the expand
query parameter to unpack an entity's relations and return them in the response.
Please note that the relations you pass to expand
replace any relations that are expanded by default in the request.
Expanding One Relation
For example, when you retrieve products, you can retrieve their collection by passing to the expand
query parameter the value collection
:
curl "http://localhost:9000/admin/products?expand=collection" \
-H 'Authorization: Bearer {api_token}'
Expanding Multiple Relations
You can expand more than one relation by separating the relations in the expand
query parameter with a comma.
For example, to retrieve both the variants and the collection of products, pass to the expand
query parameter the value variants,collection
:
curl "http://localhost:9000/admin/products?expand=variants,collection" \
-H 'Authorization: Bearer {api_token}'
Prevent Expanding Relations
Some requests expand relations by default. You can prevent that by passing an empty expand value to retrieve an entity without any extra relations.
For example:
curl "http://localhost:9000/admin/products?expand" \
-H 'Authorization: Bearer {api_token}'
This would retrieve each product with only its properties, without any relations like collection
.
In many endpoints you'll find a fields
query parameter that can be passed to the endpoint. You can use the fields
query parameter to specify which fields in the entity should be returned in the response.
Please note that if you pass a fields
query parameter, only the fields you pass in the value along with the id
of the entity will be returned in the response.
Also, the fields
query parameter does not affect the expanded relations. You'll have to use the expand
parameter instead.
Selecting One Field
For example, when you retrieve a list of products, you can retrieve only the titles of the products by passing title
as a value to the fields
query parameter:
curl "http://localhost:9000/admin/products?fields=title" \
-H 'Authorization: Bearer {api_token}'
As mentioned above, the expanded relations such as variants
will still be returned as they're not affected by the fields
parameter.
You can ensure that only the title
field is returned by passing an empty value to the expand
query parameter. For example:
curl "http://localhost:9000/admin/products?fields=title&expand" \
-H 'Authorization: Bearer {api_token}'
Selecting Multiple Fields
You can pass more than one field by seperating the field names in the fields
query parameter with a comma.
For example, to select the title
and handle
of products:
curl "http://localhost:9000/admin/products?fields=title,handle" \
-H 'Authorization: Bearer {api_token}'
Retrieve Only the ID
You can pass an empty fields
query parameter to return only the ID of an entity. For example:
curl "http://localhost:9000/admin/products?fields" \
-H 'Authorization: Bearer {api_token}'
You can also pair with an empty expand
query parameter to ensure that the relations aren't retrieved as well. For example:
curl "http://localhost:9000/admin/products?fields&expand" \
-H 'Authorization: Bearer {api_token}'
This section covers how to pass some common data types as query parameters. This is useful if you're sending requests to the API endpoints and not using our JS Client. For example, when using cURL or Postman.
Strings
You can pass a string value in the form of <parameter_name>=<value>
.
For example:
curl "http://localhost:9000/admin/products?title=Shirt" \
-H 'Authorization: Bearer {api_token}'
If the string has any characters other than letters and numbers, you must encode them.
For example, if the string has spaces, you can encode the space with +
or %20
:
curl "http://localhost:9000/admin/products?title=Blue%20Shirt" \
-H 'Authorization: Bearer {api_token}'
You can use tools like this one to learn how a value can be encoded.
Integers
You can pass an integer value in the form of <parameter_name>=<value>
.
For example:
curl "http://localhost:9000/admin/products?offset=1" \
-H 'Authorization: Bearer {api_token}'
Boolean
You can pass a boolean value in the form of <parameter_name>=<value>
.
For example:
curl "http://localhost:9000/admin/products?is_giftcard=true" \
-H 'Authorization: Bearer {api_token}'
Date and DateTime
You can pass a date value in the form <parameter_name>=<value>
. The date must be in the format YYYY-MM-DD
.
For example:
curl -g "http://localhost:9000/admin/products?created_at[lt]=2023-02-17" \
-H 'Authorization: Bearer {api_token}'
You can also pass the time using the format YYYY-MM-DDTHH:MM:SSZ
. Please note that the T
and Z
here are fixed.
For example:
curl -g "http://localhost:9000/admin/products?created_at[lt]=2023-02-17T07:22:30Z" \
-H 'Authorization: Bearer {api_token}'
Array
Each array value must be passed as a separate query parameter in the form <parameter_name>[]=<value>
. You can also specify the index of each parameter in the brackets <parameter_name>[0]=<value>
.
For example:
curl -g "http://localhost:9000/admin/products?sales_channel_id[]=sc_01GPGVB42PZ7N3YQEP2WDM7PC7&sales_channel_id[]=sc_234PGVB42PZ7N3YQEP2WDM7PC7" \
-H 'Authorization: Bearer {api_token}'
Note that the -g
parameter passed to curl
disables errors being thrown for using the brackets. Read more here.
Object
Object parameters must be passed as separate query parameters in the form <parameter_name>[<key>]=<value>
.
For example:
curl -g "http://localhost:9000/admin/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17" \
-H 'Authorization: Bearer {api_token}'
Query Parameters
In listing endpoints, such as list customers or list products, you can control the pagination using the query parameters limit
and offset
.
limit
is used to specify the maximum number of items that can be return in the response. offset
is used to specify how many items to skip before returning the resulting entities.
You can use the offset
query parameter to change between pages. For example, if the limit is 50, at page 1 the offset should be 0; at page 2 the offset should be 50, and so on.
For example, to limit the number of products returned in the List Products endpoint:
curl "http://localhost:9000/admin/products?limit=5" \
-H 'Authorization: Bearer {api_token}'
Response Fields
In the response of listing endpoints, aside from the entities retrieved, there are three pagination-related fields returned: count
, limit
, and offset
.
Similar to the query parameters, limit
is the maximum number of items that can be returned in the response, and field
is the number of items that were skipped before the entities in the result.
count
is the total number of available items of this entity. It can be used to determine how many pages are there.
For example, if the count
is 100 and the limit
is 50, you can divide the count
by the limit
to get the number of pages: 100/50 = 2 pages
.
Sort Order
The order
field available on endpoints supporting pagination allows you to sort the retrieved items by an attribute of that item. For example, you can sort products by their created_at
attribute by setting order
to created_at
:
curl "http://localhost:9000/admin/products?order=created_at" \
-H 'Authorization: Bearer {api_token}'
By default, the sort direction will be ascending. To change it to descending, pass a dash (-
) before the attribute name. For example:
curl "http://localhost:9000/admin/products?order=-created_at" \
-H 'Authorization: Bearer {api_token}'
This sorts the products by their created_at
attribute in the descending order.
Some plugins may require to authenticate with third-party services and store authentication details, such as the authentication token. To do that, they can create an Oauth provider within the plugin that handles the authentication. The Apps Oauth endpoints allows admins to manage and generate token for an app using its oauth provider.
List Applications
Retrieve a list of applications registered in the Medusa backend.
Authorizations:
Responses
Response Schema: application/json
required | Array of objects (OAuth) An array of app details. | ||||||||||||
Array
|
Request samples
- cURL
curl 'https://medusa-url.com/admin/apps' \ -H 'Authorization: Bearer {api_token}'
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "apps": [
- {
- "id": "example_app",
- "display_name": "Example app",
- "application_name": "example",
- "data": { }
}
]
}
Generate Token for App
Use an app's Oauth provider to generate and store a new token for authentication.
Authorizations:
Request Body schema: application/json
application_name required | string Name of the application for to generate the token for. |
state required | string State of the application. |
code required | string The code for the generated token. |
Responses
Response Schema: application/json
required | object (OAuth) An Oauth app is typically created by a plugin to handle authentication to third-party services. | ||||||||||||
|
Request samples
- Payload
- cURL
{- "application_name": "string",
- "state": "string",
- "code": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "apps": {
- "id": "example_app",
- "display_name": "Example app",
- "application_name": "example",
- "data": { }
}
}
Authentication endpoints allow admin users to manage their session, such as login or log out. When an admin user is logged in, the cookie header is set indicating the admin's login session.
Get Current User
Get the currently logged in user's details.
Authorizations:
Responses
Response Schema: application/json
required | object (User) A User is an administrator who can manage store settings and data. | ||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.auth.getSession() .then(({ user }) => { console.log(user.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
User Login
Log a User in and includes the Cookie session in the response header. The cookie session can be used in subsequent requests to authorize the user to perform admin functionalities. When using Medusa's JS or Medusa React clients, the cookie is automatically attached to subsequent requests.
Request Body schema: application/json
email required | string <email> The user's email. |
password required | string <password> The user's password. |
Responses
Response Schema: application/json
required | object (User) A User is an administrator who can manage store settings and data. | ||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "email": "user@example.com",
- "password": "pa$$word"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
User Logout
Delete the current session for the logged in user. This will only work if you're using Cookie session for authentication. If the API token is still passed in the header, the user is still authorized to perform admin functionalities in other endpoints.
Authorizations:
Responses
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in medusa.admin.auth.deleteSession()
Response samples
- 400
- 404
- 409
- 422
- 500
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}
A batch job is a task that is performed by the Medusa backend asynchronusly. For example, the Import Product feature is implemented using batch jobs. Batch Job endpoints allows admins to manage the batch jobs and their state.
List Batch Jobs
Retrieve a list of Batch Jobs. The batch jobs can be filtered by fields such as type
or confirmed_at
. The batch jobs can also be sorted or paginated.
Authorizations:
query Parameters
limit | integer Default: 10 Limit the number of batch jobs returned. |
offset | integer Default: 0 The number of batch jobs to skip when retrieving the batch jobs. |
string or Array of strings Filter by the batch ID | |
type | Array of strings Filter by the batch type |
object Filter by a confirmation date range. | |
object Filter by a pre-processing date range. | |
object Filter by a completion date range. | |
object Filter by a failure date range. | |
object Filter by a cancelation date range. | |
order | string A batch-job field to sort-order the retrieved batch jobs by. |
expand | string Comma-separated relations that should be expanded in the returned batch jobs. |
fields | string Comma-separated fields that should be included in the returned batch jobs. |
object Filter by a creation date range. | |
object Filter by an update date range. |
Responses
Response Schema: application/json
required | Array of objects (Batch Job) An array of batch job details. |
count required | integer The total number of items available |
offset required | integer The number of batch jobs skipped when retrieving the batch jobs. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.batchJobs.list() .then(({ batch_jobs, limit, offset, count }) => { console.log(batch_jobs.length) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "batch_jobs": [
- {
- "id": "batch_01G8T782965PYFG0751G0Z38B4",
- "type": "product-import",
- "status": "created",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "created_by_user": {
- "id": null,
- "role": null,
- "email": null,
- "first_name": null,
- "last_name": null,
- "api_token": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false,
- "result": {
- "errors": [
- {
- "err": [ ],
- "code": "unknown",
- "message": "Method not implemented."
}
], - "stat_descriptors": [
- {
- "key": "product-export-count",
- "name": "Product count to export",
- "message": "There will be 8 products exported by this action"
}
]
}, - "pre_processed_at": "2019-08-24T14:15:22Z",
- "processing_at": "2019-08-24T14:15:22Z",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "failed_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Batch Job
Create a Batch Job to be executed asynchronously in the Medusa backend. If dry_run
is set to true
, the batch job will not be executed until the it is confirmed, which can be done using the Confirm Batch Job endpoint.
Authorizations:
Request Body schema: application/json
type required | string Example: "product-export" The type of batch job to start, which is defined by the |
context required | object Example: {"shape":{"prices":[{"region":null,"currency_code":"eur"}],"dynamicImageColumnCount":4,"dynamicOptionColumnCount":2},"list_config":{"skip":0,"take":50,"order":{"created_at":"DESC"},"relations":["variants","variant.prices","images"]}} Additional infomration regarding the batch to be used for processing. |
dry_run | boolean Default: false Set a batch job in dry_run mode, which would delay executing the batch job until it's confirmed. |
Responses
Request samples
- Payload
- JS Client
- cURL
{- "type": "product-export",
- "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false
}
Response samples
- 201
- 400
- 404
- 409
- 422
- 500
{- "batch_job": {
- "id": "batch_01G8T782965PYFG0751G0Z38B4",
- "type": "product-import",
- "status": "created",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "created_by_user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false,
- "result": {
- "errors": [
- {
- "err": [ ],
- "code": "unknown",
- "message": "Method not implemented."
}
], - "stat_descriptors": [
- {
- "key": "product-export-count",
- "name": "Product count to export",
- "message": "There will be 8 products exported by this action"
}
]
}, - "pre_processed_at": "2019-08-24T14:15:22Z",
- "processing_at": "2019-08-24T14:15:22Z",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "failed_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Get a Batch Job
Retrieve the details of a batch job.
Authorizations:
path Parameters
id required | string The ID of the Batch Job |
Responses
Response Schema: application/json
required | object (Batch Job) A Batch Job indicates an asynchronus task stored in the Medusa backend. Its status determines whether it has been executed or not. | ||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.batchJobs.retrieve(batchJobId) .then(({ batch_job }) => { console.log(batch_job.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "batch_job": {
- "id": "batch_01G8T782965PYFG0751G0Z38B4",
- "type": "product-import",
- "status": "created",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "created_by_user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false,
- "result": {
- "errors": [
- {
- "err": [ ],
- "code": "unknown",
- "message": "Method not implemented."
}
], - "stat_descriptors": [
- {
- "key": "product-export-count",
- "name": "Product count to export",
- "message": "There will be 8 products exported by this action"
}
]
}, - "pre_processed_at": "2019-08-24T14:15:22Z",
- "processing_at": "2019-08-24T14:15:22Z",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "failed_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Cancel a Batch Job
Mark a batch job as canceled. When a batch job is canceled, the processing of the batch job doesn’t automatically stop.
Authorizations:
path Parameters
id required | string The ID of the batch job. |
Responses
Response Schema: application/json
required | object (Batch Job) A Batch Job indicates an asynchronus task stored in the Medusa backend. Its status determines whether it has been executed or not. | ||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.batchJobs.cancel(batchJobId) .then(({ batch_job }) => { console.log(batch_job.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "batch_job": {
- "id": "batch_01G8T782965PYFG0751G0Z38B4",
- "type": "product-import",
- "status": "created",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "created_by_user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false,
- "result": {
- "errors": [
- {
- "err": [ ],
- "code": "unknown",
- "message": "Method not implemented."
}
], - "stat_descriptors": [
- {
- "key": "product-export-count",
- "name": "Product count to export",
- "message": "There will be 8 products exported by this action"
}
]
}, - "pre_processed_at": "2019-08-24T14:15:22Z",
- "processing_at": "2019-08-24T14:15:22Z",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "failed_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Confirm a Batch Job
When a batch job is created, it is not executed automatically if dry_run
is set to true
. This endpoint confirms that the batch job should be executed.
Authorizations:
path Parameters
id required | string The ID of the batch job. |
Responses
Response Schema: application/json
required | object (Batch Job) A Batch Job indicates an asynchronus task stored in the Medusa backend. Its status determines whether it has been executed or not. | ||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.batchJobs.confirm(batchJobId) .then(({ batch_job }) => { console.log(batch_job.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "batch_job": {
- "id": "batch_01G8T782965PYFG0751G0Z38B4",
- "type": "product-import",
- "status": "created",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "created_by_user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "context": {
- "shape": {
- "prices": [
- {
- "region": null,
- "currency_code": "eur"
}
], - "dynamicImageColumnCount": 4,
- "dynamicOptionColumnCount": 2
}, - "list_config": {
- "skip": 0,
- "take": 50,
- "order": {
- "created_at": "DESC"
}, - "relations": [
- "variants",
- "variant.prices",
- "images"
]
}
}, - "dry_run": false,
- "result": {
- "errors": [
- {
- "err": [ ],
- "code": "unknown",
- "message": "Method not implemented."
}
], - "stat_descriptors": [
- {
- "key": "product-export-count",
- "name": "Product count to export",
- "message": "There will be 8 products exported by this action"
}
]
}, - "pre_processed_at": "2019-08-24T14:15:22Z",
- "processing_at": "2019-08-24T14:15:22Z",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "failed_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
A store can use unlimited currencies, and each region must be associated with at least one currency. Currencies are defined within the Medusa backend. Currency endpoints allow admins to list and update currencies.
List Currency
Retrieve a list of currencies. The currencies can be filtered by fields such as code
. The currencies can also be sorted or paginated.
query Parameters
code | string filter by currency code. |
includes_tax | boolean filter currencies by whether they include taxes or not. |
order | string A field to sort order the retrieved currencies by. |
offset | number Default: "0" The number of currencies to skip when retrieving the currencies. |
limit | number Default: "20" The number of currencies to return. |
Responses
Response Schema: application/json
required | Array of objects (Currency) An array of currency details. |
count required | integer The total number of items available |
offset required | integer The number of currencies skipped when retrieving the currencies. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.currencies.list() .then(({ currencies, count, offset, limit }) => { console.log(currencies.length); });
Response samples
- 200
{- "currencies": [
- {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Update a Currency
Update a Currency's details.
path Parameters
code required | string The code of the Currency. |
Request Body schema: application/json
includes_tax | boolean Tax included in prices of currency. |
Responses
Response Schema: application/json
required | object (Currency) Currency | ||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "includes_tax": true
}
Response samples
- 200
{- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}
}
Customer Groups can be used to organize customers that share similar data or attributes into dedicated groups. This can be useful for different purposes such as setting a different price for a specific customer group.
List Customer Groups
Retrieve a list of customer groups. The customer groups can be filtered by fields such as name
or `id. The customer groups can also be sorted or paginated.
Authorizations:
query Parameters
q | string term to search customer groups by name. |
offset | integer Default: 0 The number of customer groups to skip when retrieving the customer groups. |
order | string A field to sort order the retrieved customer groups by. |
discount_condition_id | string Filter by discount condition ID. |
string or Array of strings or object Filter by the customer group ID | |
name | Array of strings Filter by the customer group name |
object Filter by a creation date range. | |
object Filter by an update date range. | |
limit | integer Default: 10 The number of customer groups to return. |
expand | string Comma-separated relations that should be expanded in the returned customer groups. |
Responses
Response Schema: application/json
required | Array of objects (Customer Group) An array of customer group details. |
count required | integer The total number of items available |
offset required | integer The number of customer groups skipped when retrieving the customer groups. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customerGroups.list() .then(({ customer_groups, limit, offset, count }) => { console.log(customer_groups.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customer_groups": [
- {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Customer Group
Creates a Customer Group.
Authorizations:
Request Body schema: application/json
name required | string Name of the customer group |
metadata | object Metadata of the customer group. |
Responses
Response Schema: application/json
required | object (Customer Group) A customer group that can be used to organize customers into groups of similar traits. | ||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customer_group": {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Customer Group
Retrieve a Customer Group by its ID. You can expand the customer group's relations or select the fields that should be returned.
Authorizations:
path Parameters
id required | string The ID of the Customer Group. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned customer group. |
fields | string Comma-separated fields that should be included in the returned customer group. |
Responses
Response Schema: application/json
required | object (Customer Group) A customer group that can be used to organize customers into groups of similar traits. | ||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customerGroups.retrieve(customerGroupId) .then(({ customer_group }) => { console.log(customer_group.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customer_group": {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Customer Group
Update a Customer Group's details.
Authorizations:
path Parameters
id required | string The ID of the customer group. |
Request Body schema: application/json
name | string Name of the customer group |
metadata | object Metadata of the customer group. |
Responses
Response Schema: application/json
required | object (Customer Group) A customer group that can be used to organize customers into groups of similar traits. | ||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customer_group": {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Customer Group
Delete a customer group. This doesn't delete the customers associated with the customer group.
Authorizations:
path Parameters
id required | string The ID of the Customer Group |
Responses
Response Schema: application/json
id required | string The ID of the deleted customer group. |
object required | string Default: "customer_group" The type of the object that was deleted. |
deleted required | boolean Default: true Whether the customer group was deleted successfully or not. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customerGroups.delete(customerGroupId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "customer_group",
- "deleted": true
}
List Customers
Retrieve a list of customers in a customer group. The customers can be filtered by the q
field. The customers can also be paginated.
Authorizations:
path Parameters
id required | string The ID of the customer group. |
query Parameters
limit | integer Default: 50 The number of customers to return. |
offset | integer Default: 0 The number of customers to skip when retrieving the customers. |
expand | string Comma-separated relations that should be expanded in the returned customers. |
q | string a term to search customers by email, first_name, and last_name. |
Responses
Response Schema: application/json
required | Array of objects (Customer) An array of customer details. |
count required | integer The total number of items available |
offset required | integer The number of customers skipped when retrieving the customers. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customerGroups.listCustomers(customerGroupId) .then(({ customers }) => { console.log(customers.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customers": [
- {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_addresses": [
- null
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Add Customers to Group
Add a list of customers to a customer group.
Authorizations:
path Parameters
id required | string The ID of the customer group. |
Request Body schema: application/json
required | Array of objects The ids of the customers to add | ||
Array
|
Responses
Response Schema: application/json
required | object (Customer Group) A customer group that can be used to organize customers into groups of similar traits. | ||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "customer_ids": [
- {
- "id": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customer_group": {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Customers from Group
Remove a list of customers from a customer group. This doesn't delete the customer, only the association between the customer and the customer group.
Authorizations:
path Parameters
id required | string The ID of the customer group. |
Request Body schema: application/json
required | Array of objects The ids of the customers to remove | ||
Array
|
Responses
Response Schema: application/json
required | object (Customer Group) A customer group that can be used to organize customers into groups of similar traits. | ||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "customer_ids": [
- {
- "id": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customer_group": {
- "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
- "name": "VIP",
- "customers": [
- { }
], - "price_lists": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Customers can either be created when they register through the Store APIs, or created by the admin using the Admin APIs.
List Customers
Retrieve a list of Customers. The customers can be filtered by fields such as q
or groups
. The customers can also be paginated.
Authorizations:
query Parameters
limit | integer Default: 50 The number of customers to return. |
offset | integer Default: 0 The number of customers to skip when retrieving the customers. |
expand | string Comma-separated relations that should be expanded in the returned customer. |
q | string term to search customers' email, first_name, and last_name fields. |
groups | Array of strings Filter by customer group IDs. |
Responses
Response Schema: application/json
required | Array of objects (Customer) An array of customer details. |
count required | integer The total number of items available |
offset required | integer The number of customers skipped when retrieving the customers. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customers.list() .then(({ customers, limit, offset, count }) => { console.log(customers.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customers": [
- {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_addresses": [
- null
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Customer
Allow admins to create a customer.
Authorizations:
Request Body schema: application/json
email required | string <email> The customer's email. |
first_name required | string The customer's first name. |
last_name required | string The customer's last name. |
password required | string <password> The customer's password. |
phone | string The customer's phone number. |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Request samples
- Payload
- JS Client
- cURL
{- "email": "user@example.com",
- "first_name": "string",
- "last_name": "string",
- "password": "pa$$word",
- "phone": "string",
- "metadata": { }
}
Response samples
- 201
- 400
- 404
- 409
- 422
- 500
{- "customer": {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_addresses": [
- {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Customer
Retrieve the details of a customer.
Authorizations:
path Parameters
id required | string The ID of the Customer. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned customer. |
fields | string Comma-separated fields that should be included in the returned customer. |
Responses
Response Schema: application/json
required | object (Customer) A customer can make purchases in your store and manage their profile. | ||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.customers.retrieve(customerId) .then(({ customer }) => { console.log(customer.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customer": {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_addresses": [
- {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Customer
Update a Customer's details.
Authorizations:
path Parameters
id required | string The ID of the Customer. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned customer. |
fields | string Comma-separated fields that should be retrieved in the returned customer. |
Request Body schema: application/json
string <email> The Customer's email. | |
first_name | string The Customer's first name. |
last_name | string The Customer's last name. |
phone | string The Customer's phone number. |
password | string <password> The Customer's password. |
Array of objects A list of customer groups to which the customer belongs. | |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Customer) A customer can make purchases in your store and manage their profile. | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "email": "user@example.com",
- "first_name": "string",
- "last_name": "string",
- "phone": "string",
- "password": "pa$$word",
- "groups": [
- {
- "id": "string"
}
], - "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "customer": {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_addresses": [
- {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Admins can create discounts with conditions and rules, providing them with advanced settings for variety of cases. The Discount endpoints can be used to manage discounts, their conditions, resources, and more.
List Discounts
Retrieve a list of Discounts. The discounts can be filtered by fields such as rule
or is_dynamic
. The discounts can also be paginated.
Authorizations:
query Parameters
q | string term to search discounts' code field. |
object Filter discounts by rule fields. | |
is_dynamic | boolean Filter discounts by whether they're dynamic or not. |
is_disabled | boolean Filter discounts by whether they're disabled or not. |
limit | number Default: "20" The number of discounts to return |
offset | number Default: "0" The number of discounts to skip when retrieving the discounts. |
expand | string Comma-separated relations that should be expanded in each returned discount. |
Responses
Response Schema: application/json
required | Array of objects (Discount) |
count required | integer The total number of items available |
offset required | integer The number of discounts skipped when retrieving the discounts. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.list() .then(({ discounts, limit, offset, count }) => { console.log(discounts.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discounts": [
- {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": null,
- "type": null,
- "description": null,
- "value": null,
- "allocation": null,
- "conditions": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- null
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Discount
Create a Discount with a given set of rules that defines how the Discount is applied.
Authorizations:
query Parameters
expand | string Comma-separated relations that should be expanded in the returned discount. |
fields | string Comma-separated fields that should be retrieved in the returned discount. |
Request Body schema: application/json
code required | string A unique code that will be used to redeem the discount |
required | object The discount rule that defines how discounts are calculated |
regions required | Array of strings A list of region IDs representing the Regions in which the Discount can be used. |
is_dynamic | boolean Default: false Whether the discount should have multiple instances of itself, each with a different code. This can be useful for automatically generated discount codes that all have to follow a common set of rules. |
is_disabled | boolean Default: false Whether the discount code is disabled on creation. If set to |
starts_at | string <date-time> The date and time at which the discount should be available. |
ends_at | string <date-time> The date and time at which the discount should no longer be available. |
valid_duration | string Example: "P3Y6M4DT12H30M5S" The duration the discount runs between |
usage_limit | number Maximum number of times the discount can be used |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "code": "string",
- "is_dynamic": false,
- "rule": {
- "description": "string",
- "type": "fixed",
- "value": 0,
- "allocation": "total",
- "conditions": [
- {
- "operator": null,
- "products": [ ],
- "product_types": [ ],
- "product_collections": [ ],
- "product_tags": [ ],
- "customer_groups": [ ]
}
]
}, - "is_disabled": false,
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- "string"
], - "usage_limit": 0,
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get Discount by Code
Retrieve a Discount's details by its discount code
Authorizations:
path Parameters
code required | string The code of the Discount |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned discount. |
fields | string Comma-separated fields that should be included in the returned discount. |
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.retrieveByCode(code) .then(({ discount }) => { console.log(discount.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Create a Condition
Create a Discount Condition. Only one of products
, product_types
, product_collections
, product_tags
, and customer_groups
should be provided, based on the type of discount condition. For example, if the discount condition's type is products
, the products
field should be provided in the request body.
Authorizations:
path Parameters
discount_id required | string The ID of the discount. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned discount. |
fields | string Comma-separated fields that should be included in the returned discount. |
Request Body schema: application/json
operator required | string Enum: "in" "not_in" Operator of the condition. |
products | Array of strings list of product IDs if the condition's type is |
product_types | Array of strings list of product type IDs if the condition's type is |
product_collections | Array of strings list of product collection IDs if the condition's type is |
product_tags | Array of strings list of product tag IDs if the condition's type is |
customer_groups | Array of strings list of customer group IDs if the condition's type is |
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "operator": "in",
- "products": [
- "string"
], - "product_types": [
- "string"
], - "product_collections": [
- "string"
], - "product_tags": [
- "string"
], - "customer_groups": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Condition
Retrieve a Discount Condition's details.
Authorizations:
path Parameters
discount_id required | string The ID of the Discount. |
condition_id required | string The ID of the Discount Condition. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned discount condition. |
fields | string Comma-separated fields that should be included in the returned discount condition. |
Responses
Response Schema: application/json
required | object (Discount Condition) Holds rule conditions for when a discount is applicable | ||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.getCondition(discountId, conditionId) .then(({ discount_condition }) => { console.log(discount_condition.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount_condition": {
- "id": "discon_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": "products",
- "operator": "in",
- "discount_rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "discount_rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "profiles": [ ],
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_collections": [
- {
- "id": null,
- "title": null,
- "handle": null,
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "customer_groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Condition
Update a Discount Condition. Only one of products
, product_types
, product_collections
, product_tags
, and customer_groups
should be provided, based on the type of discount condition. For example, if the discount condition's type is products
, the products
field should be provided in the request body.
Authorizations:
path Parameters
discount_id required | string The ID of the Discount. |
condition_id required | string The ID of the Discount Condition. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned discount. |
fields | string Comma-separated fields that should be included in the returned discount. |
Request Body schema: application/json
products | Array of strings list of product IDs if the condition's type is |
product_types | Array of strings list of product type IDs if the condition's type is |
product_collections | Array of strings list of product collection IDs if the condition's type is |
product_tags | Array of strings list of product tag IDs if the condition's type is |
customer_groups | Array of strings list of customer group IDs if the condition's type is |
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "products": [
- "string"
], - "product_types": [
- "string"
], - "product_collections": [
- "string"
], - "product_tags": [
- "string"
], - "customer_groups": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Condition
Deletes a Discount Condition. This does not delete resources associated to the discount condition.
Authorizations:
path Parameters
discount_id required | string The ID of the Discount |
condition_id required | string The ID of the Discount Condition |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned discount. |
fields | string Comma-separated fields that should be included in the returned discount. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Discount Condition |
object required | string Default: "discount-condition" The type of the object that was deleted. |
deleted required | boolean Default: true Whether the discount condition was deleted successfully. |
required | object (Discount) A discount can be applied to a cart for promotional purposes. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.deleteCondition(discountId, conditionId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "discount-condition",
- "deleted": true,
- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Add Batch Resources
Add a batch of resources to a discount condition. The type of resource depends on the type of discount condition. For example, if the discount condition's type is products
, the resources being added should be products.
Authorizations:
path Parameters
discount_id required | string The ID of the discount the condition belongs to. |
condition_id required | string The ID of the discount condition on which to add the item. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned discount. |
fields | string Comma-separated fields that should be included in the returned discount. |
Request Body schema: application/json
required | Array of objects The resources to be added to the discount condition | ||
Array
|
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "resources": [
- {
- "id": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Batch Resources
Remove a batch of resources from a discount condition. This will only remove the association between the resource and the discount condition, but not the resource itself.
Authorizations:
path Parameters
discount_id required | string The ID of the discount. |
condition_id required | string The ID of the condition to remove the resources from. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned discount. |
fields | string Comma-separated fields that should be included in the returned discount. |
Request Body schema: application/json
required | Array of objects The resources to be removed from the discount condition | ||
Array
|
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "resources": [
- {
- "id": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Discount
Retrieves a Discount
Authorizations:
path Parameters
id required | string The ID of the Discount |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned discount. |
fields | string Comma-separated fields that should be included in the returned discount. |
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.retrieve(discountId) .then(({ discount }) => { console.log(discount.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Discount
Update a Discount with a given set of rules that define how the Discount is applied.
Authorizations:
path Parameters
id required | string The ID of the Discount. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned discount. |
fields | string Comma-separated fields that should be retrieved in the returned discount. |
Request Body schema: application/json
code | string A unique code that will be used to redeem the discount |
object The discount rule that defines how discounts are calculated | |
is_disabled | boolean Whether the discount code is disabled on creation. If set to |
starts_at | string <date-time> The date and time at which the discount should be available. |
ends_at | string <date-time> The date and time at which the discount should no longer be available. |
valid_duration | string Example: "P3Y6M4DT12H30M5S" The duration the discount runs between |
usage_limit | number Maximum number of times the discount can be used |
regions | Array of strings A list of region IDs representing the Regions in which the Discount can be used. |
metadata | object An object containing metadata of the discount |
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "code": "string",
- "rule": {
- "id": "string",
- "description": "string",
- "value": 0,
- "allocation": "total",
- "conditions": [
- {
- "id": null,
- "operator": null,
- "products": [ ],
- "product_types": [ ],
- "product_collections": [ ],
- "product_tags": [ ],
- "customer_groups": [ ]
}
]
}, - "is_disabled": true,
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "usage_limit": 0,
- "regions": [
- "string"
], - "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Discount
Delete a Discount. Deleting the discount will make it unavailable for customers to use.
Authorizations:
path Parameters
id required | string The ID of the Discount |
Responses
Response Schema: application/json
id required | string The ID of the deleted Discount |
object required | string Default: "discount" The type of the object that was deleted. |
deleted required | boolean Default: true Whether the discount was deleted successfully. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.delete(discountId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "discount",
- "deleted": true
}
Create a Dynamic Code
Create a dynamic unique code that can map to a parent Discount. This is useful if you want to automatically generate codes with the same rules and conditions.
Authorizations:
path Parameters
id required | string The ID of the Discount to create the dynamic code for." |
Request Body schema: application/json
code required | string A unique code that will be used to redeem the Discount |
usage_limit | number Default: 1 Maximum number of times the discount code can be used |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "code": "string",
- "usage_limit": 1,
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Dynamic Code
Delete a dynamic code from a Discount.
Authorizations:
path Parameters
id required | string The ID of the Discount |
code required | string The dynamic code to delete |
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.deleteDynamicCode(discountId, code) .then(({ discount }) => { console.log(discount.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Add Region to Discount
Add a Region to the list of Regions a Discount can be used in.
Authorizations:
path Parameters
id required | string The ID of the Discount. |
region_id required | string The ID of the Region. |
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.addRegion(discountId, regionId) .then(({ discount }) => { console.log(discount.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Region
Remove a Region from the list of Regions that a Discount can be used in. This does not delete a region, only the association between it and the discount.
Authorizations:
path Parameters
id required | string The ID of the Discount. |
region_id required | string The ID of the Region. |
Responses
Response Schema: application/json
required | object (Discount) A discount can be applied to a cart for promotional purposes. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.discounts.removeRegion(discountId, regionId) .then(({ discount }) => { console.log(discount.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "discount": {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "type": "percentage",
- "description": "10 Percent",
- "value": 10,
- "allocation": "total",
- "conditions": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
A draft order is an order created manually by the admin. It allows admins to create orders without direct involvement from the customer.
List Draft Orders
Retrieve an list of Draft Orders. The draft orders can be filtered by fields such as q
. The draft orders can also paginated.
Authorizations:
query Parameters
offset | number Default: "0" The number of draft orders to skip when retrieving the draft orders. |
limit | number Default: "50" Limit the number of draft orders returned. |
q | string a term to search draft orders' display IDs and emails in the draft order's cart |
Responses
Response Schema: application/json
required | Array of objects (DraftOrder) An array of draft order's details. |
count required | integer The total number of items available |
offset required | integer The number of draft orders skipped when retrieving the draft orders. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.draftOrders.list() .then(({ draft_orders, limit, offset, count }) => { console.log(draft_orders.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "draft_orders": [
- {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Draft Order
Create a Draft Order. A draft order is not transformed into an order until payment is captured.
Authorizations:
Request Body schema: application/json
email required | string <email> The email of the customer of the draft order |
region_id required | string The ID of the region for the draft order |
required | Array of objects The shipping methods for the draft order |
status | string Enum: "open" "completed" The status of the draft order. The draft order's default status is |
AddressPayload (object) or string The Address to be used for billing purposes. | |
AddressPayload (object) or string The Address to be used for shipping purposes. | |
Array of objects The draft order's line items. | |
Array of objects The discounts to add to the draft order | |
customer_id | string The ID of the customer this draft order is associated with. |
no_notification_order | boolean An optional flag passed to the resulting order that indicates whether the customer should receive notifications about order updates. |
metadata | object The optional key-value map with additional details about the Draft Order. |
Responses
Response Schema: application/json
required | object (DraftOrder) A draft order is created by an admin without direct involvement of the customer. Once its payment is marked as captured, it is transformed into an order. | ||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "status": "open",
- "email": "user@example.com",
- "billing_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "shipping_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "variant_id": "string",
- "unit_price": 0,
- "title": "string",
- "quantity": 0,
- "metadata": { }
}
], - "region_id": "string",
- "discounts": [
- {
- "code": "string"
}
], - "customer_id": "string",
- "no_notification_order": true,
- "shipping_methods": [
- {
- "option_id": "string",
- "data": { },
- "price": 0
}
], - "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Draft Order
Retrieve a Draft Order's details.
Authorizations:
path Parameters
id required | string The ID of the Draft Order. |
Responses
Response Schema: application/json
required | object (DraftOrder) A draft order is created by an admin without direct involvement of the customer. Once its payment is marked as captured, it is transformed into an order. | ||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.draftOrders.retrieve(draftOrderId) .then(({ draft_order }) => { console.log(draft_order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Draft Order
Update a Draft Order's details.
Authorizations:
path Parameters
id required | string The ID of the Draft Order. |
Request Body schema: application/json
region_id | string The ID of the Region to create the Draft Order in. |
country_code | |
string <email> An email to be used in the Draft Order. | |
AddressPayload (object) or string The Address to be used for billing purposes. | |
AddressPayload (object) or string The Address to be used for shipping purposes. | |
Array of objects An array of Discount codes to add to the Draft Order. | |
no_notification_order | boolean An optional flag passed to the resulting order that indicates whether the customer should receive notifications about order updates. |
customer_id | string The ID of the customer this draft order is associated with. |
Responses
Response Schema: application/json
required | object (DraftOrder) A draft order is created by an admin without direct involvement of the customer. Once its payment is marked as captured, it is transformed into an order. | ||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "region_id": "string",
- "country_code": "string",
- "email": "user@example.com",
- "billing_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "shipping_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "discounts": [
- {
- "code": "string"
}
], - "no_notification_order": true,
- "customer_id": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Draft Order
Delete a Draft Order
Authorizations:
path Parameters
id required | string The ID of the Draft Order. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Draft Order. |
object required | string Default: "draft-order" The type of the object that was deleted. |
deleted required | boolean Default: true Whether the draft order was deleted successfully. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.draftOrders.delete(draftOrderId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "draft-order",
- "deleted": true
}
Create a Line Item
Create a Line Item in the Draft Order.
Authorizations:
path Parameters
id required | string The ID of the Draft Order. |
Request Body schema: application/json
quantity required | integer The quantity of the line item. |
variant_id | string The ID of the Product Variant associated with the line item. If the line item is custom, the |
unit_price | integer The custom price of the line item. If a |
title | string Default: "Custom item" The title of the line item if |
metadata | object The optional key-value map with additional details about the Line Item. |
Responses
Response Schema: application/json
required | object (DraftOrder) A draft order is created by an admin without direct involvement of the customer. Once its payment is marked as captured, it is transformed into an order. | ||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "variant_id": "string",
- "unit_price": 0,
- "title": "Custom item",
- "quantity": 0,
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Line Item
Update a Line Item in a Draft Order
Authorizations:
path Parameters
id required | string The ID of the Draft Order. |
line_id required | string The ID of the Line Item. |
Request Body schema: application/json
unit_price | integer The custom price of the line item. If a |
title | string The title of the line item if |
quantity | integer The quantity of the line item. |
metadata | object The optional key-value map with additional details about the Line Item. |
Responses
Response Schema: application/json
required | object (DraftOrder) A draft order is created by an admin without direct involvement of the customer. Once its payment is marked as captured, it is transformed into an order. | ||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "unit_price": 0,
- "title": "string",
- "quantity": 0,
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Line Item
Deletes a Line Item from a Draft Order.
Authorizations:
path Parameters
id required | string The ID of the Draft Order. |
line_id required | string The ID of the line item. |
Responses
Response Schema: application/json
required | object (DraftOrder) A draft order is created by an admin without direct involvement of the customer. Once its payment is marked as captured, it is transformed into an order. | ||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.draftOrders.removeLineItem(draftOrderId, itemId) .then(({ draft_order }) => { console.log(draft_order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "draft_order": {
- "id": "dorder_01G8TJFKBG38YYFQ035MSVG03C",
- "status": "open",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "canceled_at": "2019-08-24T14:15:22Z",
- "completed_at": "2019-08-24T14:15:22Z",
- "no_notification_order": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Mark Paid
Capture the draft order's payment. This will also set the draft order's status to completed
and create an Order from the draft order. The payment is captured through Medusa's system payment, which is manual payment that isn't integrated with any third-party payment provider. It is assumed that the payment capturing is handled manually by the admin.
Authorizations:
path Parameters
id required | string The Draft Order ID. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.draftOrders.markPaid(draftOrderId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Admins can create gift cards and send them directly to customers, specifying options like their balance, region, and more. These gift cards are different than the saleable gift cards in a store, which are created and managed through Product endpoints.
List Gift Cards
Retrieve a list of Gift Cards. The gift cards can be filtered by fields such as q
. The gift cards can also paginated.
Authorizations:
query Parameters
offset | number Default: "0" The number of gift cards to skip when retrieving the gift cards. |
limit | number Default: "50" Limit the number of gift cards returned. |
q | string a term to search gift cards' code or display ID |
Responses
Response Schema: application/json
required | Array of objects (Gift Card) |
count required | integer The total number of items available |
offset required | integer The number of gift cards skipped when retrieving the gift cards. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.giftCards.list() .then(({ gift_cards, limit, offset, count }) => { console.log(gift_cards.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "gift_cards": [
- {
- "id": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ",
- "code": "3RFT-MH2C-Y4YZ-XMN4",
- "value": 10,
- "balance": 10,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "is_disabled": false,
- "ends_at": "2019-08-24T14:15:22Z",
- "tax_rate": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Gift Card
Create a Gift Card that can redeemed by its unique code. The Gift Card is only valid within 1 region.
Authorizations:
Request Body schema: application/json
region_id required | string The ID of the Region in which the Gift Card can be used. |
value | integer The value (excluding VAT) that the Gift Card should represent. |
is_disabled | boolean Whether the Gift Card is disabled on creation. If set to |
ends_at | string <date-time> The date and time at which the Gift Card should no longer be available. |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Gift Card) Gift Cards are redeemable and represent a value that can be used towards the payment of an Order. | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "value": 0,
- "is_disabled": true,
- "ends_at": "2019-08-24T14:15:22Z",
- "region_id": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "gift_card": {
- "id": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ",
- "code": "3RFT-MH2C-Y4YZ-XMN4",
- "value": 10,
- "balance": 10,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "is_disabled": false,
- "ends_at": "2019-08-24T14:15:22Z",
- "tax_rate": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Gift Card
Retrieve a Gift Card's details.
Authorizations:
path Parameters
id required | string The ID of the Gift Card. |
Responses
Response Schema: application/json
required | object (Gift Card) Gift Cards are redeemable and represent a value that can be used towards the payment of an Order. | ||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.giftCards.retrieve(giftCardId) .then(({ gift_card }) => { console.log(gift_card.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "gift_card": {
- "id": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ",
- "code": "3RFT-MH2C-Y4YZ-XMN4",
- "value": 10,
- "balance": 10,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "is_disabled": false,
- "ends_at": "2019-08-24T14:15:22Z",
- "tax_rate": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Gift Card
Update a Gift Card's details.
Authorizations:
path Parameters
id required | string The ID of the Gift Card. |
Request Body schema: application/json
balance | integer The value (excluding VAT) that the Gift Card should represent. |
is_disabled | boolean Whether the Gift Card is disabled on creation. If set to |
ends_at | string <date-time> The date and time at which the Gift Card should no longer be available. |
region_id | string The ID of the Region in which the Gift Card can be used. |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Gift Card) Gift Cards are redeemable and represent a value that can be used towards the payment of an Order. | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "balance": 0,
- "is_disabled": true,
- "ends_at": "2019-08-24T14:15:22Z",
- "region_id": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "gift_card": {
- "id": "gift_01G8XKBPBQY2R7RBET4J7E0XQZ",
- "code": "3RFT-MH2C-Y4YZ-XMN4",
- "value": 10,
- "balance": 10,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "is_disabled": false,
- "ends_at": "2019-08-24T14:15:22Z",
- "tax_rate": 0,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Gift Card
Delete a Gift Card. Once deleted, it can't be used by customers.
Authorizations:
path Parameters
id required | string The ID of the Gift Card to delete. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Gift Card |
object required | string Default: "gift-card" The type of the object that was deleted. |
deleted required | boolean Default: true Whether the gift card was deleted successfully. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.giftCards.delete(giftCardId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "gift-card",
- "deleted": true
}
Inventory items, provided by the Inventory Module, can be used to manage the inventory of saleable items in your store.
List Inventory Items
Retrieve a list of inventory items. The inventory items can be filtered by fields such as q
or location_id
. The inventory items can also be paginated.
Authorizations:
query Parameters
offset | integer Default: 0 The number of inventory items to skip when retrieving the inventory items. |
limit | integer Default: 20 Limit the number of inventory items returned. |
expand | string Comma-separated relations that should be expanded in each returned inventory item. |
fields | string Comma-separated fields that should be included in the returned inventory item. |
q | string term to search inventory item's sku, title, and description. |
location_id | Array of strings Filter by location IDs. |
string or Array of strings Filter by the inventory ID | |
sku | string Filter by SKU |
origin_country | string Filter by origin country |
mid_code | string Filter by MID code |
material | string Filter by material |
hs_code | string Filter by HS Code |
weight | string Filter by weight |
length | string Filter by length |
height | string Filter by height |
width | string Filter by width |
requires_shipping | string Filter by whether the item requires shipping |
Responses
Response Schema: application/json
required | Array of objects (DecoratedInventoryItemDTO) an array of Inventory Item details |
count required | integer The total number of items available |
offset required | integer The number of inventory items skipped when retrieving the inventory items. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.inventoryItems.list() .then(({ inventory_items, count, offset, limit }) => { console.log(inventory_items.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "inventory_items": [
- {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "location_levels": [
- null
], - "variants": [
- null
], - "stocked_quantity": 0,
- "reserved_quantity": 0
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create an Inventory Item
Create an Inventory Item.
Authorizations:
query Parameters
expand | string Comma-separated relations that should be expanded in the returned inventory item. |
fields | string Comma-separated fields that should be included in the returned inventory item. |
Request Body schema: application/json
sku | string The unique SKU of the associated Product Variant. |
ean | string The EAN number of the item. |
upc | string The UPC number of the item. |
barcode | string A generic GTIN field for the Product Variant. |
hs_code | string The Harmonized System code of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers. |
inventory_quantity | integer Default: 0 The amount of stock kept of the associated Product Variant. |
allow_backorder | boolean Whether the associated Product Variant can be purchased when out of stock. |
manage_inventory | boolean Default: true Whether Medusa should keep track of the inventory for the associated Product Variant. |
weight | number The weight of the Inventory Item. May be used in shipping rate calculations. |
length | number The length of the Inventory Item. May be used in shipping rate calculations. |
height | number The height of the Inventory Item. May be used in shipping rate calculations. |
width | number The width of the Inventory Item. May be used in shipping rate calculations. |
origin_country | string The country in which the Inventory Item was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers. |
mid_code | string The Manufacturers Identification code that identifies the manufacturer of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers. |
material | string The material and composition that the Inventory Item is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
required | object (InventoryItemDTO) | ||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "sku": "string",
- "ean": "string",
- "upc": "string",
- "barcode": "string",
- "hs_code": "string",
- "inventory_quantity": 0,
- "allow_backorder": true,
- "manage_inventory": true,
- "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Get an Inventory Item
Retrieve an Inventory Item's details.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned inventory item. |
fields | string Comma-separated fields that should be included in the returned inventory item. |
Responses
Response Schema: application/json
required | object (InventoryItemDTO) | ||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.inventoryItems.retrieve(inventoryItemId) .then(({ inventory_item }) => { console.log(inventory_item.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Update an Inventory Item
Update an Inventory Item's details.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned inventory level. |
fields | string Comma-separated fields that should be included in the returned inventory level. |
Request Body schema: application/json
hs_code | string The Harmonized System code of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers. |
origin_country | string The country in which the Inventory Item was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers. |
mid_code | string The Manufacturers Identification code that identifies the manufacturer of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers. |
material | string The material and composition that the Inventory Item is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers. |
weight | number The weight of the Inventory Item. May be used in shipping rate calculations. |
height | number The height of the Inventory Item. May be used in shipping rate calculations. |
width | number The width of the Inventory Item. May be used in shipping rate calculations. |
length | number The length of the Inventory Item. May be used in shipping rate calculations. |
requires_shipping | boolean Whether the item requires shipping. |
Responses
Response Schema: application/json
required | object (InventoryItemDTO) | ||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Delete an Inventory Item
Delete an Inventory Item. This does not delete the associated product variant.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item to delete. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Inventory Item. |
object required | string <inventory_item> The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the Inventory Item was deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.inventoryItems.delete(inventoryItemId) .then(({ id, object, deleted }) => { console.log(id) })
Response samples
- 200
- 400
{- "id": "string",
- "object": "string",
- "deleted": true
}
List Inventory Level
Retrieve a list of inventory levels of an inventory item. The inventory levels can be filtered by fields such as location_id
. The inventory levels can also be paginated.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item the locations are associated with. |
query Parameters
location_id | Array of strings Filter by location IDs. |
expand | string Comma-separated relations that should be expanded in the returned inventory levels. |
fields | string Comma-separated fields that should be included in the returned inventory levels. |
Responses
Response Schema: application/json
required | object | ||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.inventoryItems.listLocationLevels(inventoryItemId) .then(({ inventory_item }) => { console.log(inventory_item.location_levels); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "inventory_item": {
- "id": null,
- "location_levels": [
- {
- "location_id": null,
- "stocked_quantity": null,
- "reserved_quantity": null,
- "incoming_quantity": null,
- "metadata": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
]
}
}
Create an Inventory Level
Create an Inventory Level for a given Inventory Item.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned inventory item. |
fields | string Comma-separated fields that should be included in the returned inventory item. |
Request Body schema: application/json
location_id required | string the ID of the stock location |
stocked_quantity required | number the stock quantity of the inventory item at this location |
incoming_quantity | number the incoming stock quantity of the inventory item at this location |
Responses
Response Schema: application/json
required | object (InventoryItemDTO) | ||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "location_id": "string",
- "stocked_quantity": 0,
- "incoming_quantity": 0
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Update an Inventory Level
Update an Inventory Level's details for a given Inventory Item.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item that the location is associated with. |
location_id required | string The ID of the Location to update. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned inventory level. |
fields | string Comma-separated fields that should be included in the returned inventory level. |
Request Body schema: application/json
stocked_quantity | number the total stock quantity of an inventory item at the given location ID |
incoming_quantity | number the incoming stock quantity of an inventory item at the given location ID |
Responses
Response Schema: application/json
required | object (InventoryItemDTO) | ||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "stocked_quantity": 0,
- "incoming_quantity": 0
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Delete a Location Level
Delete a location level of an Inventory Item.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item. |
location_id required | string The ID of the location. |
Responses
Response Schema: application/json
required | object (InventoryItemDTO) | ||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.inventoryItems.deleteLocationLevel(inventoryItemId, locationId) .then(({ inventory_item }) => { console.log(inventory_item.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "inventory_item": {
- "sku": "string",
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "title": "string",
- "description": "string",
- "thumbnail": "string",
- "material": "string",
- "weight": 0,
- "height": 0,
- "width": 0,
- "length": 0,
- "requires_shipping": true,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
An admin can invite new users to manage their team. This would allow new users to authenticate as admins and perform admin functionalities.
Lists Invites
Retrieve a list of invites.
Authorizations:
Responses
Response Schema: application/json
required | Array of objects (Invite) An array of invites | ||||||||||||||||||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.invites.list() .then(({ invites }) => { console.log(invites.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "invites": [
- {
- "id": "invite_01G8TKE4XYCTHSCK2GDEP47RE1",
- "user_email": "user@example.com",
- "role": "admin",
- "accepted": false,
- "token": "string",
- "expires_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}
Create an Invite
Create an Invite. This will generate a token associated with the invite and trigger an invite.created
event. If you have a Notification Provider installed that handles this event, a notification should be sent to the email associated with the invite to allow them to accept the invite.
Authorizations:
Request Body schema: application/json
user required | string <email> The email associated with the invite. Once the invite is accepted, the email will be associated with the created user. |
role required | string Enum: "admin" "member" "developer" The role of the user to be created. This does not actually change the privileges of the user that is eventually created. |
Responses
Request samples
- Payload
- JS Client
- cURL
{- "user": "user@example.com",
- "role": "admin"
}
Response samples
- 400
- 404
- 409
- 422
- 500
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}
Accept an Invite
Accept an Invite. This will also delete the invite and create a new user that can log in and perform admin functionalities. The user will have the email associated with the invite, and the password provided in the request body.
Authorizations:
Request Body schema: application/json
token required | string The token of the invite to accept. This is a unique token generated when the invite was created or resent. |
required | object The details of the user to create. |
Responses
Request samples
- Payload
- JS Client
- cURL
{- "token": "string",
- "user": {
- "first_name": "string",
- "last_name": "string",
- "password": "pa$$word"
}
}
Response samples
- 400
- 404
- 409
- 422
- 500
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}
Delete an Invite
Delete an Invite. Only invites that weren't accepted can be deleted.
Authorizations:
path Parameters
invite_id required | string The ID of the Invite |
Responses
Response Schema: application/json
id required | string The ID of the deleted Invite. |
object required | string Default: "invite" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the invite was deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.invites.delete(inviteId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "invite",
- "deleted": true
}
Resend an Invite
Resend an Invite. This renews the expiry date by 7 days and generates a new token for the invite. It also triggers the invite.created
event, so if you have a Notification Provider installed that handles this event, a notification should be sent to the email associated with the invite to allow them to accept the invite.
Authorizations:
path Parameters
invite_id required | string The ID of the Invite |
Responses
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.invites.resend(inviteId) .then(() => { // successful }) .catch(() => { // an error occurred });
Response samples
- 400
- 404
- 409
- 422
- 500
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}
Notes are created by admins and can be associated with any resource. For example, an admin can add a note to an order for additional details or remarks.
List Notes
Retrieve a list of notes. The notes can be filtered by fields such as resource_id
. The notes can also be paginated.
Authorizations:
query Parameters
limit | number Default: "50" Limit the number of notes returned. |
offset | number Default: "0" The number of notes to skip when retrieving the notes. |
resource_id | string Filter by resource ID |
Responses
Response Schema: application/json
required | Array of objects (Note) An array of notes |
count required | integer The total number of items available |
offset required | integer The number of notes skipped when retrieving the notes. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes.list() .then(({ notes, limit, offset, count }) => { console.log(notes.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "notes": [
- {
- "id": "note_01G8TM8ENBMC7R90XRR1G6H26Q",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "value": "This order must be fulfilled on Monday",
- "author_id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "author": {
- "id": null,
- "role": null,
- "email": null,
- "first_name": null,
- "last_name": null,
- "api_token": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Note
Create a Note which can be associated with any resource.
Authorizations:
Request Body schema: application/json
resource_id required | string The ID of the resource which the Note relates to. For example, an order ID. |
resource_type required | string The type of resource which the Note relates to. For example, |
value required | string The content of the Note to create. |
Responses
Response Schema: application/json
required | object (Note) A Note is an element that can be used in association with different resources to allow admin users to describe additional information. For example, they can be used to add additional information about orders. | ||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "resource_id": "string",
- "resource_type": "string",
- "value": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "note": {
- "id": "note_01G8TM8ENBMC7R90XRR1G6H26Q",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "value": "This order must be fulfilled on Monday",
- "author_id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "author": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Note
Retrieve a note's details.
Authorizations:
path Parameters
id required | string The ID of the note. |
Responses
Response Schema: application/json
required | object (Note) A Note is an element that can be used in association with different resources to allow admin users to describe additional information. For example, they can be used to add additional information about orders. | ||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes.retrieve(noteId) .then(({ note }) => { console.log(note.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "note": {
- "id": "note_01G8TM8ENBMC7R90XRR1G6H26Q",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "value": "This order must be fulfilled on Monday",
- "author_id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "author": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Note
Update a Note's details.'
Authorizations:
path Parameters
id required | string The ID of the Note |
Request Body schema: application/json
value required | string The description of the Note. |
Responses
Response Schema: application/json
required | object (Note) A Note is an element that can be used in association with different resources to allow admin users to describe additional information. For example, they can be used to add additional information about orders. | ||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "value": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "note": {
- "id": "note_01G8TM8ENBMC7R90XRR1G6H26Q",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "value": "This order must be fulfilled on Monday",
- "author_id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "author": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Note
Delete a Note.
Authorizations:
path Parameters
id required | string The ID of the Note to delete. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Note. |
object required | string Default: "note" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the Note was deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notes.delete(noteId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "note",
- "deleted": true
}
Notifications are sent to customers to inform them of new updates. For example, a notification can be sent to the customer when their order is place or its state is updated. The notification's type, such as an email or SMS, is determined by the notification provider installed on the Medusa backend.
List Notifications
Retrieve a list of notifications. The notifications can be filtered by fields such as event_name
or resource_type
. The notifications can also be paginated.
Authorizations:
query Parameters
offset | integer Default: 0 The number of inventory items to skip when retrieving the inventory items. |
limit | integer Default: 50 Limit the number of notifications returned. |
fields | string Comma-separated fields that should be included in each returned notification. |
expand | string Comma-separated relations that should be expanded in each returned notification. |
event_name | string Filter by the name of the event that triggered sending this notification. |
resource_type | string Filter by the resource type. |
resource_id | string Filter by the resource ID. |
to | string Filter by the address that the Notification was sent to. This will usually be an email address, but it can also represent other addresses such as a chat bot user id. |
include_resends | string A boolean indicating whether the result set should include resent notifications or not |
Responses
Response Schema: application/json
required | Array of objects (Notification) an array of notifications |
count | integer The total number of notifications |
offset | integer The number of notifications skipped when retrieving the notifications. |
limit | integer The number of notifications per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.notifications.list() .then(({ notifications }) => { console.log(notifications.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "notifications": [
- {
- "id": "noti_01G53V9Y6CKMCGBM1P0X7C28RX",
- "event_name": "order.placed",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": {
- "id": null,
- "email": null,
- "first_name": null,
- "last_name": null,
- "billing_address_id": null,
- "billing_address": null,
- "shipping_addresses": [ ],
- "phone": null,
- "has_account": null,
- "orders": [ ],
- "groups": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "to": "user@example.com",
- "data": { },
- "parent_id": "noti_01G53V9Y6CKMCGBM1P0X7C28RX",
- "parent_notification": { },
- "resends": [
- { }
], - "provider_id": "sengrid",
- "provider": {
- "id": null,
- "is_installed": null
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Resend Notification
Resend a previously sent notifications, with the same data but optionally to a different address.
Authorizations:
path Parameters
id required | string The ID of the Notification |
Request Body schema: application/json
to | string A new address or user identifier that the Notification should be sent to. If not provided, the previous |
Responses
Response Schema: application/json
required | object (Notification) A notification is an alert sent, typically to customers, using the installed Notification Provider as a reaction to internal events such as | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "to": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "notification": {
- "id": "noti_01G53V9Y6CKMCGBM1P0X7C28RX",
- "event_name": "order.placed",
- "resource_type": "order",
- "resource_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": {
- "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "email": "user@example.com",
- "first_name": "Arno",
- "last_name": "Willms",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_addresses": [
- null
], - "phone": 16128234334802,
- "has_account": false,
- "orders": [
- { }
], - "groups": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "to": "user@example.com",
- "data": { },
- "parent_id": "noti_01G53V9Y6CKMCGBM1P0X7C28RX",
- "parent_notification": { },
- "resends": [
- { }
], - "provider_id": "sengrid",
- "provider": {
- "id": "sendgrid",
- "is_installed": true
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
An admin can edit an order to remove, add, or update an item's quantity. When an admin edits an order, they're stored as an OrderEdit
.
List Order Edits
Retrieve a list of order edits. The order edits can be filtered by fields such as q
or order_id
. The order edits can also be paginated.
Authorizations:
query Parameters
q | string term to search order edits' internal note. |
order_id | string Filter by order ID |
limit | number Default: "20" Limit the number of order edits returned. |
offset | number Default: "0" The number of order edits to skip when retrieving the order edits. |
expand | string Comma-separated relations that should be expanded in each returned order edit. |
fields | string Comma-separated fields that should be included in each returned order edit. |
Responses
Response Schema: application/json
required | Array of objects (Order Edit) An array of order edit details |
count required | integer The total number of items available |
offset required | integer The number of order edits skipped when retrieving the order edits. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.list() .then(({ order_edits, count, limit, offset }) => { console.log(order_edits.length) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order_edits": [
- {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- null
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- null
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": null,
- "type": null,
- "status": null,
- "description": null,
- "amount": null,
- "authorized_amount": null,
- "region_id": null,
- "region": null,
- "currency_code": null,
- "currency": null,
- "payment_sessions": [ ],
- "payments": [ ],
- "created_by": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create an OrderEdit
Create an Order Edit.
Authorizations:
Request Body schema: application/json
order_id required | string The ID of the order to create the edit for. |
internal_note | string An optional note to associate with the order edit. |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "order_id": "string",
- "internal_note": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Get an Order Edit
Retrieve an Order Edit's details.
Authorizations:
path Parameters
id required | string The ID of the OrderEdit. |
query Parameters
expand | string Comma-separated relations that should be expanded in each returned order edit. |
fields | string Comma-separated fields that should be included in the returned order edit. |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.retrieve(orderEditId) .then(({ order_edit }) => { console.log(order_edit.id) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Update an Order Edit
Updates an Order Edit's details.
Authorizations:
path Parameters
id required | string The ID of the OrderEdit. |
Request Body schema: application/json
internal_note | string An optional note to create or update in the order edit. |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "internal_note": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Delete an Order Edit
Delete an Order Edit. Only order edits that have the status created
can be deleted.
Authorizations:
path Parameters
id required | string The ID of the Order Edit to delete. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Order Edit. |
object required | string Default: "order_edit" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the Order Edit was deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.delete(orderEditId) .then(({ id, object, deleted }) => { console.log(id) })
Response samples
- 200
- 400
{- "id": "string",
- "object": "order_edit",
- "deleted": true
}
Cancel an Order Edit
Cancel an OrderEdit.
Authorizations:
path Parameters
id required | string The ID of the OrderEdit. |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.cancel(orderEditId) .then(({ order_edit }) => { console.log(order_edit.id) })
Response samples
- 200
- 400
- 404
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Delete a Line Item Change
Delete a line item change that indicates the addition, deletion, or update of a line item in the original order.
Authorizations:
path Parameters
id required | string The ID of the Order Edit. |
change_id required | string The ID of the Line Item Change to delete. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Order Edit Item Change. |
object required | string Default: "item_change" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the Order Edit Item Change was deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.deleteItemChange(orderEdit_id, itemChangeId) .then(({ id, object, deleted }) => { console.log(id) })
Response samples
- 200
- 400
{- "id": "string",
- "object": "item_change",
- "deleted": true
}
Confirm an OrderEdit
Confirm an Order Edit. This will reflect the changes in the order edit on the associated order.
Authorizations:
path Parameters
id required | string The ID of the order edit. |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.confirm(orderEditId) .then(({ order_edit }) => { console.log(order_edit.id) })
Response samples
- 200
- 400
- 404
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Add a Line Item
Create a line item change in the order edit that indicates adding an item in the original order. The item will not be added to the original order until the order edit is confirmed.
Authorizations:
path Parameters
id required | string The ID of the Order Edit. |
Request Body schema: application/json
variant_id required | string The ID of the product variant associated with the item. |
quantity required | number The quantity of the item. |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "variant_id": "string",
- "quantity": 0,
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Upsert Line Item Change
Create or update a line item change in the order edit that indicates addition, deletion, or update of a line item into an original order. Line item changes are only reflected on the original order after the order edit is confirmed.
Authorizations:
path Parameters
id required | string The ID of the Order Edit. |
item_id required | string The ID of the line item in the original order. |
Request Body schema: application/json
quantity required | number The quantity to update |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "quantity": 0
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Delete Line Item
Create a line item change in the order edit that indicates deleting an item in the original order. The item in the original order will not be deleted until the order edit is confirmed.
Authorizations:
path Parameters
id required | string The ID of the Order Edit. |
item_id required | string The ID of line item in the original order. |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.removeLineItem(orderEditId, lineItemId) .then(({ order_edit }) => { console.log(order_edit.id) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Request Confirmation
Request customer confirmation of an Order Edit. This would emit the event order-edit.requested
which Notification Providers listen to and send a notification to the customer about the order edit.
Authorizations:
path Parameters
id required | string The ID of the Order Edit. |
Responses
Response Schema: application/json
required | object (Order Edit) Order edit allows modifying items in an order, such as adding, updating, or deleting items from the original order. Once the order edit is confirmed, the changes are reflected on the original order. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orderEdits.requestConfirmation(orderEditId) .then({ order_edit }) => { console.log(order_edit.id) })
Response samples
- 200
- 400
- 404
- 500
{- "order_edit": {
- "id": "oe_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order_id": "order_01G2SG30J8C85S4A5CHM2S1NS2",
- "order": { },
- "changes": [
- {
- "id": null,
- "type": null,
- "order_edit_id": null,
- "order_edit": { },
- "original_line_item_id": null,
- "original_line_item": null,
- "line_item_id": null,
- "line_item": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "internal_note": "Included two more items B to the order.",
- "created_by": "string",
- "requested_by": "string",
- "requested_at": "2019-08-24T14:15:22Z",
- "confirmed_by": "string",
- "confirmed_at": "2019-08-24T14:15:22Z",
- "declined_by": "string",
- "declined_at": "2019-08-24T14:15:22Z",
- "declined_reason": "string",
- "canceled_by": "string",
- "canceled_at": "2019-08-24T14:15:22Z",
- "subtotal": 8000,
- "discount_total": 800,
- "shipping_total": 800,
- "gift_card_total": 800,
- "gift_card_tax_total": 800,
- "tax_total": 0,
- "total": 8200,
- "difference_due": 8200,
- "status": "confirmed",
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "payment_collection_id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "payment_sessions": [
- null
], - "payments": [
- null
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Orders are purchases made by customers, typically through a storefront using the Store API. Draft orders created by the admin are also transformed to an Order once the payment is captured. Managing orders include managing fulfillment, payment, claims, reservations, and more.
List Orders
Retrieve a list of Orders. The orders can be filtered by fields such as status
or display_id
. The order can also be paginated.
Authorizations:
query Parameters
q | string term to search orders' shipping address, first name, email, and display ID |
id | string Filter by ID. |
status | Array of strings Items Enum: "pending" "completed" "archived" "canceled" "requires_action" Filter by status |
fulfillment_status | Array of strings Items Enum: "not_fulfilled" "fulfilled" "partially_fulfilled" "shipped" "partially_shipped" "canceled" "returned" "partially_returned" "requires_action" Filter by fulfillment status |
payment_status | Array of strings Items Enum: "captured" "awaiting" "not_paid" "refunded" "partially_refunded" "canceled" "requires_action" Filter by payment status |
display_id | string Filter by display ID |
cart_id | string Filter by cart ID |
customer_id | string Filter by customer ID |
string Filter by email | |
string or Array of strings Filter by region IDs. | |
currency_code | |
tax_rate | string Filter by tax rate. |
object Filter by a creation date range. | |
object Filter by an update date range. | |
object Filter by a cancelation date range. | |
sales_channel_id | Array of strings Filter by Sales Channel IDs |
offset | integer Default: 0 The number of orders to skip when retrieving the orders. |
limit | integer Default: 50 Limit the number of orders returned. |
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | Array of objects (Order) An array of order details. |
count required | integer The total number of items available |
offset required | integer The number of orders skipped when retrieving the orders. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.list() .then(({ orders, limit, offset, count }) => { console.log(orders.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "orders": [
- {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": null,
- "name": null,
- "currency_code": null,
- "currency": null,
- "tax_rate": null,
- "tax_rates": [ ],
- "tax_code": null,
- "gift_cards_taxable": null,
- "automatic_taxes": null,
- "countries": [ ],
- "tax_provider_id": null,
- "tax_provider": null,
- "payment_providers": [ ],
- "fulfillment_providers": [ ],
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "discounts": [
- null
], - "gift_cards": [
- null
], - "shipping_methods": [
- null
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- null
], - "edits": [
- { }
], - "gift_card_transactions": [
- null
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Get an Order
Retrieve an Order's details.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.retrieve(orderId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update an Order
Update and order's details.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
string the email associated with the order | |
object (AddressPayload) Address fields used when creating/updating an address. | |
object (AddressPayload) Address fields used when creating/updating an address. | |
Array of objects (Line Item) The line items of the order | |
region | string ID of the region that the order is associated with. |
Array of objects (Discount) The discounts applied to the order | |
customer_id | string The ID of the customer associated with the order. |
object The payment method chosen for the order. | |
object The Shipping Method used for shipping the order. | |
no_notification | boolean If set to |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "email": "string",
- "billing_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "shipping_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "items": [
- {
- "id": "item_01G8ZC9GWT6B2GP5FSXRXNFNGN",
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [
- null
], - "adjustments": [
- null
], - "original_item_id": "string",
- "order_edit_id": "string",
- "order_edit": { },
- "title": "Medusa Coffee Mug",
- "description": "One Size",
- "is_return": false,
- "is_giftcard": false,
- "should_merge": true,
- "allow_discounts": true,
- "has_shipping": false,
- "unit_price": 8000,
- "variant_id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6",
- "variant": {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null
}, - "quantity": 1,
- "fulfilled_quantity": 0,
- "returned_quantity": 0,
- "shipped_quantity": 0,
- "refundable": 0,
- "subtotal": 8000,
- "tax_total": 0,
- "total": 8000,
- "original_total": 8000,
- "original_tax_total": 0,
- "discount_total": 0,
- "raw_discount_total": 0,
- "gift_card_total": 0,
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "region": "string",
- "discounts": [
- {
- "id": "disc_01F0YESMW10MGHWJKZSDDMN0VN",
- "code": "10DISC",
- "is_dynamic": false,
- "rule_id": "dru_01F0YESMVK96HVX7N419E3CJ7C",
- "rule": {
- "id": null,
- "type": null,
- "description": null,
- "value": null,
- "allocation": null,
- "conditions": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "is_disabled": false,
- "parent_discount_id": "disc_01G8ZH853YPY9B94857DY91YGW",
- "parent_discount": { },
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "valid_duration": "P3Y6M4DT12H30M5S",
- "regions": [
- null
], - "usage_limit": 100,
- "usage_count": 50,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "customer_id": "string",
- "payment_method": {
- "provider_id": "string",
- "data": { }
}, - "shipping_method": {
- "provider_id": "string",
- "profile_id": "string",
- "price": 0,
- "data": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
]
}, - "no_notification": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Archive Order
Archive an order and change its status.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.archive(orderId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Cancel an Order
Cancel an order and change its status. This will also cancel any associated Fulfillments and Payments, and it may fail if the Payment or Fulfillment Provider is unable to cancel the Payment/Fulfillment.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancel(orderId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Capture an Order's Payments
Capture all the Payments associated with an Order. The payment of canceled orders can't be captured.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.capturePayment(orderId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Create a Claim
Create a Claim for an order. If a return shipping method is specified, a return will also be created and associated with the claim. If the claim's type is refund
, the refund is processed as well.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
type required | string Enum: "replace" "refund" The type of the Claim. This will determine how the Claim is treated: |
required | Array of objects The Claim Items that the Claim will consist of. |
object Optional details for the Return Shipping Method, if the items are to be sent back. Providing this field will result in a return being created and associated with the claim. | |
Array of objects The new items to send to the Customer. This is only used if the claim's type is | |
Array of objects The Shipping Methods to send the additional Line Items with. This is only used if the claim's type is | |
object (AddressPayload) Address fields used when creating/updating an address. | |
refund_amount | integer The amount to refund the customer. This is used when the claim's type is |
no_notification | boolean If set to true no notification will be send related to this Claim. |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "type": "replace",
- "claim_items": [
- {
- "item_id": "string",
- "quantity": 0,
- "note": "string",
- "reason": "missing_item",
- "tags": [
- null
], - "images": [
- null
]
}
], - "return_shipping": {
- "option_id": "string",
- "price": 0
}, - "additional_items": [
- {
- "variant_id": "string",
- "quantity": 0
}
], - "shipping_methods": [
- {
- "id": "string",
- "option_id": "string",
- "price": 0,
- "data": { }
}
], - "shipping_address": {
- "first_name": "Arno",
- "last_name": "Willms",
- "phone": 16128234334802,
- "company": "string",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "metadata": {
- "car": "white"
}
}, - "refund_amount": 0,
- "no_notification": true,
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Claim
Update a Claim's details.
Authorizations:
path Parameters
id required | string The ID of the Order associated with the claim. |
claim_id required | string The ID of the Claim. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
Array of objects The Claim Items that the Claim will consist of. | |
Array of objects The Shipping Methods to send the additional Line Items with. | |
no_notification | boolean If set to true no notification will be send related to this Swap. |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "claim_items": [
- {
- "id": "string",
- "item_id": "string",
- "quantity": 0,
- "note": "string",
- "reason": "missing_item",
- "tags": [
- { }
], - "images": [
- { }
], - "metadata": { }
}
], - "shipping_methods": [
- {
- "id": "string",
- "option_id": "string",
- "price": 0,
- "data": { }
}
], - "no_notification": true,
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Cancel a Claim
Cancel a Claim and change its status. A claim can't be canceled if it has a refund, if its fulfillments haven't been canceled, of if its associated return hasn't been canceled.
Authorizations:
path Parameters
id required | string The ID of the order the claim is associated with. |
claim_id required | string The ID of the Claim. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancelClaim(orderId, claimId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Create a Claim Fulfillment
Create a Fulfillment for a Claim.
Authorizations:
path Parameters
id required | string The ID of the Order the claim is associated with. |
claim_id required | string The ID of the Claim. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
metadata | object An optional set of key-value pairs to hold additional information. |
no_notification | boolean If set to |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "metadata": { },
- "no_notification": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Cancel Claim's Fulfillment
Cancel a claim's fulfillment and change its status.
Authorizations:
path Parameters
id required | string The ID of the order the claim is associated with. |
claim_id required | string The ID of the claim. |
fulfillment_id required | string The ID of the fulfillment. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancelClaimFulfillment(orderId, claimId, fulfillmentId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Ship a Claim's Fulfillment
Mark a claim's fulfillment as shipped. This changes the claim's fulfillment status to either shipped
or partially_shipped
, depending on whether all the items were shipped.
Authorizations:
path Parameters
id required | string The ID of the Order the claim is associated with. |
claim_id required | string The ID of the Claim. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
fulfillment_id required | string The ID of the Fulfillment. |
tracking_numbers | Array of strings An array of tracking numbers for the shipment. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "fulfillment_id": "string",
- "tracking_numbers": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Complete an Order
Complete an Order and change its status. A canceled order can't be completed.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.complete(orderId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Create a Fulfillment
Create a Fulfillment of an Order using the fulfillment provider.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
required | Array of objects The Line Items to include in the Fulfillment. |
no_notification | boolean If set to |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "items": [
- {
- "item_id": "string",
- "quantity": 0
}
], - "no_notification": true,
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Cancel a Fulfilmment
Cancel an order's fulfillment and change its status.
Authorizations:
path Parameters
id required | string The ID of the Order. |
fulfillment_id required | string The ID of the Fulfillment. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancelFulfillment(orderId, fulfillmentId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Create a Reservation
Create a Reservation for a line item at a specified location, optionally for a partial quantity.
Authorizations:
path Parameters
id required | string The ID of the Order. |
line_item_id required | string The ID of the Line item. |
Request Body schema: application/json
location_id required | string The ID of the location of the reservation |
quantity | number The quantity to reserve |
Responses
Response Schema: application/json
location_id required | string The ID of the location of the reservation. |
inventory_item_id required | string The ID of the inventory item the reservation is associated with. |
quantity required | number The quantity to reserve. |
line_item_id | string The ID of the line item of the reservation. |
metadata | object An optional set of key-value pairs with additional information. |
Request samples
- Payload
- cURL
{- "location_id": "string",
- "quantity": 0
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "line_item_id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "quantity": 0,
- "metadata": { }
}
Create a Refund
Refund an amount for an order. The amount must be less than or equal the refundable_amount
of the order.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
amount required | integer The amount to refund. It should be less than or equal the |
reason required | string The reason for the Refund. |
note | string A note with additional details about the Refund. |
no_notification | boolean If set to |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "amount": 0,
- "reason": "string",
- "note": "string",
- "no_notification": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get Order Reservations
Retrieve the list of reservations of an Order
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
offset | integer Default: 0 The number of reservations to skip when retrieving the reservations. |
limit | integer Default: 20 Limit the number of reservations returned. |
Responses
Response Schema: application/json
required | Array of objects (ExtendedReservationItem) An array of reservations details. |
count required | integer The total number of items available |
offset required | integer The number of reservations skipped when retrieving the reservations. |
limit required | integer The number of items per page |
Request samples
- cURL
curl 'https://medusa-url.com/admin/orders/{id}/reservations' \ -H 'Authorization: Bearer {api_token}'
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "reservations": [
- {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "description": "string",
- "created_by": "string",
- "quantity": 0,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "line_item": {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}, - "inventory_item": {
- "sku": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "title": null,
- "description": null,
- "thumbnail": null,
- "material": null,
- "weight": null,
- "height": null,
- "width": null,
- "length": null,
- "requires_shipping": null,
- "metadata": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Request a Return
Request and create a Return for items in an order. If the return shipping method is specified, it will be automatically fulfilled.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
required | Array of objects The line items that will be returned. |
object The Shipping Method to be used to handle the return shipment. | |
note | string An optional note with information about the Return. |
receive_now | boolean Default: false A flag to indicate if the Return should be registerd as received immediately. |
no_notification | boolean If set to |
refund | integer The amount to refund. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "items": [
- {
- "item_id": "string",
- "reason_id": "string",
- "note": "string",
- "quantity": 0
}
], - "return_shipping": {
- "option_id": "string",
- "price": 0
}, - "note": "string",
- "receive_now": false,
- "no_notification": true,
- "refund": 0
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Ship a Fulfillment
Mark a fulfillment as shipped. This changes the order's fulfillment status to either shipped
or partially_shipped
, depending on whether all the items were shipped.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
fulfillment_id required | string The ID of the Fulfillment. |
tracking_numbers | Array of strings The tracking numbers for the shipment. |
no_notification | boolean If set to true no notification will be send related to this Shipment. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "fulfillment_id": "string",
- "tracking_numbers": [
- "string"
], - "no_notification": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Add a Shipping Method
Adds a Shipping Method to an Order. If another Shipping Method exists with the same Shipping Profile, the previous Shipping Method will be replaced.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
price required | number The price (excluding VAT) that should be charged for the Shipping Method |
option_id required | string The ID of the Shipping Option to create the Shipping Method from. |
date | object The data required for the Shipping Option to create a Shipping Method. This depends on the Fulfillment Provider. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "price": 0,
- "option_id": "string",
- "date": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Create a Swap
Create a Swap. This includes creating a return that is associated with the swap.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
required | Array of objects The Line Items to associate with the swap's return. |
object The shipping method associated with the swap's return. | |
Array of objects The new items to send to the Customer. | |
Array of objects An array of custom shipping options to potentially create a Shipping Method from to send the additional items. | |
no_notification | boolean If set to |
allow_backorder | boolean Default: true If set to |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "return_items": [
- {
- "item_id": "string",
- "quantity": 0,
- "reason_id": "string",
- "note": "string"
}
], - "return_shipping": {
- "option_id": "string",
- "price": 0
}, - "additional_items": [
- {
- "variant_id": "string",
- "quantity": 0
}
], - "custom_shipping_options": [
- {
- "option_id": "string",
- "price": 0
}
], - "no_notification": true,
- "allow_backorder": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Cancel a Swap
Cancel a Swap and change its status.
Authorizations:
path Parameters
id required | string The ID of the Order the swap is associated with. |
swap_id required | string The ID of the Swap. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancelSwap(orderId, swapId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Create a Swap Fulfillment
Create a Fulfillment for a Swap.
Authorizations:
path Parameters
id required | string The ID of the Order the swap is associated with. |
swap_id required | string The ID of the Swap. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
metadata | object An optional set of key-value pairs to hold additional information. |
no_notification | boolean If set to |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "metadata": { },
- "no_notification": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Cancel Swap's Fulfilmment
Cancel a swap's fulfillment and change its status.
Authorizations:
path Parameters
id required | string The ID of the order the swap is associated with. |
swap_id required | string The ID of the swap. |
fulfillment_id required | string The ID of the fulfillment. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.cancelSwapFulfillment(orderId, swapId, fulfillmentId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Process a Swap Payment
Process a swap's payment either by refunding or issuing a payment. This depends on the difference_due
of the swap. If difference_due
is negative, the amount is refunded. If difference_due
is positive, the amount is captured.
Authorizations:
path Parameters
id required | string The ID of the order the swap is associated with. |
swap_id required | string The ID of the swap. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.orders.processSwapPayment(orderId, swapId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Ship a Swap's Fulfillment
RMark a swap's fulfillment as shipped. This changes the swap's fulfillment status to either shipped
or partially_shipped
, depending on whether all the items were shipped.
Authorizations:
path Parameters
id required | string The ID of the Order. |
swap_id required | string The ID of the Swap. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned order. |
fields | string Comma-separated fields that should be included in the returned order. |
Request Body schema: application/json
fulfillment_id required | string The ID of the Fulfillment. |
tracking_numbers | Array of strings The tracking numbers for the shipment. |
no_notification | boolean If set to true no notification will be sent related to this Claim. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "fulfillment_id": "string",
- "tracking_numbers": [
- "string"
], - "no_notification": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
A payment collection is useful for managing additional payments, such as for Order Edits, or installment payments.
Get a Payment Collection
Retrieve a Payment Collection's details.
Authorizations:
path Parameters
id required | string The ID of the Payment Collection. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned payment collection. |
fields | string Comma-separated fields that should be included in the returned payment collection. |
Responses
Response Schema: application/json
required | object (Payment Collection) A payment collection allows grouping and managing a list of payments at one. This can be helpful when making additional payment for order edits or integrating installment payments. | ||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.paymentCollections.retrieve(paymentCollectionId) .then(({ payment_collection }) => { console.log(payment_collection.id) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": null,
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "amount": null,
- "payment_authorized_at": null,
- "created_at": null,
- "updated_at": null
}
], - "payments": [
- {
- "id": null,
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "currency_code": null,
- "currency": null,
- "amount_refunded": null,
- "provider_id": null,
- "data": { },
- "captured_at": null,
- "canceled_at": null,
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update Payment Collection
Update a Payment Collection's details.
Authorizations:
path Parameters
id required | string The ID of the Payment Collection. |
Request Body schema: application/json
description | string A description to create or update the payment collection. |
metadata | object A set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Payment Collection) A payment collection allows grouping and managing a list of payments at one. This can be helpful when making additional payment for order edits or integrating installment payments. | ||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "description": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": null,
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "amount": null,
- "payment_authorized_at": null,
- "created_at": null,
- "updated_at": null
}
], - "payments": [
- {
- "id": null,
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "currency_code": null,
- "currency": null,
- "amount_refunded": null,
- "provider_id": null,
- "data": { },
- "captured_at": null,
- "canceled_at": null,
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Payment Collection
Delete a Payment Collection. Only payment collections with the statuses canceled
or not_paid
can be deleted.
Authorizations:
path Parameters
id required | string The ID of the Payment Collection. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Payment Collection. |
object required | string Default: "payment_collection" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the Payment Collection was deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.paymentCollections.delete(paymentCollectionId) .then(({ id, object, deleted }) => { console.log(id) })
Response samples
- 200
- 400
{- "id": "string",
- "object": "payment_collection",
- "deleted": true
}
Mark Authorized
Set the status of a Payment Collection as authorized
. This will also change the authorized_amount
of the payment collection.
Authorizations:
path Parameters
id required | string The ID of the Payment Collection. |
Responses
Response Schema: application/json
required | object (Payment Collection) A payment collection allows grouping and managing a list of payments at one. This can be helpful when making additional payment for order edits or integrating installment payments. | ||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.paymentCollections.markAsAuthorized(paymentCollectionId) .then(({ payment_collection }) => { console.log(payment_collection.id) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment_collection": {
- "id": "paycol_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "type": "order_edit",
- "status": "not_paid",
- "description": "string",
- "amount": 0,
- "authorized_amount": 0,
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "payment_sessions": [
- {
- "id": null,
- "cart_id": null,
- "cart": null,
- "provider_id": null,
- "is_selected": null,
- "is_initiated": null,
- "status": null,
- "data": { },
- "idempotency_key": null,
- "amount": null,
- "payment_authorized_at": null,
- "created_at": null,
- "updated_at": null
}
], - "payments": [
- {
- "id": null,
- "swap_id": null,
- "swap": { },
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "currency_code": null,
- "currency": null,
- "amount_refunded": null,
- "provider_id": null,
- "data": { },
- "captured_at": null,
- "canceled_at": null,
- "idempotency_key": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_by": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get Payment details
Retrieve a Payment's details.
Authorizations:
path Parameters
id required | string The ID of the Payment. |
Responses
Response Schema: application/json
required | object (Payment) A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.payments.retrieve(paymentId) .then(({ payment }) => { console.log(payment.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Capture a Payment
Capture a Payment.
Authorizations:
path Parameters
id required | string The ID of the Payment. |
Responses
Response Schema: application/json
required | object (Payment) A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.payments.capturePayment(paymentId) .then(({ payment }) => { console.log(payment.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment": {
- "id": "pay_01G2SJNT6DEEWDFNAJ4XWDTHKE",
- "swap_id": null,
- "swap": { },
- "cart_id": "string",
- "cart": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "amount": 100,
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "amount_refunded": 0,
- "provider_id": "manual",
- "data": { },
- "captured_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Refund Payment
Refund a payment. The payment must be captured first.
Authorizations:
path Parameters
id required | string The ID of the Payment. |
Request Body schema: application/json
amount required | integer The amount to refund. |
reason required | string The reason for the Refund. |
note | string A note with additional details about the Refund. |
Responses
Response Schema: application/json
required | object (Refund) A refund represents an amount of money transfered back to the customer for a given reason. Refunds may occur in relation to Returns, Swaps and Claims, but can also be initiated by an admin for an order. | ||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "amount": 0,
- "reason": "string",
- "note": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "refund": {
- "id": "ref_01G1G5V27GYX4QXNARRQCW1N8T",
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "payment_id": "pay_01G8ZCC5W42ZNY842124G7P5R9",
- "payment": { },
- "amount": 1000,
- "note": "I didn't like it",
- "reason": "return",
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
A price list are special prices applied to products based on a set of conditions, such as customer group.
List Price Lists
Retrieve a list of price lists. The price lists can be filtered by fields such as q
or status
. The price lists can also be sorted or paginated.
Authorizations:
query Parameters
limit | number Default: "10" Limit the number of price lists returned. |
offset | number Default: "0" The number of price lists to skip when retrieving the price lists. |
expand | string Comma-separated relations that should be expanded in the returned price lists. |
fields | string Comma-separated fields that should be included in the returned price lists. |
order | string A price-list field to sort-order the retrieved price lists by. |
id | string Filter by ID |
q | string term to search price lists' description, name, and customer group's name. |
status | Array of strings Items Enum: "active" "draft" Filter by status. |
name | string Filter by name |
customer_groups | Array of strings Filter by customer-group IDs. |
type | Array of strings Items Enum: "sale" "override" Filter by type. |
object Filter by a creation date range. | |
object Filter by an update date range. | |
object Filter by a deletion date range. |
Responses
Response Schema: application/json
required | Array of objects (Price List) An array of price lists details. |
count required | integer The total number of items available |
offset required | integer The number of price lists skipped when retrieving the price lists. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.list() .then(({ price_lists, limit, offset, count }) => { console.log(price_lists.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "price_lists": [
- {
- "id": "pl_01G8X3CKJXCG5VXVZ87H9KC09W",
- "name": "VIP Prices",
- "description": "Prices for VIP customers",
- "type": "sale",
- "status": "active",
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "customer_groups": [
- null
], - "prices": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Price List
Create a Price List.
Authorizations:
Request Body schema: application/json
name required | string The name of the Price List. |
description required | string The description of the Price List. |
type required | string Enum: "sale" "override" The type of the Price List. |
required | Array of objects The prices of the Price List. |
starts_at | string <date> The date with timezone that the Price List starts being valid. |
ends_at | string <date> The date with timezone that the Price List ends being valid. |
status | string Enum: "active" "draft" The status of the Price List. If the status is set to |
Array of objects An array of customer groups that the Price List applies to. | |
includes_tax | boolean Tax included in prices of price list |
Responses
Response Schema: application/json
required | object (Price List) A Price List represents a set of prices that override the default price for one or more product variants. | ||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "description": "string",
- "starts_at": "2019-08-24",
- "ends_at": "2019-08-24",
- "type": "sale",
- "status": "active",
- "prices": [
- {
- "region_id": "string",
- "currency_code": "string",
- "amount": 0,
- "variant_id": "string",
- "min_quantity": 0,
- "max_quantity": 0
}
], - "customer_groups": [
- {
- "id": "string"
}
], - "includes_tax": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "price_list": {
- "id": "pl_01G8X3CKJXCG5VXVZ87H9KC09W",
- "name": "VIP Prices",
- "description": "Prices for VIP customers",
- "type": "sale",
- "status": "active",
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "customer_groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "prices": [
- {
- "id": null,
- "currency_code": null,
- "currency": null,
- "amount": null,
- "min_quantity": null,
- "max_quantity": null,
- "price_list_id": null,
- "price_list": { },
- "variant_id": null,
- "variant": { },
- "region_id": null,
- "region": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Get a Price List
Retrieve a Price List's details.
Authorizations:
path Parameters
id required | string The ID of the Price List. |
Responses
Response Schema: application/json
required | object (Price List) A Price List represents a set of prices that override the default price for one or more product variants. | ||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.retrieve(priceListId) .then(({ price_list }) => { console.log(price_list.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "price_list": {
- "id": "pl_01G8X3CKJXCG5VXVZ87H9KC09W",
- "name": "VIP Prices",
- "description": "Prices for VIP customers",
- "type": "sale",
- "status": "active",
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "customer_groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "prices": [
- {
- "id": null,
- "currency_code": null,
- "currency": null,
- "amount": null,
- "min_quantity": null,
- "max_quantity": null,
- "price_list_id": null,
- "price_list": { },
- "variant_id": null,
- "variant": { },
- "region_id": null,
- "region": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Update a Price List
Update a Price List's details.
Authorizations:
path Parameters
id required | string The ID of the Price List. |
Request Body schema: application/json
name | string The name of the Price List |
description | string The description of the Price List. |
starts_at | string <date> The date with timezone that the Price List starts being valid. |
ends_at | string <date> The date with timezone that the Price List ends being valid. |
type | string Enum: "sale" "override" The type of the Price List. |
status | string Enum: "active" "draft" The status of the Price List. If the status is set to |
Array of objects The prices of the Price List. | |
Array of objects An array of customer groups that the Price List applies to. | |
includes_tax | boolean Tax included in prices of price list |
Responses
Response Schema: application/json
required | object (Price List) A Price List represents a set of prices that override the default price for one or more product variants. | ||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "description": "string",
- "starts_at": "2019-08-24",
- "ends_at": "2019-08-24",
- "type": "sale",
- "status": "active",
- "prices": [
- {
- "id": "string",
- "region_id": "string",
- "currency_code": "string",
- "variant_id": "string",
- "amount": 0,
- "min_quantity": 0,
- "max_quantity": 0
}
], - "customer_groups": [
- {
- "id": "string"
}
], - "includes_tax": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "price_list": {
- "id": "pl_01G8X3CKJXCG5VXVZ87H9KC09W",
- "name": "VIP Prices",
- "description": "Prices for VIP customers",
- "type": "sale",
- "status": "active",
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "customer_groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "prices": [
- {
- "id": null,
- "currency_code": null,
- "currency": null,
- "amount": null,
- "min_quantity": null,
- "max_quantity": null,
- "price_list_id": null,
- "price_list": { },
- "variant_id": null,
- "variant": { },
- "region_id": null,
- "region": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Delete a Price List
Delete a Price List and its associated prices.
Authorizations:
path Parameters
id required | string The ID of the Price List. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Price List. |
object required | string Default: "price-list" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.delete(priceListId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "price-list",
- "deleted": true
}
Add or Update Prices
Add or update a list of prices in a Price List
Authorizations:
path Parameters
id required | string The ID of the Price List. |
Request Body schema: application/json
Array of objects The prices to update or add. | |
override | boolean If set to |
Responses
Response Schema: application/json
required | object (Price List) A Price List represents a set of prices that override the default price for one or more product variants. | ||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "prices": [
- {
- "id": "string",
- "region_id": "string",
- "currency_code": "string",
- "variant_id": "string",
- "amount": 0,
- "min_quantity": 0,
- "max_quantity": 0
}
], - "override": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "price_list": {
- "id": "pl_01G8X3CKJXCG5VXVZ87H9KC09W",
- "name": "VIP Prices",
- "description": "Prices for VIP customers",
- "type": "sale",
- "status": "active",
- "starts_at": "2019-08-24T14:15:22Z",
- "ends_at": "2019-08-24T14:15:22Z",
- "customer_groups": [
- {
- "id": null,
- "name": null,
- "customers": [ ],
- "price_lists": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "prices": [
- {
- "id": null,
- "currency_code": null,
- "currency": null,
- "amount": null,
- "min_quantity": null,
- "max_quantity": null,
- "price_list_id": null,
- "price_list": { },
- "variant_id": null,
- "variant": { },
- "region_id": null,
- "region": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Delete Prices
Delete a list of prices in a Price List
Authorizations:
path Parameters
id required | string The ID of the Price List |
Request Body schema: application/json
price_ids | Array of strings The price IDs of the Money Amounts to delete. |
Responses
Response Schema: application/json
ids required | Array of strings |
object required | string Default: "money-amount" The type of the object that was deleted. A price is also named |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- Payload
- JS Client
- cURL
{- "price_ids": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "ids": [
- "string"
], - "object": "money-amount",
- "deleted": true
}
List Products
Retrieve a price list's products. The products can be filtered by fields such as q
or status
. The products can also be sorted or paginated.
Authorizations:
path Parameters
id required | string ID of the price list. |
query Parameters
q | string term used to search products' title, description, product variant's title and sku, and product collection's title. |
id | string Filter by product ID |
status | Array of strings Items Enum: "draft" "proposed" "published" "rejected" Filter by product status |
collection_id | Array of strings Filter by product collection ID. Only products in the specified collections are retrieved. |
tags | Array of strings Filter by tag IDs. Only products having the specified tags are retrieved. |
title | string Filter by title |
description | string Filter by description |
handle | string Filter by handle |
is_giftcard | string A boolean value to filter by whether the product is a gift card or not. |
type | string Filter product type. |
order | string A product field to sort-order the retrieved products by. |
object Filter by a creation date range. | |
object Filter by an update date range. | |
object Filter by a deletion date range. | |
offset | integer Default: 0 The number of products to skip when retrieving the products. |
limit | integer Default: 50 Limit the number of products returned. |
expand | string Comma-separated relations that should be expanded in the returned products. |
fields | string Comma-separated fields that should be included in the returned products. |
Responses
Response Schema: application/json
required | Array of objects (Product) An array of products details. |
count required | integer The total number of items available |
offset required | integer The number of price lists skipped when retrieving the price lists. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.listProducts(priceListId) .then(({ products, limit, offset, count }) => { console.log(products.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "products": [
- {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- null
], - "options": [
- null
], - "variants": [
- null
], - "categories": [
- null
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "profiles": [
- null
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": null,
- "title": null,
- "handle": null,
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "tags": [
- null
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Delete a Product's Prices
Delete all the prices related to a specific product in a price list.
Authorizations:
path Parameters
id required | string The ID of the Price List. |
product_id required | string The ID of the product from which the prices will be deleted. |
Responses
Response Schema: application/json
ids required | Array of strings The IDs of the deleted prices. |
object required | string Default: "money-amount" The type of the object that was deleted. A price is also named |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.deleteProductPrices(priceListId, productId) .then(({ ids, object, deleted }) => { console.log(ids.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "ids": [
- "string"
], - "object": "money-amount",
- "deleted": true
}
Delete a Variant's Prices
Delete all the prices related to a specific variant in a price list
Authorizations:
path Parameters
id required | string The ID of the Price List. |
variant_id required | string The ID of the variant. |
Responses
Response Schema: application/json
ids required | Array of strings The IDs of the deleted prices. |
object required | string Default: "money-amount" The type of the object that was deleted. A price is also named |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.priceLists.deleteVariantPrices(priceListId, variantId) .then(({ ids, object, deleted }) => { console.log(ids); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "ids": [
- "string"
], - "object": "money-amount",
- "deleted": true
}
Products can be categoriezed into categories. A product can be added into more than one category.
List Product Categories
Retrieve a list of product categories. The product categories can be filtered by fields such as q
or handle
. The product categories can also be paginated.
Authorizations:
query Parameters
q | string term to search product categories' names and handles. |
handle | string Filter by handle. |
is_internal | boolean Filter by whether the category is internal or not. |
is_active | boolean Filter by whether the category is active or not. |
include_descendants_tree | boolean If set to |
parent_category_id | string Filter by the ID of a parent category. |
offset | integer Default: 0 The number of product categories to skip when retrieving the product categories. |
limit | integer Default: 100 Limit the number of product categories returned. |
expand | string Comma-separated relations that should be expanded in the returned product categories. |
fields | string Comma-separated fields that should be included in the returned product categories. |
Responses
Response Schema: application/json
required | Array of objects (Product Category) An array of product category details. |
count required | integer The total number of items available |
offset required | integer The number of product categories skipped when retrieving the product categories. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.productCategories.list() .then(({ product_categories, limit, offset, count }) => { console.log(product_categories.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_categories": [
- {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Product Category
Create a Product Category.
Authorizations:
query Parameters
expand | string Comma-separated relations that should be expanded in the returned product category. |
fields | string Comma-separated fields that should be included in the returned product category. |
Request Body schema: application/json
name required | string The name of the product category |
description | string The description of the product category. |
handle | string The handle of the product category. If none is provided, the kebab-case version of the name will be used. This field can be used as a slug in URLs. |
is_internal | boolean If set to |
is_active | boolean If set to |
parent_category_id | string The ID of the parent product category |
Responses
Response Schema: application/json
required | object (Product Category) A product category can be used to categorize products into a hierarchy of categories. | ||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "description": "string",
- "handle": "string",
- "is_internal": true,
- "is_active": true,
- "parent_category_id": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_category": {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Get a Product Category
Retrieve a Product Category's details.
Authorizations:
path Parameters
id required | string The ID of the Product Category |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned product category. |
fields | string Comma-separated fields that should be included in the returned product category. |
Responses
Response Schema: application/json
required | object (Product Category) A product category can be used to categorize products into a hierarchy of categories. | ||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.productCategories.retrieve(productCategoryId) .then(({ product_category }) => { console.log(product_category.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_category": {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Update a Product Category
Updates a Product Category.
Authorizations:
path Parameters
id required | string The ID of the Product Category. |
query Parameters
expand | string (Comma separated) Which fields should be expanded in each product category. |
fields | string (Comma separated) Which fields should be retrieved in each product category. |
Request Body schema: application/json
name | string The name to identify the Product Category by. |
description | string An optional text field to describe the Product Category by. |
handle | string A handle to be used in slugs. |
is_internal | boolean A flag to make product category an internal category for admins |
is_active | boolean A flag to make product category visible/hidden in the store front |
parent_category_id | string The ID of the parent product category |
rank | number The rank of the category in the tree node (starting from 0) |
Responses
Response Schema: application/json
required | object (Product Category) A product category can be used to categorize products into a hierarchy of categories. | ||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "description": "string",
- "handle": "string",
- "is_internal": true,
- "is_active": true,
- "parent_category_id": "string",
- "rank": 0
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_category": {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Delete a Product Category
Delete a Product Category. This does not delete associated products.
Authorizations:
path Parameters
id required | string The ID of the Product Category |
Responses
Response Schema: application/json
id required | string The ID of the deleted product category |
object required | string Default: "product-category" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.productCategories.delete(productCategoryId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "product-category",
- "deleted": true
}
Add Products to a Category
Add a list of products to a product category.
Authorizations:
path Parameters
id required | string The ID of the Product Category. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned product category. |
fields | string Comma-separated fields that should be included in the returned product category. |
Request Body schema: application/json
required | Array of objects The IDs of the products to add to the Product Category | ||
Array
|
Responses
Response Schema: application/json
required | object (Product Category) A product category can be used to categorize products into a hierarchy of categories. | ||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "product_ids": [
- {
- "id": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_category": {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Remove Products from Category
Remove a list of products from a product category.
Authorizations:
path Parameters
id required | string The ID of the Product Category. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned product category. |
fields | string Comma-separated fields that should be included in the returned product category. |
Request Body schema: application/json
required | Array of objects The IDs of the products to delete from the Product Category. | ||
Array
|
Responses
Response Schema: application/json
required | object (Product Category) A product category can be used to categorize products into a hierarchy of categories. | ||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "product_ids": [
- {
- "id": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_category": {
- "id": "pcat_01G2SG30J8C85S4A5CHM2S1NS2",
- "name": "Regular Fit",
- "handle": "regular-fit",
- "mpath": "pcat_id1.pcat_id2.pcat_id3",
- "is_internal": false,
- "is_active": false,
- "rank": 0,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
A product collection is used to organize products for different purposes such as marketing or discount purposes. For example, you can create a Summer Collection.
List Collections
Retrieve a list of Product Collection. The product collections can be filtered by fields such as handle
or title
. The collections can also be sorted or paginated.
Authorizations:
query Parameters
limit | integer Default: 10 The number of collections to return. |
offset | integer Default: 0 The number of collections to skip when retrieving the collections. |
title | string Filter collections by their title. |
handle | string Filter collections by their handle. |
q | string a term to search collections by their title or handle. |
discount_condition_id | string Filter collections by a discount condition ID associated with them. |
object Filter by a creation date range. | |
object Filter by an update date range. | |
object Filter by a deletion date range. |
Responses
Response Schema: application/json
required | Array of objects (Product Collection) an array of collection details |
count required | integer The total number of items available |
offset required | integer The number of product collections skipped when retrieving the product collections. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.collections.list() .then(({ collections, limit, offset, count }) => { console.log(collections.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "collections": [
- {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Collection
Create a Product Collection.
Authorizations:
Request Body schema: application/json
title required | string The title of the collection. |
handle | string An optional handle to be used in slugs. If none is provided, the kebab-case version of the title will be used. |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Product Collection) A Product Collection allows grouping together products for promotional purposes. For example, an admin can create a Summer collection, add products to it, and showcase it on the storefront. | ||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "title": "string",
- "handle": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Collection
Retrieve a Product Collection by its ID. The products associated with it are expanded and returned as well.
Authorizations:
path Parameters
id required | string The ID of the Product Collection |
Responses
Response Schema: application/json
required | object (Product Collection) A Product Collection allows grouping together products for promotional purposes. For example, an admin can create a Summer collection, add products to it, and showcase it on the storefront. | ||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.collections.retrieve(collectionId) .then(({ collection }) => { console.log(collection.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Collection
Update a Product Collection's details.
Authorizations:
path Parameters
id required | string The ID of the Collection. |
Request Body schema: application/json
title | string The title of the collection. |
handle | string An optional handle to be used in slugs. If none is provided, the kebab-case version of the title will be used. |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
required | object (Product Collection) A Product Collection allows grouping together products for promotional purposes. For example, an admin can create a Summer collection, add products to it, and showcase it on the storefront. | ||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "title": "string",
- "handle": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Collection
Delete a Product Collection. This does not delete associated products.
Authorizations:
path Parameters
id required | string The ID of the Collection. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Collection |
object required | string Default: "product-collection" The type of the object that was deleted. |
deleted required | boolean Default: true Whether the collection was deleted successfully or not. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.collections.delete(collectionId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "product-collection",
- "deleted": true
}
Add Products to Collection
Add products to a product collection.
Authorizations:
path Parameters
id required | string The ID of the product collection. |
Request Body schema: application/json
product_ids required | Array of strings An array of Product IDs to add to the Product Collection. |
Responses
Response Schema: application/json
required | object (Product Collection) A Product Collection allows grouping together products for promotional purposes. For example, an admin can create a Summer collection, add products to it, and showcase it on the storefront. | ||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "product_ids": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Products from Collection
Remove a list of products from a collection. This would not delete the product, only the association between the product and the collection.
Authorizations:
path Parameters
id required | string The ID of the Product Collection. |
Request Body schema: application/json
product_ids required | Array of strings An array of Product IDs to remove from the Product Collection. |
Responses
Response Schema: application/json
id required | string The ID of the collection |
object required | string Default: "product-collection" The type of object the removal was executed on |
removed_products required | Array of strings The IDs of the products removed from the collection |
Request samples
- Payload
- JS Client
- cURL
{- "product_ids": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "product-collection",
- "removed_products": [
- "string"
]
}
Product tags are string values created when you create or update a product with a new tag. Products can have more than one tag, and products can share tags. This allows admins to associate products to similar tags that can be used to filter products.
List Product Tags
Retrieve a list of product tags. The product tags can be filtered by fields such as q
or value
. The product tags can also be sorted or paginated.
Authorizations:
query Parameters
limit | integer Default: 10 Limit the number of product tags returned. |
offset | integer Default: 0 The number of product tags to skip when retrieving the product tags. |
order | string A product tag field to sort-order the retrieved product tags by. |
discount_condition_id | string Filter by the ID of a discount condition. Only product tags that this discount condition is applied to will be retrieved. |
value | Array of strings Filter by tag value. |
q | string term to search product tags' values. |
id | Array of strings Filter by tag IDs. |
object Filter by a creation date range. | |
object Filter by an update date range. |
Responses
Response Schema: application/json
required | Array of objects (Product Tag) An array of product tag details. |
count required | integer The total number of items available |
offset required | integer The number of product tags skipped when retrieving the product tags. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.productTags.list() .then(({ product_tags }) => { console.log(product_tags.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_tags": [
- {
- "id": "ptag_01G8K2MTMG9168F2B70S1TAVK3",
- "value": "Pants",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Product types are string values created when you create or update a product with a new type. Products can have one type, and products can share types. This allows admins to associate products with a type that can be used to filter products.
List Product Types
Retrieve a list of product types. The product types can be filtered by fields such as q
or value
. The product types can also be sorted or paginated.
Authorizations:
query Parameters
limit | integer Default: 20 Limit the number of product types returned. |
offset | integer Default: 0 The number of product types to skip when retrieving the product types. |
order | string A product type field to sort-order the retrieved product types by. |
discount_condition_id | string Filter by the ID of a discount condition. Only product types that this discount condition is applied to will be retrieved. |
value | Array of strings Filter by value. |
id | Array of strings Filter by product type IDs. |
q | string term to search product types' values. |
object Filter by a creation date range. | |
object Filter by an update date range. |
Responses
Response Schema: application/json
required | Array of objects (Product Type) An array of product types details. |
count required | integer The total number of items available |
offset required | integer The number of product types skipped when retrieving the product types. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.productTypes.list() .then(({ product_types }) => { console.log(product_types.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product_types": [
- {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Product variants are the actual salable item in your store. Each variant is a combination of the different option values available on the product. Product variants can be managed through the Products endpoints.
List Product Variants
Retrieve a list of Product Variants. The product variant can be filtered by fields such as id
or title
. The product variant can also be paginated.
Authorizations:
query Parameters
string or Array of strings Filter by product variant IDs. | |
expand | string "Comma-separated relations that should be expanded in the returned product variants." |
fields | string "Comma-separated fields that should be included in the returned product variants." |
offset | number Default: "0" The number of product variants to skip when retrieving the product variants. |
limit | number Default: "100" Limit the number of product variants returned. |
cart_id | string The ID of the cart to use for the price selection context. |
region_id | string The ID of the region to use for the price selection context. |
currency_code | string The 3 character ISO currency code to use for the price selection context. |
customer_id | string The ID of the customer to use for the price selection context. |
string or Array of strings Filter by title. | |
number or object Filter by available inventory quantity |
Responses
Response Schema: application/json
required | Array of objects (Priced Product Variant) An array of product variant details. |
count required | integer The total number of items available |
offset required | integer The number of product variants skipped when retrieving the product variants. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.variants.list() .then(({ variants, limit, offset, count }) => { console.log(variants.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "variants": [
- {
- "id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6",
- "title": "Small",
- "product_id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "product": { },
- "prices": [
- null
], - "sku": "shirt-123",
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": 0,
- "inventory_quantity": 100,
- "allow_backorder": false,
- "manage_inventory": true,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [
- null
], - "inventory_items": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "purchasable": true,
- "original_price": 0,
- "calculated_price": 0,
- "original_price_incl_tax": 0,
- "calculated_price_incl_tax": 0,
- "original_tax": 0,
- "calculated_tax": 0,
- "tax_rates": [
- { }
]
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Get a Product variant
Retrieve a product variant's details.
Authorizations:
path Parameters
id required | string The ID of the product variant. |
query Parameters
expand | string "Comma-separated relations that should be expanded in the returned product variant." |
fields | string "Comma-separated fields that should be included in the returned product variant." |
Responses
Response Schema: application/json
required | object (Priced Product Variant) A Product Variant represents a Product with a specific set of Product Option configurations. The maximum number of Product Variants that a Product can have is given by the number of available Product Option combinations. A product must at least have one product variant. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.variants.retrieve(variantId) .then(({ variant }) => { console.log(variant.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "variant": {
- "id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6",
- "title": "Small",
- "product_id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "product": { },
- "prices": [
- {
- "id": null,
- "currency_code": null,
- "currency": null,
- "amount": null,
- "min_quantity": null,
- "max_quantity": null,
- "price_list_id": null,
- "price_list": { },
- "variant_id": null,
- "variant": { },
- "region_id": null,
- "region": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "sku": "shirt-123",
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": 0,
- "inventory_quantity": 100,
- "allow_backorder": false,
- "manage_inventory": true,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [
- {
- "id": null,
- "value": null,
- "option_id": null,
- "option": { },
- "variant_id": null,
- "variant": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "inventory_items": [
- {
- "id": null,
- "inventory_item_id": null,
- "variant_id": null,
- "variant": { },
- "required_quantity": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "purchasable": true,
- "original_price": 0,
- "calculated_price": 0,
- "original_price_incl_tax": 0,
- "calculated_price_incl_tax": 0,
- "original_tax": 0,
- "calculated_tax": 0,
- "tax_rates": [
- {
- "rate": null,
- "name": null,
- "code": null
}
]
}
}
Get Variant's Inventory
Retrieve the available inventory of a Product Variant.
Authorizations:
path Parameters
id required | string The Product Variant ID. |
Responses
Response Schema: application/json
object (AdminGetVariantsVariantInventoryRes) | |||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.variants.list() .then(({ variants, limit, offset, count }) => { console.log(variants.length) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "variant": {
- "variant": {
- "id": "string",
- "inventory": {
- "sku": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "title": null,
- "description": null,
- "thumbnail": null,
- "material": null,
- "weight": null,
- "height": null,
- "width": null,
- "length": null,
- "requires_shipping": null,
- "metadata": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "location_levels": [ ]
}, - "sales_channel_availability": [
- { }
]
}
}
}
Products are saleable items in a store. This also includes saleable gift cards in a store.
List Products
Retrieve a list of products. The products can be filtered by fields such as q
or status
. The products can also be sorted or paginated.
Authorizations:
query Parameters
q | string term to search products' title, description, variants' title and sku, and collections' title. |
discount_condition_id | string Filter by the ID of a discount condition. Only products that this discount condition is applied to will be retrieved. |
string or Array of strings Filter by product IDs. | |
status | Array of strings Items Enum: "draft" "proposed" "published" "rejected" Filter by status. |
collection_id | Array of strings Filter by product collection IDs. Only products that are associated with the specified collections will be retrieved. |
tags | Array of strings Filter by product tag IDs. Only products that are associated with the specified tags will be retrieved. |
price_list_id | Array of strings Filter by IDs of price lists. Only products that these price lists are applied to will be retrieved. |
sales_channel_id | Array of strings Filter by sales channel IDs. Only products that are available in the specified sales channels will be retrieved. |
type_id | Array of strings Filter by product type IDs. Only products that are associated with the specified types will be retrieved. |
category_id | Array of strings Filter by product category IDs. Only products that are associated with the specified categories will be retrieved. |
include_category_children | boolean whether to include product category children when filtering by |
title | string Filter by title. |
description | string Filter by description. |
handle | string Filter by handle. |
is_giftcard | boolean Whether to retrieve gift cards or regular products. |
object Filter by a creation date range. | |
object Filter by an update date range. | |
object Filter by a deletion date range. | |
offset | integer Default: 0 The number of products to skip when retrieving the products. |
limit | integer Default: 50 Limit the number of products returned. |
expand | string Comma-separated relations that should be expanded in the returned products. |
fields | string Comma-separated fields that should be included in the returned products. |
order | string A product field to sort-order the retrieved products by. |
Responses
Response Schema: application/json
required | Array of objects (Priced Product) An array of products details. |
count required | integer The total number of items available |
offset required | integer The number of products skipped when retrieving the products. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.list() .then(({ products, limit, offset, count }) => { console.log(products.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "products": [
- {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- null
], - "options": [
- null
], - "variants": [
- null
], - "categories": [
- null
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "profiles": [
- null
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": null,
- "title": null,
- "handle": null,
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "tags": [
- null
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Product
Create a new Product. This endpoint can also be used to create a gift card if the is_giftcard
field is set to true
.
Authorizations:
Request Body schema: application/json
title required | string The title of the Product |
subtitle | string The subtitle of the Product |
description | string The description of the Product. |
is_giftcard | boolean Default: false A flag to indicate if the Product represents a Gift Card. Purchasing Products with this flag set to |
discountable | boolean Default: true A flag to indicate if discounts can be applied to the Line Items generated from this Product |
images | Array of strings An array of images of the Product. Each value in the array is a URL to the image. You can use the upload endpoints to upload the image and obtain a URL. |
thumbnail | string The thumbnail to use for the Product. The value is a URL to the thumbnail. You can use the upload endpoints to upload the thumbnail and obtain a URL. |
handle | string A unique handle to identify the Product by. If not provided, the kebab-case version of the product title will be used. This can be used as a slug in URLs. |
status | string Default: "draft" Enum: "draft" "proposed" "published" "rejected" The status of the product. The product is shown to the customer only if its status is |
object The Product Type to associate the Product with. | |
collection_id | string The ID of the Product Collection the Product belongs to. |
Array of objects Product Tags to associate the Product with. | |
Array of objects Sales channels to associate the Product with. | |
Array of objects Product categories to add the Product to. | |
Array of objects The Options that the Product should have. A new product option will be created for every item in the array. | |
Array of objects An array of Product Variants to create with the Product. Each product variant must have a unique combination of Product Option values. | |
weight | number The weight of the Product. |
length | number The length of the Product. |
height | number The height of the Product. |
width | number The width of the Product. |
hs_code | string The Harmonized System code of the Product. |
origin_country | string The country of origin of the Product. |
mid_code | string The Manufacturer Identification code of the Product. |
material | string The material composition of the Product. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
required | object (Priced Product) A product is a saleable item that holds general information such as name or description. It must include at least one Product Variant, where each product variant defines different options to purchase the product with (for example, different sizes or colors). The prices and inventory of the product are defined on the variant level. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "title": "string",
- "subtitle": "string",
- "description": "string",
- "is_giftcard": false,
- "discountable": true,
- "images": [
- "string"
], - "thumbnail": "string",
- "handle": "string",
- "status": "draft",
- "type": {
- "id": "string",
- "value": "string"
}, - "collection_id": "string",
- "tags": [
- {
- "id": "string",
- "value": "string"
}
], - "sales_channels": [
- {
- "id": "string"
}
], - "categories": [
- {
- "id": "string"
}
], - "options": [
- {
- "title": "string"
}
], - "variants": [
- {
- "title": "string",
- "sku": "string",
- "ean": "string",
- "upc": "string",
- "barcode": "string",
- "hs_code": "string",
- "inventory_quantity": 0,
- "allow_backorder": true,
- "manage_inventory": true,
- "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { },
- "prices": [
- { }
], - "options": [
- { }
]
}
], - "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "hs_code": "string",
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "profiles": [
- {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
List Tags Usage Number
Retrieve a list of Product Tags with how many times each is used in products.
Authorizations:
Responses
Response Schema: application/json
required | Array of objects An array of product tags details. | ||||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.listTags() .then(({ tags }) => { console.log(tags.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tags": [
- {
- "id": "string",
- "usage_count": "string",
- "value": "string"
}
]
}
List Product Types Deprecated
Retrieve a list of Product Types.
Authorizations:
Responses
Response Schema: application/json
required | Array of objects (Product Type) An array of product types details. | ||||||||||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.listTypes() .then(({ types }) => { console.log(types.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "types": [
- {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}
Get a Product
Retrieve a Product's details.
Authorizations:
path Parameters
id required | string The ID of the Product. |
Responses
Response Schema: application/json
required | object (Priced Product) A product is a saleable item that holds general information such as name or description. It must include at least one Product Variant, where each product variant defines different options to purchase the product with (for example, different sizes or colors). The prices and inventory of the product are defined on the variant level. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.retrieve(productId) .then(({ product }) => { console.log(product.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "profiles": [
- {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Product
Update a Product's details.
Authorizations:
path Parameters
id required | string The ID of the Product. |
Request Body schema: application/json
title | string The title of the Product |
subtitle | string The subtitle of the Product |
description | string The description of the Product. |
discountable | boolean A flag to indicate if discounts can be applied to the Line Items generated from this Product |
images | Array of strings An array of images of the Product. Each value in the array is a URL to the image. You can use the upload endpoints to upload the image and obtain a URL. |
thumbnail | string The thumbnail to use for the Product. The value is a URL to the thumbnail. You can use the upload endpoints to upload the thumbnail and obtain a URL. |
handle | string A unique handle to identify the Product by. If not provided, the kebab-case version of the product title will be used. This can be used as a slug in URLs. |
status | string Enum: "draft" "proposed" "published" "rejected" The status of the product. The product is shown to the customer only if its status is |
object The Product Type to associate the Product with. | |
collection_id | string The ID of the Product Collection the Product belongs to. |
Array of objects Product Tags to associate the Product with. | |
Array of objects Sales channels to associate the Product with. | |
Array of objects Product categories to add the Product to. | |
Array of objects An array of Product Variants to create with the Product. Each product variant must have a unique combination of Product Option values. | |
weight | number The weight of the Product. |
length | number The length of the Product. |
height | number The height of the Product. |
width | number The width of the Product. |
origin_country | string The country of origin of the Product. |
mid_code | string The Manufacturer Identification code of the Product. |
material | string The material composition of the Product. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
required | object (Priced Product) A product is a saleable item that holds general information such as name or description. It must include at least one Product Variant, where each product variant defines different options to purchase the product with (for example, different sizes or colors). The prices and inventory of the product are defined on the variant level. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "title": "string",
- "subtitle": "string",
- "description": "string",
- "discountable": true,
- "images": [
- "string"
], - "thumbnail": "string",
- "handle": "string",
- "status": "draft",
- "type": {
- "id": "string",
- "value": "string"
}, - "collection_id": "string",
- "tags": [
- {
- "id": "string",
- "value": "string"
}
], - "sales_channels": [
- {
- "id": "string"
}
], - "categories": [
- {
- "id": "string"
}
], - "variants": [
- {
- "id": "string",
- "title": "string",
- "sku": "string",
- "ean": "string",
- "upc": "string",
- "barcode": "string",
- "hs_code": "string",
- "inventory_quantity": 0,
- "allow_backorder": true,
- "manage_inventory": true,
- "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { },
- "prices": [
- { }
], - "options": [
- { }
]
}
], - "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "profiles": [
- {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Product
Delete a Product and its associated product variants and options.
Authorizations:
path Parameters
id required | string The ID of the Product. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Product. |
object required | string Default: "product" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.delete(productId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "product",
- "deleted": true
}
Set Metadata
Set the metadata of a Product. It can be any key-value pair, which allows adding custom data to a product.
Authorizations:
path Parameters
id required | string The ID of the Product. |
Request Body schema: application/json
key required | string The metadata key |
value required | string The metadata value |
Responses
Response Schema: application/json
required | object (Priced Product) A product is a saleable item that holds general information such as name or description. It must include at least one Product Variant, where each product variant defines different options to purchase the product with (for example, different sizes or colors). The prices and inventory of the product are defined on the variant level. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "key": "string",
- "value": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "profiles": [
- {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Add a Product Option
Add a Product Option to a Product.
Authorizations:
path Parameters
id required | string The ID of the Product. |
Request Body schema: application/json
title required | string Example: "Size" The title the Product Option. |
Responses
Response Schema: application/json
required | object (Priced Product) A product is a saleable item that holds general information such as name or description. It must include at least one Product Variant, where each product variant defines different options to purchase the product with (for example, different sizes or colors). The prices and inventory of the product are defined on the variant level. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "title": "Size"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "profiles": [
- {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Product Option
Update a Product Option's details.
Authorizations:
path Parameters
id required | string The ID of the Product. |
option_id required | string The ID of the Product Option. |
Request Body schema: application/json
title required | string The title of the Product Option |
Responses
Response Schema: application/json
required | object (Priced Product) A product is a saleable item that holds general information such as name or description. It must include at least one Product Variant, where each product variant defines different options to purchase the product with (for example, different sizes or colors). The prices and inventory of the product are defined on the variant level. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "title": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "profiles": [
- {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Product Option
Delete a Product Option. If there are product variants that use this product option, they must be deleted before deleting the product option.
Authorizations:
path Parameters
id required | string The ID of the Product. |
option_id required | string The ID of the Product Option. |
Responses
Response Schema: application/json
option_id required | string The ID of the deleted Product Option |
object required | string Default: "option" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
required | object (Priced Product) A product is a saleable item that holds general information such as name or description. It must include at least one Product Variant, where each product variant defines different options to purchase the product with (for example, different sizes or colors). The prices and inventory of the product are defined on the variant level. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.deleteOption(productId, optionId) .then(({ option_id, object, deleted, product }) => { console.log(product.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "option_id": "string",
- "object": "option",
- "deleted": true,
- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "profiles": [
- {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
List a Product's Variants
Retrieve a list of Product Variants associated with a Product. The variants can be paginated.
Authorizations:
path Parameters
id required | string ID of the product. |
query Parameters
fields | string Comma-separated fields that should be included in the returned product variants. |
expand | string Comma-separated relations that should be expanded in the returned product variants. |
offset | integer Default: 0 The number of product variants to skip when retrieving the product variants. |
limit | integer Default: 100 Limit the number of product variants returned. |
Responses
Response Schema: application/json
required | Array of objects (Product Variant) An array of product variants details. |
count required | integer The total number of items available |
offset required | integer The number of product variants skipped when retrieving the product variants. |
limit required | integer The number of items per page |
Request samples
- cURL
curl 'https://medusa-url.com/admin/products/{id}/variants' \ -H 'Authorization: Bearer {api_token}'
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "variants": [
- {
- "id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6",
- "title": "Small",
- "product_id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "product": { },
- "prices": [
- null
], - "sku": "shirt-123",
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": 0,
- "inventory_quantity": 100,
- "allow_backorder": false,
- "manage_inventory": true,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [
- null
], - "inventory_items": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "purchasable": true
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Product Variant
Create a Product Variant associated with a Product. Each product variant must have a unique combination of Product Option values.
Authorizations:
path Parameters
id required | string The ID of the Product. |
Request Body schema: application/json
title required | string The title of the product variant. |
required | Array of objects An array of product variant prices. A product variant can have different prices for each region or currency code. |
required | Array of objects An array of Product Option values that the variant corresponds to. |
sku | string The unique SKU of the product variant. |
ean | string The EAN number of the product variant. |
upc | string The UPC number of the product variant. |
barcode | string A generic GTIN field of the product variant. |
hs_code | string The Harmonized System code of the product variant. |
inventory_quantity | integer Default: 0 The amount of stock kept of the product variant. |
allow_backorder | boolean Whether the product variant can be purchased when out of stock. |
manage_inventory | boolean Default: true Whether Medusa should keep track of the inventory of this product variant. |
weight | number The wieght of the product variant. |
length | number The length of the product variant. |
height | number The height of the product variant. |
width | number The width of the product variant. |
origin_country | string The country of origin of the product variant. |
mid_code | string The Manufacturer Identification code of the product variant. |
material | string The material composition of the product variant. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
required | object (Priced Product) A product is a saleable item that holds general information such as name or description. It must include at least one Product Variant, where each product variant defines different options to purchase the product with (for example, different sizes or colors). The prices and inventory of the product are defined on the variant level. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "title": "string",
- "sku": "string",
- "ean": "string",
- "upc": "string",
- "barcode": "string",
- "hs_code": "string",
- "inventory_quantity": 0,
- "allow_backorder": true,
- "manage_inventory": true,
- "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { },
- "prices": [
- {
- "region_id": "string",
- "currency_code": "string",
- "amount": 0,
- "min_quantity": 0,
- "max_quantity": 0
}
], - "options": [
- {
- "option_id": "string",
- "value": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "profiles": [
- {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Product Variant
Update a Product Variant's details.
Authorizations:
path Parameters
id required | string The ID of the Product. |
variant_id required | string The ID of the Product Variant. |
Request Body schema: application/json
title | string The title of the product variant. |
sku | string The unique SKU of the product variant. |
ean | string The EAN number of the item. |
upc | string The UPC number of the item. |
barcode | string A generic GTIN field of the product variant. |
hs_code | string The Harmonized System code of the product variant. |
inventory_quantity | integer The amount of stock kept of the product variant. |
allow_backorder | boolean Whether the product variant can be purchased when out of stock. |
manage_inventory | boolean Whether Medusa should keep track of the inventory of this product variant. |
weight | number The weight of the product variant. |
length | number The length of the product variant. |
height | number The height of the product variant. |
width | number The width of the product variant. |
origin_country | string The country of origin of the product variant. |
mid_code | string The Manufacturer Identification code of the product variant. |
material | string The material composition of the product variant. |
metadata | object An optional set of key-value pairs with additional information. |
Array of objects An array of product variant prices. A product variant can have different prices for each region or currency code. | |
Array of objects An array of Product Option values that the variant corresponds to. |
Responses
Response Schema: application/json
required | object (Priced Product) A product is a saleable item that holds general information such as name or description. It must include at least one Product Variant, where each product variant defines different options to purchase the product with (for example, different sizes or colors). The prices and inventory of the product are defined on the variant level. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "title": "string",
- "sku": "string",
- "ean": "string",
- "upc": "string",
- "barcode": "string",
- "hs_code": "string",
- "inventory_quantity": 0,
- "allow_backorder": true,
- "manage_inventory": true,
- "weight": 0,
- "length": 0,
- "height": 0,
- "width": 0,
- "origin_country": "string",
- "mid_code": "string",
- "material": "string",
- "metadata": { },
- "prices": [
- {
- "id": "string",
- "region_id": "string",
- "currency_code": "string",
- "amount": 0,
- "min_quantity": 0,
- "max_quantity": 0
}
], - "options": [
- {
- "option_id": "string",
- "value": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "profiles": [
- {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Product Variant
Delete a Product Variant.
Authorizations:
path Parameters
id required | string The ID of the Product. |
variant_id required | string The ID of the Product Variant. |
Responses
Response Schema: application/json
variant_id required | string The ID of the deleted Product Variant. |
object required | string Default: "product-variant" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
required | object (Priced Product) A product is a saleable item that holds general information such as name or description. It must include at least one Product Variant, where each product variant defines different options to purchase the product with (for example, different sizes or colors). The prices and inventory of the product are defined on the variant level. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.products.deleteVariant(productId, variantId) .then(({ variant_id, object, deleted, product }) => { console.log(product.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "variant_id": "string",
- "object": "product-variant",
- "deleted": true,
- "product": {
- "id": "prod_01G1G5V2MBA328390B5AXJ610F",
- "title": "Medusa Coffee Mug",
- "subtitle": "string",
- "description": "Every programmer's best friend.",
- "handle": "coffee-mug",
- "is_giftcard": false,
- "status": "draft",
- "images": [
- {
- "id": null,
- "url": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "options": [
- {
- "id": null,
- "title": null,
- "values": [ ],
- "product_id": null,
- "product": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "variants": [
- {
- "id": null,
- "title": null,
- "product_id": null,
- "product": { },
- "prices": [ ],
- "sku": null,
- "barcode": null,
- "ean": null,
- "upc": null,
- "variant_rank": null,
- "inventory_quantity": null,
- "allow_backorder": null,
- "manage_inventory": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "options": [ ],
- "inventory_items": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { },
- "purchasable": null,
- "original_price": null,
- "calculated_price": null,
- "original_price_incl_tax": null,
- "calculated_price_incl_tax": null,
- "original_tax": null,
- "calculated_tax": null,
- "tax_rates": [ ]
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "rank": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null
}
], - "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "profiles": [
- {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "collection": {
- "id": "pcol_01F0YESBFAZ0DV6V831JXWH0BG",
- "title": "Summer Collection",
- "handle": "summer-collection",
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "type_id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "type": {
- "id": "ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "value": "Clothing",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "tags": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "discountable": true,
- "external_id": null,
- "sales_channels": [
- {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update Publishable API Key
Update a Publishable API Key's details.
Authorizations:
path Parameters
id required | string The ID of the Publishable API Key. |
Request Body schema: application/json
title | string The title of the Publishable API Key. |
Responses
Response Schema: application/json
required | object (Publishable API key) A Publishable API key defines scopes that resources are available in. Then, it can be used in request to infer the resources without having to directly pass them. For example, a publishable API key can be associated with one or more sales channels. Then, when the publishable API key is passed in the header of a request, it is inferred what sales channel is being used without having to pass the sales channel as a query or body parameter of the request. Publishable API keys can only be used with sales channels, at the moment. | ||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "title": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
List Publishable API keys
Retrieve a list of publishable API keys. The publishable API keys can be filtered by fields such as q
. The publishable API keys can also be paginated.
Authorizations:
query Parameters
q | string term to search publishable API keys' titles. |
limit | number Default: "20" Limit the number of publishable API keys returned. |
offset | number Default: "0" The number of publishable API keys to skip when retrieving the publishable API keys. |
expand | string Comma-separated relations that should be expanded in the returned publishable API keys. |
fields | string Comma-separated fields that should be included in the returned publishable API keys. |
Responses
Response Schema: application/json
required | Array of objects (Publishable API key) An array of publishable API keys details. |
count required | integer The total number of items available |
offset required | integer The number of publishable API keys skipped when retrieving the publishable API keys. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.publishableApiKeys.list() .then(({ publishable_api_keys, count, limit, offset }) => { console.log(publishable_api_keys) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "publishable_api_keys": [
- {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create Publishable API Key
Creates a Publishable API Key.
Authorizations:
Request Body schema: application/json
title required | string The title of the publishable API key |
Responses
Response Schema: application/json
required | object (Publishable API key) A Publishable API key defines scopes that resources are available in. Then, it can be used in request to infer the resources without having to directly pass them. For example, a publishable API key can be associated with one or more sales channels. Then, when the publishable API key is passed in the header of a request, it is inferred what sales channel is being used without having to pass the sales channel as a query or body parameter of the request. Publishable API keys can only be used with sales channels, at the moment. | ||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "title": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Get a Publishable API Key
Retrieve a publishable API key's details.
Authorizations:
path Parameters
id required | string The ID of the Publishable API Key. |
Responses
Response Schema: application/json
required | object (Publishable API key) A Publishable API key defines scopes that resources are available in. Then, it can be used in request to infer the resources without having to directly pass them. For example, a publishable API key can be associated with one or more sales channels. Then, when the publishable API key is passed in the header of a request, it is inferred what sales channel is being used without having to pass the sales channel as a query or body parameter of the request. Publishable API keys can only be used with sales channels, at the moment. | ||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.publishableApiKeys.retrieve(publishableApiKeyId) .then(({ publishable_api_key }) => { console.log(publishable_api_key.id) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Delete Publishable API Key
Delete a Publishable API Key. Associated resources, such as sales channels, are not deleted.
Authorizations:
path Parameters
id required | string The ID of the Publishable API Key to delete. |
Responses
Response Schema: application/json
id required | string The ID of the deleted publishable API key. |
object required | string Default: "publishable_api_key" The type of the object that was deleted. |
deleted required | boolean Default: true Whether the publishable API key was deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.publishableApiKeys.delete(publishableApiKeyId) .then(({ id, object, deleted }) => { console.log(id) })
Response samples
- 200
- 400
{- "id": "string",
- "object": "publishable_api_key",
- "deleted": true
}
Revoke a Publishable API Key
Revoke a Publishable API Key. Revoking the publishable API Key can't be undone, and the key can't be used in future requests.
Authorizations:
path Parameters
id required | string The ID of the Publishable API Key. |
Responses
Response Schema: application/json
required | object (Publishable API key) A Publishable API key defines scopes that resources are available in. Then, it can be used in request to infer the resources without having to directly pass them. For example, a publishable API key can be associated with one or more sales channels. Then, when the publishable API key is passed in the header of a request, it is inferred what sales channel is being used without having to pass the sales channel as a query or body parameter of the request. Publishable API keys can only be used with sales channels, at the moment. | ||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.publishableApiKeys.revoke(publishableApiKeyId) .then(({ publishable_api_key }) => { console.log(publishable_api_key.id) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
List Sales Channels
List the sales channels associated with a publishable API key. The sales channels can be filtered by fields such as q
.
Authorizations:
path Parameters
id required | string The ID of the publishable API key. |
query Parameters
q | string query to search sales channels' names and descriptions. |
Responses
Response Schema: application/json
required | Array of objects (Sales Channel) An array of sales channels details. | ||||||||||||||||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.publishableApiKeys.listSalesChannels() .then(({ sales_channels }) => { console.log(sales_channels.length) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "sales_channels": [
- {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}
Add Sales Channels
Assign a list of sales channels to a publishable API key.
Authorizations:
path Parameters
id required | string The ID of the Publishable Api Key. |
Request Body schema: application/json
required | Array of objects The IDs of the sales channels to add to the publishable API key | ||
Array
|
Responses
Response Schema: application/json
required | object (Publishable API key) A Publishable API key defines scopes that resources are available in. Then, it can be used in request to infer the resources without having to directly pass them. For example, a publishable API key can be associated with one or more sales channels. Then, when the publishable API key is passed in the header of a request, it is inferred what sales channel is being used without having to pass the sales channel as a query or body parameter of the request. Publishable API keys can only be used with sales channels, at the moment. | ||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "sales_channel_ids": [
- {
- "id": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Remove Sales Channels
Remove a list of sales channels from a publishable API key. This doesn't delete the sales channels and only removes the association between them and the publishable API key.
Authorizations:
path Parameters
id required | string The ID of the Publishable API Key. |
Request Body schema: application/json
required | Array of objects The IDs of the sales channels to remove from the publishable API key | ||
Array
|
Responses
Response Schema: application/json
required | object (Publishable API key) A Publishable API key defines scopes that resources are available in. Then, it can be used in request to infer the resources without having to directly pass them. For example, a publishable API key can be associated with one or more sales channels. Then, when the publishable API key is passed in the header of a request, it is inferred what sales channel is being used without having to pass the sales channel as a query or body parameter of the request. Publishable API keys can only be used with sales channels, at the moment. | ||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "sales_channel_ids": [
- {
- "id": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "publishable_api_key": {
- "id": "pk_01G1G5V27GYX4QXNARRQCW1N8T",
- "created_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_by": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "revoked_at": "2019-08-24T14:15:22Z",
- "title": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Publishable API Keys can be used to scope Store API calls with an API key, determining what resources are retrieved when querying the API. For example, a publishable API key can be associated with one or more sales channels. When it is passed in the header of a request to the List Product store endpoint, the sales channels are inferred from the key and only products associated with those sales channels are retrieved. Admins can manage publishable API keys and their associated resources. Currently, only Sales Channels are supported as a resource.
Regions are different countries or geographical regions that the commerce store serves customers in. Admins can manage these regions, their providers, and more.
List Regions
Retrieve a list of Regions. The regions can be filtered by fields such as created_at
. The regions can also be paginated
Authorizations:
query Parameters
limit | integer Default: 50 Limit the number of regions returned. |
offset | integer Default: 0 The number of regions to skip when retrieving the regions. |
object Filter by a creation date range. | |
object Filter by an update date range. | |
object Filter by a deletion date range. |
Responses
Response Schema: application/json
required | Array of objects (Region) An array of regions details. |
count required | integer The total number of items available |
offset required | integer The number of regions skipped when retrieving the regions. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.list() .then(({ regions, limit, offset, count }) => { console.log(regions.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "regions": [
- {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Region
Create a Region.
Authorizations:
Request Body schema: application/json
name required | string The name of the Region |
currency_code required | |
tax_rate required | number The tax rate to use in the Region. |
payment_providers required | Array of strings A list of Payment Provider IDs that can be used in the Region |
fulfillment_providers required | Array of strings A list of Fulfillment Provider IDs that can be used in the Region |
countries required | Array of strings Example: ["US"] A list of countries' 2 ISO characters that should be included in the Region. |
tax_code | string The tax code of the Region. |
includes_tax | boolean Whether taxes are included in the prices of the region. |
Responses
Response Schema: application/json
required | object (Region) A region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "currency_code": "string",
- "tax_code": "string",
- "tax_rate": 0,
- "payment_providers": [
- "string"
], - "fulfillment_providers": [
- "string"
], - "countries": [
- "US"
], - "includes_tax": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Region
Retrieve a Region's details.
Authorizations:
path Parameters
id required | string The ID of the Region. |
Responses
Response Schema: application/json
required | object (Region) A region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.retrieve(regionId) .then(({ region }) => { console.log(region.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Region
Update a Region's details.
Authorizations:
path Parameters
id required | string The ID of the Region. |
Request Body schema: application/json
name | string The name of the Region |
currency_code | |
automatic_taxes | boolean If set to |
gift_cards_taxable | boolean If set to |
tax_provider_id | string The ID of the tax provider to use. If none provided, the system tax provider is used. |
tax_code | string The tax code of the Region. |
tax_rate | number The tax rate to use in the Region. |
includes_tax | boolean Whether taxes are included in the prices of the region. |
payment_providers | Array of strings A list of Payment Provider IDs that can be used in the Region |
fulfillment_providers | Array of strings A list of Fulfillment Provider IDs that can be used in the Region |
countries | Array of strings A list of countries' 2 ISO characters that should be included in the Region. |
Responses
Response Schema: application/json
required | object (Region) A region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "currency_code": "string",
- "automatic_taxes": true,
- "gift_cards_taxable": true,
- "tax_provider_id": "string",
- "tax_code": "string",
- "tax_rate": 0,
- "includes_tax": true,
- "payment_providers": [
- "string"
], - "fulfillment_providers": [
- "string"
], - "countries": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Region
Delete a Region. Associated resources, such as providers or currencies are not deleted. Associated tax rates are deleted.
Authorizations:
path Parameters
id required | string The ID of the Region. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Region. |
object required | string Default: "region" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.delete(regionId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "region",
- "deleted": true
}
Add Country
Add a Country to the list of Countries in a Region
Authorizations:
path Parameters
id required | string The ID of the Region. |
Request Body schema: application/json
country_code required |
Responses
Response Schema: application/json
required | object (Region) A region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "country_code": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Country
Remove a Country from the list of Countries in a Region. The country will still be available in the system, and it can be used in other regions.
Authorizations:
path Parameters
id required | string The ID of the Region. |
country_code required |
Responses
Response Schema: application/json
required | object (Region) A region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.deleteCountry(regionId, "dk") .then(({ region }) => { console.log(region.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
List Fulfillment Options
Retrieve a list of fulfillment options available in a Region.
Authorizations:
path Parameters
id required | string The ID of the Region. |
Responses
Response Schema: application/json
required | Array of objects Fulfillment providers details. | ||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.retrieveFulfillmentOptions(regionId) .then(({ fulfillment_options }) => { console.log(fulfillment_options.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "fulfillment_options": [
- {
- "provider_id": "string",
- "options": [
- { }
]
}
]
}
Add Fulfillment Provider
Add a Fulfillment Provider to the list of fulfullment providers in a Region.
Authorizations:
path Parameters
id required | string The ID of the Region. |
Request Body schema: application/json
provider_id required | string The ID of the Fulfillment Provider. |
Responses
Response Schema: application/json
required | object (Region) A region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "provider_id": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Fulfillment Provider
Remove a Fulfillment Provider from a Region. The fulfillment provider will still be available for usage in other regions.
Authorizations:
path Parameters
id required | string The ID of the Region. |
provider_id required | string The ID of the Fulfillment Provider. |
Responses
Response Schema: application/json
required | object (Region) A region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.deleteFulfillmentProvider(regionId, "manual") .then(({ region }) => { console.log(region.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Add Payment Provider
Add a Payment Provider to the list of payment providers in a Region.
Authorizations:
path Parameters
id required | string The ID of the Region. |
Request Body schema: application/json
provider_id required | string The ID of the Payment Provider. |
Responses
Response Schema: application/json
required | object (Region) A region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "provider_id": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Payment Provider
Remove a Payment Provider from a Region. The payment provider will still be available for usage in other regions.
Authorizations:
path Parameters
id required | string The ID of the Region. |
provider_id required | string The ID of the Payment Provider. |
Responses
Response Schema: application/json
required | object (Region) A region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.regions.deletePaymentProvider(regionId, "manual") .then(({ region }) => { console.log(region.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "tax_rates": [
- {
- "id": null,
- "rate": null,
- "code": null,
- "name": null,
- "region_id": null,
- "region": { },
- "products": [ ],
- "product_types": [ ],
- "shipping_options": [ ],
- "product_count": null,
- "product_type_count": null,
- "shipping_option_count": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}
], - "tax_provider_id": null,
- "tax_provider": {
- "id": "manual",
- "is_installed": true
}, - "payment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "fulfillment_providers": [
- {
- "id": null,
- "is_installed": null
}
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Reservations, provided by the Inventory Module, are quantities of an item that are reserved, typically when an order is placed but not yet fulfilled. Reservations can be associated with any resources, but commonly with line items of an order.
List Reservations
Retrieve a list of Reservations. The reservations can be filtered by fields such as location_id
or quantity
. The reservations can also be paginated.
Authorizations:
query Parameters
location_id | Array of strings Filter by location ID |
inventory_item_id | Array of strings Filter by inventory item ID. |
line_item_id | Array of strings Filter by line item ID. |
object Filter by reservation quantity | |
string or object Filter by description. | |
object Filter by a creation date range. | |
offset | integer Default: 0 The number of reservations to skip when retrieving the reservations. |
limit | integer Default: 20 Limit the number of reservations returned. |
expand | string Comma-separated relations that should be expanded in the returned reservations. |
fields | string Comma-separated fields that should be included in the returned reservations. |
Responses
Response Schema: application/json
required | Array of objects (ExtendedReservationItem) An array of reservations details. |
count required | integer The total number of items available |
offset required | integer The number of reservations skipped when retrieving the reservations. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.reservations.list() .then(({ reservations, count, limit, offset }) => { console.log(reservations.length) })
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "reservations": [
- {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "description": "string",
- "created_by": "string",
- "quantity": 0,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "line_item": {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}, - "inventory_item": {
- "sku": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "title": null,
- "description": null,
- "thumbnail": null,
- "material": null,
- "weight": null,
- "height": null,
- "width": null,
- "length": null,
- "requires_shipping": null,
- "metadata": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Reservation
Create a Reservation which can be associated with any resource, such as an order's line item.
Authorizations:
Request Body schema: application/json
location_id required | string The ID of the location of the reservation. |
inventory_item_id required | string The ID of the inventory item the reservation is associated with. |
quantity required | number The quantity to reserve. |
line_item_id | string The ID of the line item of the reservation. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
required | object (Reservation item) Represents a reservation of an inventory item at a stock location | ||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "line_item_id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "quantity": 0,
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "reservation": {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "description": "string",
- "created_by": "string",
- "quantity": 0,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Get a Reservation
Retrieve a reservation's details.'
Authorizations:
path Parameters
id required | string The ID of the reservation. |
Responses
Response Schema: application/json
required | object (Reservation item) Represents a reservation of an inventory item at a stock location | ||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.reservations.retrieve(reservationId) .then(({ reservation }) => { console.log(reservation.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "reservation": {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "description": "string",
- "created_by": "string",
- "quantity": 0,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Update a Reservation
Update a Reservation's details.'
Authorizations:
path Parameters
id required | string The ID of the Reservation. |
Request Body schema: application/json
location_id | string The ID of the location associated with the reservation. |
quantity | number The quantity to reserve. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
required | object (Reservation item) Represents a reservation of an inventory item at a stock location | ||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "location_id": "string",
- "quantity": 0,
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "reservation": {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "string",
- "description": "string",
- "created_by": "string",
- "quantity": 0,
- "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Delete a Reservation
Delete a Reservation. Associated resources, such as the line item, will not be deleted.
Authorizations:
path Parameters
id required | string The ID of the Reservation to delete. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Reservation. |
object required | string Default: "reservation" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the Reservation was deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.reservations.delete(reservationId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "reservation",
- "deleted": true
}
Return reasons are key-value pairs that are used to specify why an order return is being created. Admins can manage available return reasons, and they can be used by both admins and customers when creating a return.
List Return Reasons
Retrieve a list of Return Reasons.
Authorizations:
Responses
Response Schema: application/json
required | Array of objects (Return Reason) | ||||||||||||||||||||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.returnReasons.list() .then(({ return_reasons }) => { console.log(return_reasons.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "return_reasons": [
- {
- "id": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ",
- "value": "damaged",
- "label": "Damaged goods",
- "description": "Items that are damaged",
- "parent_return_reason_id": null,
- "parent_return_reason": { },
- "return_reason_children": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}
Create a Return Reason
Create a Return Reason.
Authorizations:
Request Body schema: application/json
label required | string The label to display to the Customer. |
value required | string A unique value of the return reason. |
parent_return_reason_id | string The ID of the parent return reason. |
description | string The description of the Reason. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
required | object (Return Reason) A Return Reason is a value defined by an admin. It can be used on Return Items in order to indicate why a Line Item was returned. | ||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "label": "string",
- "value": "string",
- "parent_return_reason_id": "string",
- "description": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "return_reason": {
- "id": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ",
- "value": "damaged",
- "label": "Damaged goods",
- "description": "Items that are damaged",
- "parent_return_reason_id": null,
- "parent_return_reason": { },
- "return_reason_children": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Return Reason
Retrieve a Return Reason's details.
Authorizations:
path Parameters
id required | string The ID of the Return Reason. |
Responses
Response Schema: application/json
required | object (Return Reason) A Return Reason is a value defined by an admin. It can be used on Return Items in order to indicate why a Line Item was returned. | ||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.returnReasons.retrieve(returnReasonId) .then(({ return_reason }) => { console.log(return_reason.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "return_reason": {
- "id": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ",
- "value": "damaged",
- "label": "Damaged goods",
- "description": "Items that are damaged",
- "parent_return_reason_id": null,
- "parent_return_reason": { },
- "return_reason_children": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Return Reason
Update a Return Reason's details.
Authorizations:
path Parameters
id required | string The ID of the Return Reason. |
Request Body schema: application/json
label | string The label to display to the Customer. |
value | string A unique value of the return reason. |
description | string The description of the Reason. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
required | object (Return Reason) A Return Reason is a value defined by an admin. It can be used on Return Items in order to indicate why a Line Item was returned. | ||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "label": "string",
- "value": "string",
- "description": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "return_reason": {
- "id": "rr_01G8X82GCCV2KSQHDBHSSAH5TQ",
- "value": "damaged",
- "label": "Damaged goods",
- "description": "Items that are damaged",
- "parent_return_reason_id": null,
- "parent_return_reason": { },
- "return_reason_children": { },
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Return Reason
Delete a return reason.
Authorizations:
path Parameters
id required | string The ID of the return reason |
Responses
Response Schema: application/json
id required | string The ID of the deleted return reason |
object required | string Default: "return_reason" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.returnReasons.delete(returnReasonId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "return_reason",
- "deleted": true
}
A return can be created by a customer or an admin to return items in an order. Admins can manage these returns and change their state.
List Returns
Retrieve a list of Returns. The returns can be paginated.
Authorizations:
query Parameters
limit | number Default: "50" Limit the number of Returns returned. |
offset | number Default: "0" The number of Returns to skip when retrieving the Returns. |
Responses
Response Schema: application/json
required | Array of objects (Return) An array of returns details. |
count required | integer The total number of items available |
offset required | integer The number of returns skipped when retrieving the returns. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.returns.list() .then(({ returns, limit, offset, count }) => { console.log(returns.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "returns": [
- {
- "id": "ret_01F0YET7XPCMF8RZ0Y151NZV2V",
- "status": "requested",
- "items": [
- null
], - "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "shipping_method": {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}, - "shipping_data": { },
- "location_id": "sloc_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "refund_amount": 1000,
- "no_notification": false,
- "idempotency_key": "string",
- "received_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Cancel a Return
Registers a Return as canceled. The return can be associated with an order, claim, or swap.
Authorizations:
path Parameters
id required | string The ID of the Return. |
Responses
Response Schema: application/json
required | object (Order) An order is a purchase made by a customer. It holds details about payment and fulfillment of the order. An order may also be created from a draft order, which is created by an admin user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.returns.cancel(returnId) .then(({ order }) => { console.log(order.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "order": {
- "id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "status": "pending",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "display_id": 2,
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "email": "user@example.com",
- "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "billing_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": {
- "id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "name": "EU",
- "currency_code": "usd",
- "currency": {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}, - "tax_rate": 0,
- "tax_rates": [
- null
], - "tax_code": null,
- "gift_cards_taxable": true,
- "automatic_taxes": true,
- "countries": [
- null
], - "tax_provider_id": null,
- "tax_provider": {
- "id": null,
- "is_installed": null
}, - "payment_providers": [
- null
], - "fulfillment_providers": [
- null
], - "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "currency_code": "usd",
- "currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "tax_rate": 0,
- "discounts": [
- {
- "id": null,
- "code": null,
- "is_dynamic": null,
- "rule_id": null,
- "rule": null,
- "is_disabled": null,
- "parent_discount_id": null,
- "parent_discount": { },
- "starts_at": null,
- "ends_at": null,
- "valid_duration": null,
- "regions": [ ],
- "usage_limit": null,
- "usage_count": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "gift_cards": [
- {
- "id": null,
- "code": null,
- "value": null,
- "balance": null,
- "region_id": null,
- "region": null,
- "order_id": null,
- "order": { },
- "is_disabled": null,
- "ends_at": null,
- "tax_rate": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "payments": [
- { }
], - "fulfillments": [
- { }
], - "returns": [
- { }
], - "claims": [
- { }
], - "refunds": [
- { }
], - "swaps": [
- { }
], - "draft_order_id": null,
- "draft_order": { },
- "items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "edits": [
- { }
], - "gift_card_transactions": [
- {
- "id": null,
- "gift_card_id": null,
- "gift_card": { },
- "order_id": null,
- "order": { },
- "amount": null,
- "created_at": null,
- "is_taxable": null,
- "tax_rate": null
}
], - "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "idempotency_key": "string",
- "external_id": null,
- "sales_channel_id": null,
- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_total": 1000,
- "raw_discount_total": 800,
- "discount_total": 800,
- "tax_total": 0,
- "refunded_total": 0,
- "total": 8200,
- "subtotal": 8000,
- "paid_total": 8000,
- "refundable_amount": 8200,
- "gift_card_total": 0,
- "gift_card_tax_total": 0,
- "returnable_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Receive a Return
Mark a Return as received. This also updates the status of associated order, claim, or swap accordingly.
Authorizations:
path Parameters
id required | string The ID of the Return. |
Request Body schema: application/json
required | Array of objects The Line Items that have been received. |
refund | number The amount to refund. |
Responses
Response Schema: application/json
required | object (Return) A Return holds information about Line Items that a Customer wishes to send back, along with how the items will be returned. Returns can also be used as part of a Swap or a Claim. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "items": [
- {
- "item_id": "string",
- "quantity": 0
}
], - "refund": 0
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "return": {
- "id": "ret_01F0YET7XPCMF8RZ0Y151NZV2V",
- "status": "requested",
- "items": [
- {
- "return_id": null,
- "item_id": null,
- "return_order": { },
- "item": null,
- "quantity": null,
- "is_requested": null,
- "requested_quantity": null,
- "received_quantity": null,
- "reason_id": null,
- "reason": null,
- "note": null,
- "metadata": { }
}
], - "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "shipping_method": {
- "id": "sm_01F0YET7DR2E7CYVSDHM593QG2",
- "shipping_option_id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "tax_lines": [
- null
], - "price": 200,
- "data": { },
- "includes_tax": false,
- "subtotal": 8000,
- "total": 8200,
- "tax_total": 0
}, - "shipping_data": { },
- "location_id": "sloc_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "refund_amount": 1000,
- "no_notification": false,
- "idempotency_key": "string",
- "received_at": "2019-08-24T14:15:22Z",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
A sales channel indicates a channel where products can be sold in. For example, a webshop or a mobile app. Admins can manage sales channels and the products available in them.
List Sales Channels
Retrieve a list of sales channels. The sales channels can be filtered by fields such as q
or name
. The sales channels can also be sorted or paginated.
Authorizations:
query Parameters
id | string Filter by a sales channel ID. |
name | string Filter by name. |
description | string Filter by description. |
q | string term used to search sales channels' names and descriptions. |
order | string A sales-channel field to sort-order the retrieved sales channels by. |
object Filter by a creation date range. | |
object Filter by an update date range. | |
object Filter by a deletion date range. | |
offset | integer Default: 0 The number of sales channels to skip when retrieving the sales channels. |
limit | integer Default: 20 Limit the number of sales channels returned. |
expand | string Comma-separated relations that should be expanded in the returned sales channels. |
fields | string Comma-separated fields that should be included in the returned sales channels. |
Responses
Response Schema: application/json
required | Array of objects (Sales Channel) An array of sales channels details. |
count required | integer The total number of items available |
offset required | integer The number of items skipped before the returned results |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.salesChannels.list() .then(({ sales_channels, limit, offset, count }) => { console.log(sales_channels.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "sales_channels": [
- {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Sales Channel
Create a Sales Channel.
Authorizations:
Request Body schema: application/json
name required | string The name of the Sales Channel |
description | string The description of the Sales Channel |
is_disabled | boolean Whether the Sales Channel is disabled. |
Responses
Response Schema: application/json
required | object (Sales Channel) A Sales Channel is a method a business offers its products for purchase for the customers. For example, a Webshop can be a sales channel, and a mobile app can be another. | ||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "description": "string",
- "is_disabled": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Sales Channel
Retrieve a sales channel's details.
Authorizations:
path Parameters
id required | string The ID of the Sales channel. |
Responses
Response Schema: application/json
required | object (Sales Channel) A Sales Channel is a method a business offers its products for purchase for the customers. For example, a Webshop can be a sales channel, and a mobile app can be another. | ||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.salesChannels.retrieve(salesChannelId) .then(({ sales_channel }) => { console.log(sales_channel.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Sales Channel
Update a Sales Channel's details.
Authorizations:
path Parameters
id required | string The ID of the Sales Channel. |
Request Body schema: application/json
name | string The name of the sales channel |
description | string The description of the sales channel. |
is_disabled | boolean Whether the Sales Channel is disabled. |
Responses
Response Schema: application/json
required | object (Sales Channel) A Sales Channel is a method a business offers its products for purchase for the customers. For example, a Webshop can be a sales channel, and a mobile app can be another. | ||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "description": "string",
- "is_disabled": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Sales Channel
Delete a sales channel. Associated products, stock locations, and other resources are not deleted.
Authorizations:
path Parameters
id required | string The ID of the Sales channel. |
Responses
Response Schema: application/json
id required | string The ID of the deleted sales channel |
object required | string Default: "sales-channel" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.salesChannels.delete(salesChannelId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "sales-channel",
- "deleted": true
}
Add Products to Sales Channel
Add a list of products to a sales channel.
Authorizations:
path Parameters
id required | string The ID of the Sales channel. |
Request Body schema: application/json
required | Array of objects The IDs of the products to add to the Sales Channel | ||
Array
|
Responses
Response Schema: application/json
required | object (Sales Channel) A Sales Channel is a method a business offers its products for purchase for the customers. For example, a Webshop can be a sales channel, and a mobile app can be another. | ||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "product_ids": [
- {
- "id": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Products from Sales Channel
Remove a list of products from a sales channel. This does not delete the product. It only removes the association between the product and the sales channel.
Authorizations:
path Parameters
id required | string The ID of the Sales Channel |
Request Body schema: application/json
required | Array of objects The IDs of the products to remove from the Sales Channel. | ||
Array
|
Responses
Response Schema: application/json
required | object (Sales Channel) A Sales Channel is a method a business offers its products for purchase for the customers. For example, a Webshop can be a sales channel, and a mobile app can be another. | ||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "product_ids": [
- {
- "id": "string"
}
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Associate a Stock Location
Associate a stock location with a Sales Channel.
Authorizations:
path Parameters
id required | string The ID of the Sales Channel. |
Request Body schema: application/json
location_id required | string The ID of the stock location |
Responses
Response Schema: application/json
required | object (Sales Channel) A Sales Channel is a method a business offers its products for purchase for the customers. For example, a Webshop can be a sales channel, and a mobile app can be another. | ||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "location_id": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- {
- "id": null,
- "sales_channel_id": null,
- "location_id": null,
- "sales_channel": { },
- "created_at": null,
- "updated_at": null,
- "deleted_at": null
}
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Stock Location from Sales Channels.
Remove a stock location from a Sales Channel. This only removes the association between the stock location and the sales channel. It does not delete the stock location.
Authorizations:
path Parameters
id required | string The ID of the Sales Channel. |
Request Body schema: application/json
location_id required | string The ID of the stock location |
Responses
Response Schema: application/json
id required | string The ID of the removed stock location from a sales channel |
object required | string Default: "stock-location" The type of the object that was removed. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- Payload
- JS Client
- cURL
{- "location_id": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "stock-location",
- "deleted": true
}
A shipping option is used to define the available shipping methods during checkout or when creating a return. Admins can create an unlimited number of shipping options, each associated with a shipping profile and fulfillment provider, among other resources.
List Shipping Options
Retrieve a list of Shipping Options. The shipping options can be filtered by fields such as region_id
or is_return
.
Authorizations:
query Parameters
region_id | string Filter by a region ID. |
is_return | boolean Filter by whether the shipping option is used for returns or orders. |
admin_only | boolean Filter by whether the shipping option is used only by admins or not. |
Responses
Response Schema: application/json
required | Array of objects (Shipping Option) An array of shipping options details. |
count required | integer The total number of items available |
offset required | integer The number of shipping options skipped when retrieving the shipping options. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingOptions.list() .then(({ shipping_options, count }) => { console.log(shipping_options.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "shipping_options": [
- {
- "id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "name": "PostFake Standard",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": null,
- "name": null,
- "type": null,
- "products": [ ],
- "shipping_options": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "provider_id": "manual",
- "provider": {
- "id": null,
- "is_installed": null
}, - "price_type": "flat_rate",
- "amount": 200,
- "is_return": false,
- "admin_only": false,
- "requirements": [
- null
], - "data": { },
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create Shipping Option
Create a Shipping Option.
Authorizations:
Request Body schema: application/json
name required | string The name of the Shipping Option |
region_id required | string The ID of the Region in which the Shipping Option will be available. |
provider_id required | string The ID of the Fulfillment Provider that handles the Shipping Option. |
data required | object The data needed for the Fulfillment Provider to handle shipping with this Shipping Option. |
price_type required | string Enum: "flat_rate" "calculated" The type of the Shipping Option price. |
profile_id | number The ID of the Shipping Profile to add the Shipping Option to. |
amount | integer The amount to charge for the Shipping Option. If the |
Array of objects The requirements that must be satisfied for the Shipping Option to be available. | |
is_return | boolean Default: false Whether the Shipping Option can be used for returns or during checkout. |
admin_only | boolean Default: false If set to |
metadata | object An optional set of key-value pairs with additional information. |
includes_tax | boolean Tax included in prices of shipping option |
Responses
Response Schema: application/json
required | object (Shipping Option) A Shipping Option represents a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "region_id": "string",
- "provider_id": "string",
- "profile_id": 0,
- "data": { },
- "price_type": "flat_rate",
- "amount": 0,
- "requirements": [
- {
- "type": "max_subtotal",
- "amount": 0
}
], - "is_return": false,
- "admin_only": false,
- "metadata": { },
- "includes_tax": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "shipping_option": {
- "id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "name": "PostFake Standard",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "provider_id": "manual",
- "provider": {
- "id": "manual",
- "is_installed": true
}, - "price_type": "flat_rate",
- "amount": 200,
- "is_return": false,
- "admin_only": false,
- "requirements": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": { },
- "type": null,
- "amount": null,
- "deleted_at": null
}
], - "data": { },
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Shipping Option
Retrieve a Shipping Option's details.
Authorizations:
path Parameters
id required | string The ID of the Shipping Option. |
Responses
Response Schema: application/json
required | object (Shipping Option) A Shipping Option represents a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingOptions.retrieve(optionId) .then(({ shipping_option }) => { console.log(shipping_option.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "shipping_option": {
- "id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "name": "PostFake Standard",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "provider_id": "manual",
- "provider": {
- "id": "manual",
- "is_installed": true
}, - "price_type": "flat_rate",
- "amount": 200,
- "is_return": false,
- "admin_only": false,
- "requirements": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": { },
- "type": null,
- "amount": null,
- "deleted_at": null
}
], - "data": { },
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update Shipping Option
Update a Shipping Option's details.
Authorizations:
path Parameters
id required | string The ID of the Shipping Option. |
Request Body schema: application/json
required | Array of objects The requirements that must be satisfied for the Shipping Option to be available. |
name | string The name of the Shipping Option |
amount | integer The amount to charge for the Shipping Option. If the |
admin_only | boolean If set to |
metadata | object An optional set of key-value pairs with additional information. |
includes_tax | boolean Tax included in prices of shipping option |
Responses
Response Schema: application/json
required | object (Shipping Option) A Shipping Option represents a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information. | ||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "amount": 0,
- "admin_only": true,
- "metadata": { },
- "requirements": [
- {
- "id": "string",
- "type": "max_subtotal",
- "amount": 0
}
], - "includes_tax": true
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "shipping_option": {
- "id": "so_01G1G5V27GYX4QXNARRQCW1N8T",
- "name": "PostFake Standard",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "profile_id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "provider_id": "manual",
- "provider": {
- "id": "manual",
- "is_installed": true
}, - "price_type": "flat_rate",
- "amount": 200,
- "is_return": false,
- "admin_only": false,
- "requirements": [
- {
- "id": null,
- "shipping_option_id": null,
- "shipping_option": { },
- "type": null,
- "amount": null,
- "deleted_at": null
}
], - "data": { },
- "includes_tax": false,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete Shipping Option
Delete a Shipping Option. Once deleted, it can't be used when creating orders or returns.
Authorizations:
path Parameters
id required | string The ID of the Shipping Option. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Shipping Option. |
object required | string Default: "shipping-option" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingOptions.delete(optionId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "shipping-option",
- "deleted": true
}
A shipping profile is used to group products that can be shipped in the same manner. They are created by the admin and they're not associated with a fulfillment provider.
List Shipping Profiles
Retrieve a list of Shipping Profiles.
Authorizations:
Responses
Response Schema: application/json
required | Array of objects (Shipping Profile) An array of shipping profiles details. | ||||||||||||||||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingProfiles.list() .then(({ shipping_profiles }) => { console.log(shipping_profiles.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "shipping_profiles": [
- {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}
Create a Shipping Profile
Create a Shipping Profile.
Authorizations:
Request Body schema: application/json
name required | string The name of the Shipping Profile |
type required | string Enum: "default" "gift_card" "custom" The type of the Shipping Profile |
Responses
Response Schema: application/json
required | object (Shipping Profile) A Shipping Profile has a set of defined Shipping Options that can be used to fulfill a given set of Products. For example, gift cards are shipped differently than physical products, so a shipping profile with the type | ||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "type": "default"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "shipping_profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Shipping Profile
Retrieve a Shipping Profile's details.
Authorizations:
path Parameters
id required | string The ID of the Shipping Profile. |
Responses
Response Schema: application/json
required | object (Shipping Profile) A Shipping Profile has a set of defined Shipping Options that can be used to fulfill a given set of Products. For example, gift cards are shipped differently than physical products, so a shipping profile with the type | ||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingProfiles.retrieve(profileId) .then(({ shipping_profile }) => { console.log(shipping_profile.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "shipping_profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Shipping Profile
Update a Shipping Profile's details.
Authorizations:
path Parameters
id required | string The ID of the Shipping Profile. |
Request Body schema: application/json
name | string The name of the Shipping Profile |
metadata | object An optional set of key-value pairs with additional information. |
type | string Enum: "default" "gift_card" "custom" The type of the Shipping Profile |
products | Array of arrays product IDs to associate with the Shipping Profile |
shipping_options | Array of arrays Shipping option IDs to associate with the Shipping Profile |
Responses
Response Schema: application/json
required | object (Shipping Profile) A Shipping Profile has a set of defined Shipping Options that can be used to fulfill a given set of Products. For example, gift cards are shipped differently than physical products, so a shipping profile with the type | ||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "metadata": { },
- "type": "default",
- "products": [ ],
- "shipping_options": [ ]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "shipping_profile": {
- "id": "sp_01G1G5V239ENSZ5MV4JAR737BM",
- "name": "Default Shipping Profile",
- "type": "default",
- "products": [
- { }
], - "shipping_options": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Shipping Profile
Delete a Shipping Profile. Associated shipping options are deleted as well.
Authorizations:
path Parameters
id required | string The ID of the Shipping Profile. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Shipping Profile. |
object required | string Default: "shipping_profile" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.shippingProfiles.delete(profileId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "shipping_profile",
- "deleted": true
}
A stock location, provided by the Stock Location module, indicates a physical address that stock-kept items, such as physical products, can be stored in. An admin can create and manage available stock locations.
List Stock Locations
Retrieve a list of stock locations. The stock locations can be filtered by fields such as name
or created_at
. The stock locations can also be sorted or paginated.
Authorizations:
query Parameters
id | string Filter by ID. |
name | string Filter by name. |
order | string A stock-location field to sort-order the retrieved stock locations by. |
object Filter by a creation date range. | |
object Filter by an update date range. | |
object Filter by a deletion date range. | |
offset | integer Default: 0 The number of stock locations to skip when retrieving the stock locations. |
limit | integer Default: 20 Limit the number of stock locations returned. |
expand | string Comma-separated relations that should be expanded in the returned stock locations. |
fields | string Comma-separated fields that should be included in the returned stock locations. |
Responses
Response Schema: application/json
required | Array of objects (StockLocationExpandedDTO) |
count required | integer The total number of items available |
offset required | integer The number of stock locations skipped when retrieving the stock locations. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.stockLocations.list() .then(({ stock_locations, limit, offset, count }) => { console.log(stock_locations.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "stock_locations": [
- {
- "id": "sloc_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_id": "laddr_05B2ZE853Y6FTXWPW85NJ81A44",
- "name": "Main Warehouse",
- "address": {
- "id": null,
- "address_1": null,
- "address_2": null,
- "company": null,
- "city": null,
- "country_code": null,
- "phone": null,
- "postal_code": null,
- "province": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "sales_channels": {
- "id": null,
- "name": null,
- "description": null,
- "is_disabled": null,
- "locations": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Stock Location
Create a Stock Location.
Authorizations:
query Parameters
expand | string Comma-separated relations that should be expanded in the returned stock location. |
fields | string Comma-separated fields that should be included in the returned stock location. |
Request Body schema: application/json
name required | string the name of the stock location |
address_id | string the ID of an existing stock location address to associate with the stock location. Only required if |
metadata | object Example: {"car":"white"} An optional key-value map with additional details |
object (Stock Location Address Input) Represents a Stock Location Address Input |
Responses
Response Schema: application/json
required | object (StockLocationExpandedDTO) Represents a Stock Location | ||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "address_id": "string",
- "metadata": {
- "car": "white"
}, - "address": {
- "address_1": "35, Jhon Doe Ave",
- "address_2": "apartment 4432",
- "city": "Mexico city",
- "country_code": "MX",
- "phone": "+1 555 61646",
- "postal_code": "HD3-1G8",
- "province": "Sinaloa",
- "metadata": {
- "car": "white"
}
}
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "stock_location": {
- "id": "sloc_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_id": "laddr_05B2ZE853Y6FTXWPW85NJ81A44",
- "name": "Main Warehouse",
- "address": {
- "id": "laddr_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_1": "35, Jhon Doe Ave",
- "address_2": "apartment 4432",
- "company": "Medusa",
- "city": "Mexico city",
- "country_code": "MX",
- "phone": "+1 555 61646",
- "postal_code": "HD3-1G8",
- "province": "Sinaloa",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "sales_channels": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
}
Get a Stock Location
Retrieve a Stock Location's details.
Authorizations:
path Parameters
id required | string The ID of the Stock Location. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned stock location. |
fields | string Comma-separated fields that should be included in the returned stock location. |
Responses
Response Schema: application/json
required | object (StockLocationExpandedDTO) Represents a Stock Location | ||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.stockLocations.retrieve(stockLocationId) .then(({ stock_location }) => { console.log(stock_location.id); });
Response samples
- 200
{- "stock_location": {
- "id": "sloc_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_id": "laddr_05B2ZE853Y6FTXWPW85NJ81A44",
- "name": "Main Warehouse",
- "address": {
- "id": "laddr_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_1": "35, Jhon Doe Ave",
- "address_2": "apartment 4432",
- "company": "Medusa",
- "city": "Mexico city",
- "country_code": "MX",
- "phone": "+1 555 61646",
- "postal_code": "HD3-1G8",
- "province": "Sinaloa",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "sales_channels": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
}
Update a Stock Location
Update a Stock Location's details.
Authorizations:
path Parameters
id required | string The ID of the Stock Location. |
query Parameters
expand | string Comma-separated relations that should be expanded in the returned stock location. |
fields | string Comma-separated fields that should be included in the returned stock location. |
Request Body schema: application/json
name | string the name of the stock location |
address_id | string the stock location address ID |
metadata | object Example: {"car":"white"} An optional key-value map with additional details |
object (Stock Location Address Input) Represents a Stock Location Address Input |
Responses
Response Schema: application/json
required | object (StockLocationExpandedDTO) Represents a Stock Location | ||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "address_id": "string",
- "metadata": {
- "car": "white"
}, - "address": {
- "address_1": "35, Jhon Doe Ave",
- "address_2": "apartment 4432",
- "city": "Mexico city",
- "country_code": "MX",
- "phone": "+1 555 61646",
- "postal_code": "HD3-1G8",
- "province": "Sinaloa",
- "metadata": {
- "car": "white"
}
}
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "stock_location": {
- "id": "sloc_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_id": "laddr_05B2ZE853Y6FTXWPW85NJ81A44",
- "name": "Main Warehouse",
- "address": {
- "id": "laddr_51G4ZW853Y6TFXWPG5ENJ81X42",
- "address_1": "35, Jhon Doe Ave",
- "address_2": "apartment 4432",
- "company": "Medusa",
- "city": "Mexico city",
- "country_code": "MX",
- "phone": "+1 555 61646",
- "postal_code": "HD3-1G8",
- "province": "Sinaloa",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "metadata": {
- "car": "white"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "sales_channels": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
}
Delete a Stock Location
Delete a Stock Location.
Authorizations:
path Parameters
id required | string The ID of the Stock Location. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Stock Location. |
object required | string Default: "stock_location" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.stockLocations.delete(stockLocationId) .then(({ id, object, deleted }) => { console.log(id) })
Response samples
- 200
- 400
{- "id": "string",
- "object": "stock_location",
- "deleted": true
}
A store indicates the general configurations and details about the commerce store. By default, there's only one store in the Medusa backend. Admins can manage the store and its details or configurations.
Get Store details
Retrieve the Store's details.
Authorizations:
Responses
Response Schema: application/json
required | object (ExtendedStoreDTO) A store holds the main settings of the commerce shop. By default, only one store is created and used within the Medusa backend. It holds settings related to the name of the store, available currencies, and more. | ||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.store.retrieve() .then(({ store }) => { console.log(store.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "store": {
- "id": "store_01G1G5V21KADXNGH29BJMAJ4B4",
- "name": "Medusa Store",
- "default_currency_code": "usd",
- "default_currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "currencies": [
- {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}
], - "swap_link_template": null,
- "payment_link_template": null,
- "invite_link_template": null,
- "default_location_id": null,
- "default_sales_channel_id": null,
- "default_sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}, - "payment_providers": {
- "id": "manual",
- "is_installed": true
}, - "fulfillment_providers": {
- "id": "manual",
- "is_installed": true
}, - "feature_flags": [
- {
- "key": null,
- "value": null
}
], - "modules": [
- {
- "module": null,
- "resolution": null
}
]
}
}
Update Store Details
Update the Store's details.
Authorizations:
Request Body schema: application/json
name | string The name of the Store |
swap_link_template | string Example: "http://example.com/swaps/{{cart_id}}" A template for Swap links - use |
payment_link_template | string Example: "http://example.com/payments/{{cart_id}}" A template for payment links - use |
invite_link_template | string Example: "http://example.com/invite?token={{invite_token}}" A template for invite links - use |
default_currency_code | |
currencies | Array of strings Array of available currencies in the store. Each currency is in 3 character ISO code format. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
required | object (Store) A store holds the main settings of the commerce shop. By default, only one store is created and used within the Medusa backend. It holds settings related to the name of the store, available currencies, and more. | ||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "default_currency_code": "string",
- "currencies": [
- "string"
], - "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "store": {
- "id": "store_01G1G5V21KADXNGH29BJMAJ4B4",
- "name": "Medusa Store",
- "default_currency_code": "usd",
- "default_currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "currencies": [
- {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}
], - "swap_link_template": null,
- "payment_link_template": null,
- "invite_link_template": null,
- "default_location_id": null,
- "default_sales_channel_id": null,
- "default_sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Add a Currency Code
Add a Currency Code to the available currencies in a store. This does not create new currencies, as currencies are defined within the Medusa backend. To create a currency, you can create a migration that inserts the currency into the database.
Authorizations:
path Parameters
code required |
Responses
Response Schema: application/json
required | object (Store) A store holds the main settings of the commerce shop. By default, only one store is created and used within the Medusa backend. It holds settings related to the name of the store, available currencies, and more. | ||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.store.addCurrency("eur") .then(({ store }) => { console.log(store.currencies); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "store": {
- "id": "store_01G1G5V21KADXNGH29BJMAJ4B4",
- "name": "Medusa Store",
- "default_currency_code": "usd",
- "default_currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "currencies": [
- {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}
], - "swap_link_template": null,
- "payment_link_template": null,
- "invite_link_template": null,
- "default_location_id": null,
- "default_sales_channel_id": null,
- "default_sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove a Currency
Remove a Currency Code from the available currencies in a store. This does not completely delete the currency and it can be added again later to the store.
Authorizations:
path Parameters
code required |
Responses
Response Schema: application/json
required | object (Store) A store holds the main settings of the commerce shop. By default, only one store is created and used within the Medusa backend. It holds settings related to the name of the store, available currencies, and more. | ||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.store.deleteCurrency("eur") .then(({ store }) => { console.log(store.currencies); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "store": {
- "id": "store_01G1G5V21KADXNGH29BJMAJ4B4",
- "name": "Medusa Store",
- "default_currency_code": "usd",
- "default_currency": {
- "code": "usd",
- "symbol": "$",
- "symbol_native": "$",
- "name": "US Dollar",
- "includes_tax": false
}, - "currencies": [
- {
- "code": null,
- "symbol": null,
- "symbol_native": null,
- "name": null,
- "includes_tax": null
}
], - "swap_link_template": null,
- "payment_link_template": null,
- "invite_link_template": null,
- "default_location_id": null,
- "default_sales_channel_id": null,
- "default_sales_channel": {
- "id": "sc_01G8X9A7ESKAJXG2H0E6F1MW7A",
- "name": "Market",
- "description": "Multi-vendor market",
- "is_disabled": false,
- "locations": [
- null
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
List Payment Providers
Retrieve a list of available Payment Providers in a store.
Authorizations:
Responses
Response Schema: application/json
required | Array of objects (Payment Provider) An array of payment providers details. | ||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.store.listPaymentProviders() .then(({ payment_providers }) => { console.log(payment_providers.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "payment_providers": [
- {
- "id": "manual",
- "is_installed": true
}
]
}
List Tax Providers
Retrieve a list of available Tax Providers in a store.
Authorizations:
Responses
Response Schema: application/json
required | Array of objects (Tax Provider) An array of tax providers details. | ||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.store.listTaxProviders() .then(({ tax_providers }) => { console.log(tax_providers.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tax_providers": [
- {
- "id": "manual",
- "is_installed": true
}
]
}
A swap is created by a customer or an admin to exchange an item with a new one. Creating a swap implicitely includes creating a return for the item being exchanged.
List Swaps
Retrieve a list of Swaps. The swaps can be paginated.
Authorizations:
query Parameters
limit | number Default: "50" Limit the number of swaps returned. |
offset | number Default: "0" The number of swaps to skip when retrieving the swaps. |
Responses
Response Schema: application/json
required | Array of objects (Swap) An array of swaps details. |
count required | integer The total number of items available |
offset required | integer The number of swaps skipped when retrieving the swaps. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.swaps.list() .then(({ swaps }) => { console.log(swaps.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "swaps": [
- {
- "id": "swap_01F0YET86Y9G92D3YDR9Y6V676",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "additional_items": [
- null
], - "return_order": { },
- "fulfillments": [
- { }
], - "payment": { },
- "difference_due": 0,
- "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": null,
- "customer_id": null,
- "customer": { },
- "company": null,
- "first_name": null,
- "last_name": null,
- "address_1": null,
- "address_2": null,
- "city": null,
- "country_code": null,
- "country": null,
- "province": null,
- "postal_code": null,
- "phone": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}, - "shipping_methods": [
- null
], - "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "confirmed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "allow_backorder": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Get a Swap
Retrieve a Swap's details.
Authorizations:
path Parameters
id required | string The ID of the Swap. |
Responses
Response Schema: application/json
required | object (Swap) A swap can be created when a Customer wishes to exchange Products that they have purchased with different Products. It consists of a Return of previously purchased Products and a Fulfillment of new Products. It also includes information on any additional payment or refund required based on the difference between the exchanged products. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.swaps.retrieve(swapId) .then(({ swap }) => { console.log(swap.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "swap": {
- "id": "swap_01F0YET86Y9G92D3YDR9Y6V676",
- "fulfillment_status": "not_fulfilled",
- "payment_status": "not_paid",
- "order_id": "order_01G8TJSYT9M6AVS5N4EMNFS1EK",
- "order": { },
- "additional_items": [
- {
- "id": null,
- "cart_id": null,
- "cart": { },
- "order_id": null,
- "order": { },
- "swap_id": null,
- "swap": { },
- "claim_order_id": null,
- "claim_order": { },
- "tax_lines": [ ],
- "adjustments": [ ],
- "original_item_id": null,
- "order_edit_id": null,
- "order_edit": { },
- "title": null,
- "description": null,
- "thumbnail": null,
- "is_return": null,
- "is_giftcard": null,
- "should_merge": null,
- "allow_discounts": null,
- "has_shipping": null,
- "unit_price": null,
- "variant_id": null,
- "variant": null,
- "quantity": null,
- "fulfilled_quantity": null,
- "returned_quantity": null,
- "shipped_quantity": null,
- "refundable": null,
- "subtotal": null,
- "tax_total": null,
- "total": null,
- "original_total": null,
- "original_tax_total": null,
- "discount_total": null,
- "raw_discount_total": null,
- "gift_card_total": null,
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "metadata": { }
}
], - "return_order": { },
- "fulfillments": [
- { }
], - "payment": { },
- "difference_due": 0,
- "shipping_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
- "shipping_address": {
- "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
- "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
- "customer": { },
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "country": {
- "id": null,
- "iso_2": null,
- "iso_3": null,
- "num_code": null,
- "name": null,
- "display_name": null,
- "region_id": null,
- "region": { }
}, - "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}, - "shipping_methods": [
- {
- "id": null,
- "shipping_option_id": null,
- "order_id": null,
- "order": { },
- "claim_order_id": null,
- "claim_order": { },
- "cart_id": null,
- "cart": { },
- "swap_id": null,
- "swap": { },
- "return_id": null,
- "return_order": { },
- "shipping_option": null,
- "tax_lines": [ ],
- "price": null,
- "data": { },
- "includes_tax": null,
- "subtotal": null,
- "total": null,
- "tax_total": null
}
], - "cart_id": "cart_01G8ZH853Y6TFXWPG5EYE81X63",
- "cart": { },
- "confirmed_at": "2019-08-24T14:15:22Z",
- "canceled_at": "2019-08-24T14:15:22Z",
- "no_notification": false,
- "allow_backorder": false,
- "idempotency_key": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Each region has at least a default tax rate. Admins can create and manage additional tax rates that can be applied for certain conditions, such as for specific product types.
List Tax Rates
Retrieve a list of Tax Rates. The tax rates can be filtered by fields such as name
or rate
. The tax rates can also be paginated.
Authorizations:
query Parameters
name | string Filter by name. |
string or Array of strings Filter by Region IDs | |
code | string Filter by code. |
number or object Filter by Rate | |
offset | integer Default: 0 The number of tax rates to skip when retrieving the tax rates. |
limit | integer Default: 50 Limit the number of tax rates returned. |
fields | Array of strings Comma-separated fields that should be included in the returned tax rate. |
expand | Array of strings Comma-separated relations that should be expanded in the returned tax rate. |
Responses
Response Schema: application/json
required | Array of objects (Tax Rate) An array of tax rate details. |
count required | integer The total number of items available |
offset required | integer The number of tax rates to skip when retrieving the tax rates. |
limit required | integer The number of items per page |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.taxRates.list() .then(({ tax_rates, limit, offset, count }) => { console.log(tax_rates.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tax_rates": [
- {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- null
], - "product_types": [
- null
], - "shipping_options": [
- null
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create a Tax Rate
Create a Tax Rate.
Authorizations:
query Parameters
fields | Array of strings Comma-separated fields that should be included in the returned tax rate. |
expand | Array of strings Comma-separated relations that should be expanded in the returned tax rate. |
Request Body schema: application/json
code required | string The code of the tax rate. |
name required | string The name of the tax rate. |
region_id required | string The ID of the Region that the tax rate belongs to. |
rate | number The numeric rate to charge. |
products | Array of strings The IDs of the products associated with this tax rate. |
shipping_options | Array of strings The IDs of the shipping options associated with this tax rate |
product_types | Array of strings The IDs of the types of products associated with this tax rate |
Responses
Response Schema: application/json
required | object (Tax Rate) A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region. | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "code": "string",
- "name": "string",
- "region_id": "string",
- "rate": 0,
- "products": [
- "string"
], - "shipping_options": [
- "string"
], - "product_types": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "profiles": [ ],
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a Tax Rate
Retrieve a Tax Rate's details.
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Comma-separated fields that should be included in the returned tax rate. |
expand | Array of strings Comma-separated relations that should be expanded in the returned tax rate. |
Responses
Response Schema: application/json
required | object (Tax Rate) A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region. | ||||||||||||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.taxRates.retrieve(taxRateId) .then(({ tax_rate }) => { console.log(tax_rate.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "profiles": [ ],
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a Tax Rate
Update a Tax Rate's details.
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Comma-separated fields that should be included in the returned tax rate. |
expand | Array of strings Comma-separated relations that should be expanded in the returned tax rate. |
Request Body schema: application/json
code | string The code of the tax rate. |
name | string The name of the tax rate. |
region_id | string The ID of the Region that the tax rate belongs to. |
rate | number The numeric rate to charge. |
products | Array of strings The IDs of the products associated with this tax rate |
shipping_options | Array of strings The IDs of the shipping options associated with this tax rate |
product_types | Array of strings The IDs of the types of product types associated with this tax rate |
Responses
Response Schema: application/json
required | object (Tax Rate) A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region. | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "code": "string",
- "name": "string",
- "region_id": "string",
- "rate": 0,
- "products": [
- "string"
], - "shipping_options": [
- "string"
], - "product_types": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "profiles": [ ],
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Tax Rate
Delete a Tax Rate. Resources associated with the tax rate, such as products or product types, are not deleted.
Authorizations:
path Parameters
id required | string The ID of the Shipping Option. |
Responses
Response Schema: application/json
id required | string The ID of the deleted Shipping Option. |
object required | string Default: "tax-rate" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.taxRates.delete(taxRateId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "tax-rate",
- "deleted": true
}
Add to Product Types
Associates a Tax Rate with a list of Product Types
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Comma-separated fields that should be included in the returned tax rate. |
expand | Array of strings Comma-separated relations that should be expanded in the returned tax rate. |
Request Body schema: application/json
product_types required | Array of strings The IDs of the types of products to associate with this tax rate |
Responses
Response Schema: application/json
required | object (Tax Rate) A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region. | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "product_types": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "profiles": [ ],
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Product Types from Rate
Remove product types from a tax rate. This only removes the association between the product types and the tax rate. It does not delete the product types.
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Comma-separated fields that should be included in the returned tax rate. |
expand | Array of strings Comma-separated relations that should be expanded in the returned tax rate. |
Request Body schema: application/json
product_types required | Array of strings The IDs of the product types to remove their association with this tax rate. |
Responses
Response Schema: application/json
required | object (Tax Rate) A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region. | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "product_types": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "profiles": [ ],
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Add to Products
Associates a Tax Rate with a list of Products.
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Comma-separated fields that should be included in the returned tax rate. |
expand | Array of strings Comma-separated relations that should be expanded in the returned tax rate. |
Request Body schema: application/json
products required | Array of strings The IDs of the products to associate with this tax rate |
Responses
Response Schema: application/json
required | object (Tax Rate) A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region. | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "products": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "profiles": [ ],
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Products from Rate
Remove products from a tax rate. This only removes the association between the products and the tax rate. It does not delete the products.
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Comma-separated fields that should be included in the returned tax rate. |
expand | Array of strings Comma-separated relations that should be expanded in the returned tax rate. |
Request Body schema: application/json
products required | Array of strings The IDs of the products to remove their association with this tax rate. |
Responses
Response Schema: application/json
required | object (Tax Rate) A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region. | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "products": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "profiles": [ ],
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Add to Shipping Options
Associates a Tax Rate with a list of Shipping Options.
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Comma-separated fields that should be included in the returned tax rate. |
expand | Array of strings Comma-separated relations that should be expanded in the returned tax rate. |
Request Body schema: application/json
shipping_options required | Array of strings The IDs of the shipping options to associate with this tax rate |
Responses
Response Schema: application/json
required | object (Tax Rate) A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region. | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "shipping_options": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "profiles": [ ],
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Remove Shipping Options from Rate
Remove shipping options from a tax rate. This only removes the association between the shipping options and the tax rate. It does not delete the shipping options.
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Comma-separated fields that should be included in the returned tax rate. |
expand | Array of strings Comma-separated relations that should be expanded in the returned tax rate. |
Request Body schema: application/json
shipping_options required | Array of strings The IDs of the shipping options to remove their association with this tax rate. |
Responses
Response Schema: application/json
required | object (Tax Rate) A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region. | ||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "shipping_options": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "tax_rate": {
- "id": "txr_01G8XDBAWKBHHJRKH0AV02KXBR",
- "rate": 10,
- "code": "tax01",
- "name": "Tax Example",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "region": { },
- "products": [
- {
- "id": null,
- "title": null,
- "subtitle": null,
- "description": null,
- "handle": null,
- "is_giftcard": null,
- "status": null,
- "images": [ ],
- "thumbnail": null,
- "options": [ ],
- "variants": [ ],
- "categories": [ ],
- "profile_id": null,
- "profile": null,
- "profiles": [ ],
- "weight": null,
- "length": null,
- "height": null,
- "width": null,
- "hs_code": null,
- "origin_country": null,
- "mid_code": null,
- "material": null,
- "collection_id": null,
- "collection": null,
- "type_id": null,
- "type": null,
- "tags": [ ],
- "discountable": null,
- "external_id": null,
- "sales_channels": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_types": [
- {
- "id": null,
- "value": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "shipping_options": [
- {
- "id": null,
- "name": null,
- "region_id": null,
- "region": { },
- "profile_id": null,
- "profile": null,
- "provider_id": null,
- "provider": null,
- "price_type": null,
- "amount": null,
- "is_return": null,
- "admin_only": null,
- "requirements": [ ],
- "data": { },
- "includes_tax": null,
- "created_at": null,
- "updated_at": null,
- "deleted_at": null,
- "metadata": { }
}
], - "product_count": 10,
- "product_type_count": 2,
- "shipping_option_count": 1,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
The upload endpoints are used to upload any type of resources. For example, they can be used to upload CSV files that are used to import products into the store.
Upload Files
Upload at least one file to a public bucket or storage. The file upload is handled by the file service installed on the Medusa backend.
Authorizations:
Request Body schema: multipart/form-data
files | string <binary> |
Responses
Response Schema: application/json
required | Array of objects Uploaded files details. | ||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.uploads.create(file) .then(({ uploads }) => { console.log(uploads.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{
}
Delete an Uploaded File
Delete an uploaded file from storage. The file is deleted using the installed file service on the Medusa backend.
Authorizations:
Request Body schema: application/json
file_key required | string key of the file to delete |
Responses
Response Schema: application/json
id required | string The file key of the upload deleted |
object required | string Default: "file" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- Payload
- JS Client
- cURL
{- "file_key": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "file",
- "deleted": true
}
Get a File's Download URL
Create and retrieve a presigned or public download URL for a file. The URL creation is handled by the file service installed on the Medusa backend.
Authorizations:
Request Body schema: application/json
file_key required | string key of the file to obtain the download link for |
Responses
Response Schema: application/json
download_url required | string The Download URL of the file |
Request samples
- Payload
- JS Client
- cURL
{- "file_key": "string"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "download_url": "string"
}
Protected File Upload
Upload at least one file to an ACL or a non-public bucket. The file upload is handled by the file service installed on the Medusa backend.
Authorizations:
Request Body schema: multipart/form-data
files | string <binary> |
Responses
Response Schema: application/json
required | Array of objects Uploaded files details. | ||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.uploads.createProtected(file) .then(({ uploads }) => { console.log(uploads.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{
}
A store can have more than one user, each having the same privileges. Admins can manage users, their passwords, and more.
List Users
Retrieve all admin users.
Authorizations:
Responses
Response Schema: application/json
required | Array of objects (User) An array of users details. | ||||||||||||||||||||
Array
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.users.list() .then(({ users }) => { console.log(users.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "users": [
- {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
]
}
Create a User
Create an admin User. The user has the same privileges as all admin users, and will be able to authenticate and perform admin functionalities right after creation.
Authorizations:
Request Body schema: application/json
email required | string <email> The User's email. |
password required | string <password> The User's password. |
first_name | string The first name of the User. |
last_name | string The last name of the User. |
role | string Enum: "admin" "member" "developer" The role assigned to the user. These roles don't provide any different privileges. |
Responses
Response Schema: application/json
required | object (User) A User is an administrator who can manage store settings and data. | ||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "email": "user@example.com",
- "first_name": "string",
- "last_name": "string",
- "role": "admin",
- "password": "pa$$word"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Request Password Reset
Generate a password token for an admin user with a given email.
Authorizations:
Request Body schema: application/json
email required | string <email> The User's email. |
Responses
Request samples
- Payload
- JS Client
- cURL
{- "email": "user@example.com"
}
Response samples
- 400
- 404
- 409
- 422
- 500
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}
Reset Password
Reset the password of an admin User using their reset password token. A user must request to reset their password first before attempting to reset their password with this request.
Authorizations:
Request Body schema: application/json
token required | string The password-reset token generated when the password reset was requested. |
password required | string <password> The User's new password. |
string <email> The User's email. |
Responses
Response Schema: application/json
required | object (User) A User is an administrator who can manage store settings and data. | ||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "email": "user@example.com",
- "token": "string",
- "password": "pa$$word"
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get a User
Retrieve an admin user's details.
Authorizations:
path Parameters
id required | string The ID of the User. |
Responses
Response Schema: application/json
required | object (User) A User is an administrator who can manage store settings and data. | ||||||||||||||||||||
|
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.users.retrieve(userId) .then(({ user }) => { console.log(user.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update a User
Update an admin user's details.
Authorizations:
path Parameters
id required | string The ID of the User. |
Request Body schema: application/json
first_name | string The first name of the User. |
last_name | string The last name of the User. |
role | string Enum: "admin" "member" "developer" The role assigned to the user. These roles don't provide any different privileges. |
api_token | string The API token of the User. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
required | object (User) A User is an administrator who can manage store settings and data. | ||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "first_name": "string",
- "last_name": "string",
- "role": "admin",
- "api_token": "string",
- "metadata": { }
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "user": {
- "id": "usr_01G1G5V26F5TB3GPAPNJ8X1S3V",
- "role": "admin",
- "email": "user@example.com",
- "first_name": "Levi",
- "last_name": "Bogan",
- "api_token": null,
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a User
Delete a User. Once deleted, the user will not be able to authenticate or perform admin functionalities.
Authorizations:
path Parameters
id required | string The ID of the User. |
Responses
Response Schema: application/json
id required | string The ID of the deleted user. |
object required | string Default: "user" The type of the object that was deleted. |
deleted required | boolean Default: true Whether or not the items were deleted. |
Request samples
- JS Client
- cURL
import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.users.delete(userId) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "user",
- "deleted": true
}