Medusa Admin API (1.0.0)
API reference for Medusa's Admin endpoints. All endpoints are prefixed with /admin
.
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
.
Generate Token for App
Generates a token for an application.
Authorizations:
Request Body schema: application/json
application_name required | string Name of the application for the token to be generated for. |
state required | string State of the application. |
code required | string The code for the generated token. |
Responses
Response Schema: application/json
object (OAuth) Represent an OAuth app | |||||||||||||
|
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": { }
}
}
List Applications
Retrieve a list of applications.
Authorizations:
Responses
Response Schema: application/json
Array of objects (OAuth) | |||||||||||||
Array
|
Request samples
- cURL
curl --location --request GET 'https://medusa-url.com/admin/apps' \ --header 'Authorization: Bearer {api_token}'
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "apps": [
- {
- "id": "example_app",
- "display_name": "Example app",
- "application_name": "example",
- "data": { }
}
]
}
User Login
Logs a User in and authorizes them to manage Store settings.
Request Body schema: application/json
email required | string The User's email. |
password required | string The User's password. |
Responses
Response Schema: application/json
object (User) Represents a User who can manage store settings. | |||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "email": "string",
- "password": "string"
}
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
Deletes the current session for the logged in user.
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 or use api token medusa.admin.auth.deleteSession()
Response samples
- 400
- 404
- 409
- 422
- 500
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}
Get Current User
Gets the currently logged in User.
Authorizations:
Responses
Response Schema: application/json
object (User) Represents a User who can manage store settings. | |||||||||||||||||||||
|
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"
}
}
}
Cancel a Batch Job
Marks a batch job as canceled
Authorizations:
path Parameters
id required | string The ID of the batch job. |
Responses
Response Schema: application/json
object (Batch Job) A Batch Job. | |||||||||||||||||||||||||||||||||||
|
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(batch_job_id) .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
Confirms that a previously requested batch job should be executed.
Authorizations:
path Parameters
id required | string The ID of the batch job. |
Responses
Response Schema: application/json
object (Batch Job) A Batch Job. | |||||||||||||||||||||||||||||||||||
|
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(batch_job_id) .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"
}
}
Create a Batch Job
Creates a Batch Job.
Authorizations:
Request Body schema: application/json
type required | string Example: "product-export" The type of batch job to start. |
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 to get some information on what will be done without applying any modifications. |
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"
}
}
List Batch Jobs
Retrieve a list of Batch Jobs.
Authorizations:
query Parameters
limit | integer Default: 10 The number of batch jobs to return. |
offset | integer Default: 0 The number of batch jobs to skip before results. |
string or Array of strings Filter by the batch ID | |
type | Array of strings Filter by the batch type |
object Date comparison for when resulting collections was confirmed, i.e. less than, greater than etc. | |
object Date comparison for when resulting collections was pre processed, i.e. less than, greater than etc. | |
object Date comparison for when resulting collections was completed, i.e. less than, greater than etc. | |
object Date comparison for when resulting collections was failed, i.e. less than, greater than etc. | |
object Date comparison for when resulting collections was canceled, i.e. less than, greater than etc. | |
order | string Field used to order retrieved batch jobs |
expand | string (Comma separated) Which fields should be expanded in each order of the result. |
fields | string (Comma separated) Which fields should be included in each order of the result. |
object Date comparison for when resulting collections was created, i.e. less than, greater than etc. | |
object Date comparison for when resulting collections was updated, i.e. less than, greater than etc. |
Responses
Response Schema: application/json
Array of objects (Batch Job) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Get a Batch Job
Retrieves a Batch Job.
Authorizations:
path Parameters
id required | string The ID of the Batch Job |
Responses
Response Schema: application/json
object (Batch Job) A Batch Job. | |||||||||||||||||||||||||||||||||||
|
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(batch_job_id) .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 Claim
Cancels a Claim
Authorizations:
path Parameters
id required | string The ID of the Order. |
claim_id required | string The ID of the Claim. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Responses
Response Schema: application/json
object (Order) Represents 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.orders.cancelClaim(order_id, claim_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 Claim Shipment
Registers a Claim Fulfillment as shipped.
Authorizations:
path Parameters
id required | string The ID of the Order. |
claim_id required | string The ID of the Claim. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
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. |
Responses
Response Schema: application/json
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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
Creates a Claim.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
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. | |
Array of objects The new items to send to the Customer when the Claim type is Replace. | |
Array of objects The Shipping Methods to send the additional Line Items with. | |
object (Address) An address. | |
refund_amount | integer The amount to refund the Customer when the Claim 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
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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": {
- "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": 109,
- "iso_2": "it",
- "iso_3": "ita",
- "num_code": 380,
- "name": "ITALY",
- "display_name": "Italy",
- "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
- "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"
}
}, - "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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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
Updates a Claim.
Authorizations:
path Parameters
id required | string The ID of the Order. |
claim_id required | string The ID of the Claim. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
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
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 Products
Updates products associated with a Product Collection
Authorizations:
path Parameters
id required | string The ID of the 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
object (Product Collection) Product Collections represents a group of Products that are related. | |||||||||||||||||
|
Request samples
- Payload
- 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 Product
Removes products associated with a Product Collection
Authorizations:
path Parameters
id required | string The ID of the 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 | string The ID of the collection |
object | string Default: "product-collection" The type of object the removal was executed on |
removed_products | Array of strings The IDs of the products removed from the collection |
Request samples
- Payload
- cURL
{- "product_ids": [
- "string"
]
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "product-collection",
- "removed_products": [
- "string"
]
}
Create a Collection
Creates a Product Collection.
Authorizations:
Request Body schema: application/json
title required | string The title to identify the Collection by. |
handle | string An optional handle to be used in slugs, if none is provided we will kebab-case the title. |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
object (Product Collection) Product Collections represents a group of Products that are related. | |||||||||||||||||
|
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"
}
}
}
List Collections
Retrieve a list of Product Collection.
Authorizations:
query Parameters
limit | integer Default: 10 The number of collections to return. |
offset | integer Default: 0 The number of collections to skip before the results. |
title | string The title of collections to return. |
handle | string The handle of collections to return. |
q | string a search term to search titles and handles. |
discount_condition_id | string The discount condition id on which to filter the product collections. |
object Date comparison for when resulting collections were created. | |
object Date comparison for when resulting collections were updated. | |
object Date comparison for when resulting collections were deleted. |
Responses
Response Schema: application/json
Array of objects (Product Collection) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Delete a Collection
Deletes a Product Collection.
Authorizations:
path Parameters
id required | string The ID of the Collection. |
Responses
Response Schema: application/json
id | string The ID of the deleted Collection |
object | string Default: "product-collection" The type of the object that was deleted. |
deleted | 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(collection_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "product-collection",
- "deleted": true
}
Get a Collection
Retrieves a Product Collection.
Authorizations:
path Parameters
id required | string The ID of the Product Collection |
Responses
Response Schema: application/json
object (Product Collection) Product Collections represents a group of Products that are related. | |||||||||||||||||
|
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(collection_id) .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
Updates a Product Collection.
Authorizations:
path Parameters
id required | string The ID of the Collection. |
Request Body schema: application/json
title | string The title to identify the Collection by. |
handle | string An optional handle to be used in slugs, if none is provided we will kebab-case the title. |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
object (Product Collection) Product Collections represents a group of Products that are related. | |||||||||||||||||
|
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"
}
}
}
List Currency
Retrieves a list of Currency
query Parameters
code | string Code of the currency to search for. |
includes_tax | boolean Search for tax inclusive currencies. |
order | string order to retrieve products in. |
offset | number Default: "0" How many products to skip in the result. |
limit | number Default: "20" Limit the number of products returned. |
Responses
Response Schema: application/json
Array of objects (Currency) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
path Parameters
code required | string The code of the Currency. |
Request Body schema: application/json
includes_tax | boolean [EXPERIMENTAL] Tax included in prices of currency. |
Responses
Response Schema: application/json
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
}
}
Create a Customer
Creates 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"
}
}
}
List Customers
Retrieves a list of Customers.
Authorizations:
query Parameters
limit | integer Default: 50 The number of items to return. |
offset | integer Default: 0 The items to skip before result. |
expand | string (Comma separated) Which fields should be expanded in each customer. |
q | string a search term to search email, first_name, and last_name. |
Responses
Response Schema: application/json
Array of objects (Customer) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Get a Customer
Retrieves a Customer.
Authorizations:
path Parameters
id required | string The ID of the Customer. |
query Parameters
expand | string (Comma separated) Which fields should be expanded in the customer. |
fields | string (Comma separated) Which fields should be included in the customer. |
Responses
Response Schema: application/json
object (Customer) Represents a customer | |||||||||||||||||||||||||||||||
|
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(customer_id) .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
Updates a Customer.
Authorizations:
path Parameters
id required | string The ID of the Customer. |
query Parameters
expand | string (Comma separated) Which fields should be expanded in each customer. |
fields | string (Comma separated) Which fields should be retrieved in each 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
object (Customer) Represents a customer | |||||||||||||||||||||||||||||||
|
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"
}
}
}
Add Customers
Adds a list of customers, represented by id's, 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
object (Customer Group) Represents a customer group | |||||||||||||||||
|
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
Removes a list of customers, represented by id's, from 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 remove | ||
Array
|
Responses
Response Schema: application/json
object (Customer Group) Represents a customer group | |||||||||||||||||
|
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"
}
}
}
Create a Customer Group
Creates a CustomerGroup.
Authorizations:
Request Body schema: application/json
name required | string Name of the customer group |
metadata | object Metadata for the customer. |
Responses
Response Schema: application/json
object (Customer Group) Represents a customer group | |||||||||||||||||
|
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"
}
}
}
List Customer Groups
Retrieve a list of customer groups.
Authorizations:
query Parameters
q | string Query used for searching customer group names. |
offset | integer Default: 0 How many groups to skip in the result. |
order | string the field used to order the customer groups. |
discount_condition_id | string The discount condition id on which to filter the customer groups. |
string or Array of strings or object Filter by the customer group ID | |
name | Array of strings Filter by the customer group name |
object Date comparison for when resulting customer groups were created. | |
object Date comparison for when resulting customer groups were updated. | |
limit | integer Default: 10 Limit the number of customer groups returned. |
expand | string (Comma separated) Which fields should be expanded in each customer groups of the result. |
Responses
Response Schema: application/json
Array of objects (Customer Group) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Delete a Customer Group
Deletes a CustomerGroup.
Authorizations:
path Parameters
id required | string The ID of the Customer Group |
Responses
Response Schema: application/json
id | string The ID of the deleted customer group. |
object | string Default: "customer_group" The type of the object that was deleted. |
deleted | 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(customer_group_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "customer_group",
- "deleted": true
}
Get a Customer Group
Retrieves a Customer Group.
Authorizations:
path Parameters
id required | string The ID of the Customer Group. |
query Parameters
expand | string (Comma separated) Which fields should be expanded in the customer group. |
fields | string (Comma separated) Which fields should be included in the customer group. |
Responses
Response Schema: application/json
object (Customer Group) Represents a customer group | |||||||||||||||||
|
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(customer_group_id) .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 CustomerGroup.
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 for the customer. |
Responses
Response Schema: application/json
object (Customer Group) Represents a customer group | |||||||||||||||||
|
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"
}
}
}
List Customers
Retrieves a list of customers in a customer group
Authorizations:
path Parameters
id required | string The ID of the customer group. |
query Parameters
limit | integer Default: 50 The number of items to return. |
offset | integer Default: 0 The items to skip before result. |
expand | string (Comma separated) Which fields should be expanded in each customer. |
q | string a search term to search email, first_name, and last_name. |
Responses
Response Schema: application/json
Array of objects (Customer) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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(customer_group_id) .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 Region
Adds a Region to the list of Regions that 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
object (Discount) Represents a discount that 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(discount_id, region_id) .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
Removes a Region from the list of Regions that 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
object (Discount) Represents a discount that 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(discount_id, region_id) .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"
}
}
}
Creates a Discount
Creates a Discount with a given set of rules that define how the Discount behaves.
Authorizations:
query Parameters
expand | string (Comma separated) Which fields should be expanded in the results. |
fields | string (Comma separated) Which fields should be retrieved in the results. |
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 codes that all have to follow a common set of rules. |
is_disabled | boolean Default: false Whether the Discount code is disabled on creation. You will have to enable it later to make it available to Customers. |
starts_at | string <date-time> The time at which the Discount should be available. |
ends_at | string <date-time> The time at which the Discount should no longer be available. |
valid_duration | string Example: "P3Y6M4DT12H30M5S" Duration the discount runs between |
usage_limit | number Maximum times the discount can be used |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
object (Discount) Represents a discount that 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"
}
}
}
List Discounts
Retrieves a list of Discounts
Authorizations:
query Parameters
q | string Search query applied on the code field. |
object Discount Rules filters to apply on the search | |
is_dynamic | boolean Return only dynamic discounts. |
is_disabled | boolean Return only disabled discounts. |
limit | number Default: "20" The number of items in the response |
offset | number Default: "0" The offset of items in response |
expand | string Comma separated list of relations to include in the results. |
Responses
Response Schema: application/json
Array of objects (Discount) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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 Dynamic Code
Creates a dynamic unique code that can map to a parent Discount. This is useful if you want to automatically generate codes with the same behaviour.
Authorizations:
path Parameters
id required | string The ID of the Discount to create the dynamic code from." |
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 times the discount can be used |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
object (Discount) Represents a discount that 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"
}
}
}
Update a Condition
Updates a DiscountCondition. Only one of products
, product_types
, product_collections
, product_tags
, and customer_groups
should be provided.
Authorizations:
path Parameters
discount_id required | string The ID of the Product. |
condition_id required | string The ID of the DiscountCondition. |
query Parameters
expand | string (Comma separated) Which fields should be expanded in each item of the result. |
fields | string (Comma separated) Which fields should be included in each item of the result. |
Request Body schema: application/json
products | Array of strings list of product IDs if the condition is applied on products. |
product_types | Array of strings list of product type IDs if the condition is applied on product types. |
product_collections | Array of strings list of product collection IDs if the condition is applied on product collections. |
product_tags | Array of strings list of product tag IDs if the condition is applied on product tags. |
customer_groups | Array of strings list of customer group IDs if the condition is applied on customer groups. |
Responses
Response Schema: application/json
object (Discount) Represents a discount that 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 Discount
Deletes a Discount.
Authorizations:
path Parameters
id required | string The ID of the Discount |
Responses
Response Schema: application/json
id | string The ID of the deleted Discount |
object | string Default: "discount" The type of the object that was deleted. |
deleted | boolean Default: true Whether the discount 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.discounts.delete(discount_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "discount",
- "deleted": true
}
Get a Discount
Retrieves a Discount
Authorizations:
path Parameters
id required | string The ID of the Discount |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
object (Discount) Represents a discount that 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(discount_id) .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
Updates a Discount with a given set of rules that define how the Discount behaves.
Authorizations:
path Parameters
id required | string The ID of the Discount. |
query Parameters
expand | string (Comma separated) Which fields should be expanded in each item of the result. |
fields | string (Comma separated) Which fields should be included in each item of the result. |
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. You will have to enable it later to make it available to Customers. |
starts_at | string <date-time> The time at which the Discount should be available. |
ends_at | string <date-time> The time at which the Discount should no longer be available. |
valid_duration | string Example: "P3Y6M4DT12H30M5S" Duration the discount runs between |
usage_limit | number Maximum 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
object (Discount) Represents a discount that 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 Dynamic Code
Deletes a dynamic code from a Discount.
Authorizations:
path Parameters
id required | string The ID of the Discount |
code required | string The ID of the Discount |
Responses
Response Schema: application/json
object (Discount) Represents a discount that 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(discount_id, 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"
}
}
}
Get Discount by Code
Retrieves a Discount by its discount code
Authorizations:
path Parameters
code required | string The code of the Discount |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
object (Discount) Represents a discount that 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"
}
}
}
Add Batch Resources
Add a batch of resources to a discount condition.
Authorizations:
path Parameters
discount_id required | string The ID of the Product. |
condition_id required | string The ID of the condition on which to add the item. |
query Parameters
expand | string (Comma separated) Which relations should be expanded in each discount of the result. |
fields | string (Comma separated) Which fields should be included in each discount of the result. |
Request Body schema: application/json
required | Array of objects The resources to be added to the discount condition | ||
Array
|
Responses
Response Schema: application/json
object (Discount) Represents a discount that 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"
}
}
}
Delete Batch Resources
Delete a batch of resources from a discount condition.
Authorizations:
path Parameters
discount_id required | string The ID of the Product. |
condition_id required | string The ID of the condition on which to add the item. |
query Parameters
expand | string (Comma separated) Which relations should be expanded in each discount of the result. |
fields | string (Comma separated) Which fields should be included in each discount of the result. |
Request Body schema: application/json
required | Array of objects The resources to be deleted from the discount condition | ||
Array
|
Responses
Response Schema: application/json
object (Discount) Represents a discount that 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"
}
}
}
Create a Condition
Creates a DiscountCondition. Only one of products
, product_types
, product_collections
, product_tags
, and customer_groups
should be provided.
Authorizations:
path Parameters
discount_id required | string The ID of the Product. |
query Parameters
expand | string (Comma separated) Which fields should be expanded in each product of the result. |
fields | string (Comma separated) Which fields should be included in each product of the result. |
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 is applied on products. |
product_types | Array of strings list of product type IDs if the condition is applied on product types. |
product_collections | Array of strings list of product collection IDs if the condition is applied on product collections. |
product_tags | Array of strings list of product tag IDs if the condition is applied on product tags. |
customer_groups | Array of strings list of customer group IDs if the condition is applied on customer groups. |
Responses
Response Schema: application/json
object (Discount) Represents a discount that 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"
}
}
}
Delete a Condition
Deletes a DiscountCondition
Authorizations:
path Parameters
discount_id required | string The ID of the Discount |
condition_id required | string The ID of the DiscountCondition |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
id | string The ID of the deleted DiscountCondition |
object | string Default: "discount-condition" The type of the object that was deleted. |
deleted | boolean Default: true Whether the discount condition was deleted successfully or not. |
object (Discount) Represents a discount that 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(discount_id, condition_id) .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"
}
}
}
Get a Condition
Gets a DiscountCondition
Authorizations:
path Parameters
discount_id required | string The ID of the Discount. |
condition_id required | string The ID of the DiscountCondition. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
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(discount_id, condition_id) .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,
- "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"
}
}
}
Create a Draft Order
Creates a Draft Order
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 |
Address Fields (object) or string The Address to be used for billing purposes. | |
Address Fields (object) or string The Address to be used for shipping. | |
Array of objects The Line Items that have been received. | |
Array of objects The discounts to add on the draft order | |
customer_id | string The ID of the customer to add on the draft order |
no_notification_order | boolean An optional flag passed to the resulting order to determine use of notifications. |
metadata | object The optional key-value map with additional details about the Draft Order. |
Responses
Response Schema: application/json
object (DraftOrder) Represents a draft order | |||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "status": "open",
- "email": "user@example.com",
- "billing_address": {
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "metadata": {
- "car": "white"
}
}, - "shipping_address": {
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "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"
}
}
}
List Draft Orders
Retrieves an list of Draft Orders
Authorizations:
query Parameters
offset | number Default: "0" The number of items to skip before the results. |
limit | number Default: "50" Limit the number of items returned. |
q | string a search term to search emails in carts associated with draft orders and display IDs of draft orders |
Responses
Response Schema: application/json
Array of objects (DraftOrder) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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 Line Item
Creates a Line Item for 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 to generate the Line Item from. |
unit_price | integer The potential custom price of the item. |
title | string Default: "Custom item" The potential custom title of the item. |
metadata | object The optional key-value map with additional details about the Line Item. |
Responses
Response Schema: application/json
object (DraftOrder) Represents a draft 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"
}
}
}
Delete a Draft Order
Deletes a Draft Order
Authorizations:
path Parameters
id required | string The ID of the Draft Order. |
Responses
Response Schema: application/json
id | string The ID of the deleted Draft Order. |
object | string Default: "draft-order" The type of the object that was deleted. |
deleted | boolean Default: true Whether the draft order 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.draftOrders.delete(draft_order_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "draft-order",
- "deleted": true
}
Get a Draft Order
Retrieves a Draft Order.
Authorizations:
path Parameters
id required | string The ID of the Draft Order. |
Responses
Response Schema: application/json
object (DraftOrder) Represents a draft 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(draft_order_id) .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"
}
}
}
Delete a Line Item
Removes 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 Draft Order. |
Responses
Response Schema: application/json
object (DraftOrder) Represents a draft 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(draft_order_id, item_id) .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 Line Item
Updates a Line Item for 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 potential custom price of the item. |
title | string The potential custom title of the item. |
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
object (DraftOrder) Represents a draft 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"
}
}
}
Registers a Payment
Registers a payment for a Draft Order.
Authorizations:
path Parameters
id required | string The Draft Order id. |
Responses
Response Schema: application/json
object (Order) Represents 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.markPaid(draft_order_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 Draft Order
Updates a Draft Order.
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 on the Draft Order. | |
Address Fields (object) or string The Address to be used for billing purposes. | |
Address Fields (object) or string The Address to be used for shipping. | |
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 to determine use of notifications. |
customer_id | string The ID of the Customer to associate the Draft Order with. |
Responses
Response Schema: application/json
object (DraftOrder) Represents a draft order | |||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "region_id": "string",
- "country_code": "string",
- "email": "user@example.com",
- "billing_address": {
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "metadata": {
- "car": "white"
}
}, - "shipping_address": {
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "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"
}
}
}
Cancel Claim Fulfillment
Registers a claim's fulfillment as canceled.
Authorizations:
path Parameters
id required | string The ID of the Order which the Claim relates to. |
claim_id required | string The ID of the Claim which the Fulfillment relates to. |
fulfillment_id required | string The ID of the Fulfillment. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Responses
Response Schema: application/json
object (Order) Represents 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.orders.cancelClaimFulfillment(order_id, claim_id, fulfillment_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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
Registers a Swap's Fulfillment as canceled.
Authorizations:
path Parameters
id required | string The ID of the Order which the Swap relates to. |
swap_id required | string The ID of the Swap which the Fulfillment relates to. |
fulfillment_id required | string The ID of the Fulfillment. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Responses
Response Schema: application/json
object (Order) Represents 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.orders.cancelSwapFulfillment(order_id, swap_id, fulfillment_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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"
}
}
}
Cancels a Fulfilmment
Registers a Fulfillment as canceled.
Authorizations:
path Parameters
id required | string The ID of the Order which the Fulfillment relates to. |
fulfillment_id required | string The ID of the Fulfillment |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Responses
Response Schema: application/json
object (Order) Represents 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.orders.cancelFulfillment(order_id, fulfillment_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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
Creates a Fulfillment of an Order - will notify Fulfillment Providers to prepare a shipment.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Request Body schema: application/json
required | Array of objects The Line Items to include in the Fulfillment. |
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
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 Claim Fulfillment
Creates a Fulfillment for a Claim.
Authorizations:
path Parameters
id required | string The ID of the Order. |
claim_id required | string The ID of the Claim. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Request Body schema: application/json
metadata | object An optional set of key-value pairs to hold additional information. |
no_notification | boolean If set to true no notification will be send related to this Claim. |
Responses
Response Schema: application/json
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 Swap Fulfillment
Creates a Fulfillment for a Swap.
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 list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Request Body schema: application/json
metadata | object An optional set of key-value pairs to hold additional information. |
no_notification | boolean If set to true no notification will be send related to this Claim. |
Responses
Response Schema: application/json
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 Gift Card
Creates 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. You will have to enable it later to make it available to Customers. |
ends_at | string <date-time> The 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
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"
}
}
}
List Gift Cards
Retrieves a list of Gift Cards.
Authorizations:
query Parameters
offset | number Default: "0" The number of items to skip before the results. |
limit | number Default: "50" Limit the number of items returned. |
q | string a search term to search by code or display ID |
Responses
Response Schema: application/json
Array of objects (Gift Card) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Delete a Gift Card
Deletes a Gift Card
Authorizations:
path Parameters
id required | string The ID of the Gift Card to delete. |
Responses
Response Schema: application/json
id | string The ID of the deleted Gift Card |
object | string Default: "gift-card" The type of the object that was deleted. |
deleted | boolean Default: true Whether the gift card 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.giftCards.delete(gift_card_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "gift-card",
- "deleted": true
}
Get a Gift Card
Retrieves a Gift Card.
Authorizations:
path Parameters
id required | string The ID of the Gift Card. |
Responses
Response Schema: application/json
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(gift_card_id) .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 that can redeemed by its unique code. The Gift Card is only valid within 1 region.
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. You will have to enable it later to make it available to Customers. |
ends_at | string <date-time> The 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
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"
}
}
}
Create an Inventory Location Level for a given Inventory Item.
Creates an Inventory Location Level for a given Inventory Item.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Request Body schema: application/json
location_id required | string the item location ID |
stocked_quantity required | number the 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
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",
- "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"
}
}
List stock levels of a given location.
Lists stock levels of a given location.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item. |
query Parameters
offset | integer Default: 0 How many stock locations levels to skip in the result. |
limit | integer Default: 20 Limit the number of stock locations levels returned. |
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
id | any The id of the location |
Array of objects (InventoryLevelDTO) List of stock levels at a given 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.inventoryItems.listLocationLevels(inventoryItemId) .then(({ inventory_item }) => { console.log(inventory_item.location_levels); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": null,
- "location_levels": [
- {
- "location_id": "string",
- "stocked_quantity": 0,
- "reserved_quantity": 0,
- "incoming_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"
}
]
}
Retrive an Inventory Item.
Retrives an Inventory Item.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
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",
- "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.
Updates an Inventory Item.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
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
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",
- "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 of an Inventory Item.
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. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
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",
- "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 Location Level for a given Inventory Item.
Updates an Inventory Location Level for a given Inventory Item.
Authorizations:
path Parameters
id required | string The ID of the Inventory Item. |
location_id required | string The ID of the Location. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
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
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",
- "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"
}
}
List inventory items.
Lists inventory items.
Authorizations:
query Parameters
offset | integer Default: 0 How many inventory items to skip in the result. |
limit | integer Default: 20 Limit the number of inventory items returned. |
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
q | string Query used for searching product inventory items and their properties. |
location_id | Array of strings Locations ids to search for. |
id | string id to search for. |
sku | string sku to search for. |
origin_country | string origin_country to search for. |
mid_code | string mid_code to search for. |
material | string material to search for. |
hs_code | string hs_code to search for. |
weight | string weight to search for. |
length | string length to search for. |
height | string height to search for. |
width | string width to search for. |
requires_shipping | string requires_shipping to search for. |
Responses
Response Schema: application/json
Array of objects | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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 }) => { 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",
- "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
]
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Delete an Inventory Item
Delete an Inventory Item
Authorizations:
path Parameters
id required | string The ID of the Inventory Item to delete. |
Responses
Response Schema: application/json
id | string The ID of the deleted Inventory Item. |
object | string <inventory_item> The type of the object that was deleted. |
deleted | 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
}
Accept an Invite
Accepts an Invite and creates a corresponding user
Authorizations:
Request Body schema: application/json
token required | string The invite token provided by the admin. |
required | object 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"
}
Create an Invite
Creates an Invite and triggers an 'invite' created event
Authorizations:
Request Body schema: application/json
user required | string <email> The email for the user to be created. |
role required | string Enum: "admin" "member" "developer" The role of the user to be 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"
}
Lists Invites
Lists all Invites
Authorizations:
Responses
Response Schema: application/json
Array of objects (Invite) | |||||||||||||||||||||
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"
}
}
]
}
Delete an Invite
Deletes an Invite
Authorizations:
path Parameters
invite_id required | string The ID of the Invite |
Responses
Response Schema: application/json
id | string The ID of the deleted Invite. |
object | string Default: "invite" The type of the object that was deleted. |
deleted | 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(invite_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "invite",
- "deleted": true
}
Resend an Invite
Resends an Invite by triggering the 'invite' created event again
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(invite_id) .then(() => { // successful }) .catch(() => { // an error occurred });
Response samples
- 400
- 404
- 409
- 422
- 500
{- "message": "Discount must be set to dynamic",
- "type": "not_allowed"
}
Creates a Note
Creates a Note which can be associated with any resource as required.
Authorizations:
Request Body schema: application/json
resource_id required | string The ID of the resource which the Note relates to. |
resource_type required | string The type of resource which the Note relates to. |
value required | string The content of the Note to create. |
Responses
Response Schema: application/json
object (Note) Notes are elements which we can use in association with different resources to allow users to describe additional information in relation to these. | |||||||||||||||||||||
|
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"
}
}
}
List Notes
Retrieves a list of notes
Authorizations:
query Parameters
limit | number Default: "50" The number of notes to get |
offset | number Default: "0" The offset at which to get notes |
resource_id | string The ID which the notes belongs to |
Responses
Response Schema: application/json
Array of objects (Note) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Delete a Note
Deletes a Note.
Authorizations:
path Parameters
id required | string The ID of the Note to delete. |
Responses
Response Schema: application/json
id | string The ID of the deleted Note. |
object | string Default: "note" The type of the object that was deleted. |
deleted | 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(note_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "note",
- "deleted": true
}
Get a Note
Retrieves a single note using its id
Authorizations:
path Parameters
id required | string The ID of the note to retrieve. |
Responses
Response Schema: application/json
object (Note) Notes are elements which we can use in association with different resources to allow users to describe additional information in relation to these. | |||||||||||||||||||||
|
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(note_id) .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
Updates a Note associated with some resource
Authorizations:
path Parameters
id required | string The ID of the Note to update |
Request Body schema: application/json
value required | string The updated description of the Note. |
Responses
Response Schema: application/json
object (Note) Notes are elements which we can use in association with different resources to allow users to describe additional information in relation to these. | |||||||||||||||||||||
|
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"
}
}
}
List Notifications
Retrieves a list of Notifications.
Authorizations:
query Parameters
offset | integer Default: 0 The number of notifications to skip before starting to collect the notifications set |
limit | integer Default: 50 The number of notifications to return |
fields | string Comma separated fields to include in the result set |
expand | string Comma separated fields to populate |
event_name | string The name of the event that the notification was sent for. |
resource_type | string The type of resource that the Notification refers to. |
resource_id | string The ID of the resource that the Notification refers to. |
to | string The address that the Notification was sent to. This will usually be an email address, but 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
Array of objects (Notification) | |||||||||||||||||||||||||||||||
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.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"
}
]
}
Resend Notification
Resends 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 |
Responses
Response Schema: application/json
object (Notification) Notifications a communications sent via Notification Providers 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"
}
}
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 list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
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 will depend on the Fulfillment Provider. |
Responses
Response Schema: application/json
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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
Archives the order with the given id.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Responses
Response Schema: application/json
object (Order) Represents 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.orders.archive(order_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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
Registers an Order as canceled. This triggers a flow that will cancel any created Fulfillments and Payments, 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 list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Responses
Response Schema: application/json
object (Order) Represents 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.orders.cancel(order_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 Order's Payment
Captures all the Payments associated with an Order.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Responses
Response Schema: application/json
object (Order) Represents 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.orders.capturePayment(order_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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
Completes an Order
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Responses
Response Schema: application/json
object (Order) Represents 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.orders.complete(order_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 for a line item
Creates 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
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
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "reservation": {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "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"
}
}
Create a Shipment
Registers a Fulfillment as shipped.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
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
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 an Order
Retrieves an Order
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
object (Order) Represents 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.orders.retrieve(order_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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
Updates and order
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Request Body schema: application/json
string the email for the order | |
Address Fields (object) Billing address | |
Address Fields (object) Shipping address | |
Array of objects (Line Item) The Line Items for the order | |
region | string ID of the region where the order belongs |
Array of objects (Discount) Discounts applied to the order | |
customer_id | string ID of the customer |
object payment method chosen for the order | |
object The Shipping Method used for shipping the order. | |
no_notification | boolean A flag to indicate if no notifications should be emitted related to the updated order. |
Responses
Response Schema: application/json
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "email": "string",
- "billing_address": {
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "metadata": {
- "car": "white"
}
}, - "shipping_address": {
- "company": "Acme",
- "first_name": "Arno",
- "last_name": "Willms",
- "address_1": "14433 Kemmer Court",
- "address_2": "Suite 369",
- "city": "South Geoffreyview",
- "country_code": "st",
- "province": "Kentucky",
- "postal_code": 72093,
- "phone": 16128234334802,
- "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": { }
}, - "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,
- "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,
- "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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 reservations for an Order
Retrieves reservations for an Order
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
offset | integer Default: 0 How many reservations to skip before the results. |
limit | integer Default: 20 Limit the number of reservations returned. |
Responses
Response Schema: application/json
Array of objects (Reservation item) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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.retrieveReservations(order_id) .then(({ reservations }) => { console.log(reservations[0].id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "reservations": [
- {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "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"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
List Orders
Retrieves a list of Orders
Authorizations:
query Parameters
q | string Query used for searching orders by shipping address first name, orders' email, and orders' display ID |
id | string ID of the order to search for. |
status | Array of strings Items Enum: "pending" "completed" "archived" "canceled" "requires_action" Status to search for |
fulfillment_status | Array of strings Items Enum: "not_fulfilled" "fulfilled" "partially_fulfilled" "shipped" "partially_shipped" "canceled" "returned" "partially_returned" "requires_action" Fulfillment status to search for. |
payment_status | Array of strings Items Enum: "captured" "awaiting" "not_paid" "refunded" "partially_refunded" "canceled" "requires_action" Payment status to search for. |
display_id | string Display ID to search for. |
cart_id | string to search for. |
customer_id | string to search for. |
string to search for. | |
string or Array of strings Regions to search orders by | |
currency_code | |
tax_rate | string to search for. |
object Date comparison for when resulting orders were created. | |
object Date comparison for when resulting orders were updated. | |
object Date comparison for when resulting orders were canceled. | |
sales_channel_id | Array of strings Filter by Sales Channels |
offset | integer Default: 0 How many orders to skip before the results. |
limit | integer Default: 50 Limit the number of orders returned. |
expand | string (Comma separated) Which fields should be expanded in each order of the result. |
fields | string (Comma separated) Which fields should be included in each order of the result. |
Responses
Response Schema: application/json
Array of objects (Order) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}, - "shipping_total": 1000,
- "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
}
Create a Refund
Issues a Refund.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
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. |
no_notification | boolean If set to true no notification will be send related to this Refund. |
Responses
Response Schema: application/json
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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"
}
}
}
Request a Return
Requests a Return. If applicable a return label will be created and other plugins notified.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
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 A flag to indicate if no notifications should be emitted related to the requested Return. |
refund | integer The amount to refund. |
Responses
Response Schema: application/json
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 Line Item
Create an OrderEdit LineItem.
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 variant ID to add |
quantity required | number The quantity to add |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
object (Order Edit) Order edit keeps track of order items changes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}
}
Cancel an OrderEdit
Cancels an OrderEdit.
Authorizations:
path Parameters
id required | string The ID of the OrderEdit. |
Responses
Response Schema: application/json
object (Order Edit) Order edit keeps track of order items changes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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(order_edit_id) .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,
- "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"
}
}
Confirms an OrderEdit
Confirms an OrderEdit.
Authorizations:
path Parameters
id required | string The ID of the order edit. |
Responses
Response Schema: application/json
object (Order Edit) Order edit keeps track of order items changes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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(order_edit_id) .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,
- "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"
}
}
Create an OrderEdit
Creates an OrderEdit.
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 create for the order edit. |
Responses
Response Schema: application/json
object (Order Edit) Order edit keeps track of order items changes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}
}
List OrderEdits
List OrderEdits.
Authorizations:
query Parameters
q | string Query used for searching order edit internal note. |
order_id | string List order edits by order id. |
limit | number Default: "20" The number of items in the response |
offset | number Default: "0" The offset of items in response |
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
Array of objects (Order Edit) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Delete a Line Item
Delete line items from an order edit and create change item
Authorizations:
path Parameters
id required | string The ID of the Order Edit to delete from. |
item_id required | string The ID of the order edit item to delete from order. |
Responses
Response Schema: application/json
object (Order Edit) Order edit keeps track of order items changes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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(order_edit_id, line_item_id) .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,
- "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 the order edit change holding the line item changes
Authorizations:
path Parameters
id required | string The ID of the Order Edit to update. |
item_id required | string The ID of the order edit item to update. |
Request Body schema: application/json
quantity required | number The quantity to update |
Responses
Response Schema: application/json
object (Order Edit) Order edit keeps track of order items changes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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
Deletes an Order Edit Item Change
Authorizations:
path Parameters
id required | string The ID of the Order Edit to delete. |
change_id required | string The ID of the Order Edit Item Change to delete. |
Responses
Response Schema: application/json
id | string The ID of the deleted Order Edit Item Change. |
object | string Default: "item_change" The type of the object that was deleted. |
deleted | 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(order_edit_id, item_change_id) .then(({ id, object, deleted }) => { console.log(id) })
Response samples
- 200
- 400
{- "id": "string",
- "object": "item_change",
- "deleted": true
}
Delete an Order Edit
Delete an Order Edit
Authorizations:
path Parameters
id required | string The ID of the Order Edit to delete. |
Responses
Response Schema: application/json
id | string The ID of the deleted Order Edit. |
object | string Default: "order_edit" The type of the object that was deleted. |
deleted | 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(order_edit_id) .then(({ id, object, deleted }) => { console.log(id) })
Response samples
- 200
- 400
{- "id": "string",
- "object": "order_edit",
- "deleted": true
}
Get an OrderEdit
Retrieves a OrderEdit.
Authorizations:
path Parameters
id required | string The ID of the OrderEdit. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
object (Order Edit) Order edit keeps track of order items changes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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 OrderEdit
Updates a OrderEdit.
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 for the order edit. |
Responses
Response Schema: application/json
object (Order Edit) Order edit keeps track of order items changes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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
Authorizations:
path Parameters
id required | string The ID of the Order Edit to request confirmation from. |
Responses
Response Schema: application/json
object (Order Edit) Order edit keeps track of order items changes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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(order_edit_id) .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,
- "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"
}
}
Capture a Payment
Captures a Payment.
Authorizations:
path Parameters
id required | string The ID of the Payment. |
Responses
Response Schema: application/json
object (Payment) Payments represent an amount authorized with a given payment method, Payments can be captured, canceled or refunded. | |||||||||||||||||||||||||||||||||||||||
|
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(payment_id) .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"
}
}
}
Get Payment details
Retrieves the Payment details
Authorizations:
path Parameters
id required | string The ID of the Payment. |
Responses
Response Schema: application/json
object (Payment) Payments represent an amount authorized with a given payment method, Payments can be captured, canceled or refunded. | |||||||||||||||||||||||||||||||||||||||
|
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(payment_id) .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"
}
}
}
Create a Refund
Issues a Refund.
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
object (Refund) Refund represent 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 a store operator. | |||||||||||||||||||||||||
|
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"
}
}
}
Del a PaymentCollection
Deletes a Payment Collection
Authorizations:
path Parameters
id required | string The ID of the Payment Collection to delete. |
Responses
Response Schema: application/json
id | string The ID of the deleted Payment Collection. |
object | string Default: "payment_collection" The type of the object that was deleted. |
deleted | 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(payment_collection_id) .then(({ id, object, deleted }) => { console.log(id) })
Response samples
- 200
- 400
{- "id": "string",
- "object": "payment_collection",
- "deleted": true
}
Get a PaymentCollection
Retrieves a PaymentCollection.
Authorizations:
path Parameters
id required | string The ID of the PaymentCollection. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
object (Payment Collection) Payment Collection | |||||||||||||||||||||||||||||||||||
|
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 PaymentCollection
Updates a PaymentCollection.
Authorizations:
path Parameters
id required | string The ID of the PaymentCollection. |
Request Body schema: application/json
description | string An optional description to create or update the payment collection. |
metadata | object An optional set of key-value pairs to hold additional information. |
Responses
Response Schema: application/json
object (Payment Collection) Payment Collection | |||||||||||||||||||||||||||||||||||
|
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"
}
}
}
Mark Authorized
Sets the status of PaymentCollection as Authorized.
Authorizations:
path Parameters
id required | string The ID of the PaymentCollection. |
Responses
Response Schema: application/json
object (Payment Collection) Payment Collection | |||||||||||||||||||||||||||||||||||
|
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(payment_collection_id) .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 Prices
Batch update prices for a Price List
Authorizations:
path Parameters
id required | string The ID of the Price List to update prices for. |
Request Body schema: application/json
Array of objects The prices to update or add. | |
override | boolean If true the prices will replace all existing prices associated with the Price List. |
Responses
Response Schema: application/json
object (Price List) Price Lists represents a set of prices that overrides 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
Batch delete prices that belong to a Price List
Authorizations:
path Parameters
id required | string The ID of the Price List that the Money Amounts (Prices) that will be deleted belongs to. |
Request Body schema: application/json
price_ids | Array of strings The price id's of the Money Amounts to delete. |
Responses
Response Schema: application/json
ids | Array of strings |
object | string Default: "money-amount" The type of the object that was deleted. |
deleted | 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
}
Create a Price List
Creates a Price List
Authorizations:
Request Body schema: application/json
name required | string The name of the Price List |
description required | string A 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. |
Array of objects A list of customer groups that the Price List applies to. | |
includes_tax | boolean [EXPERIMENTAL] Tax included in prices of price list |
Responses
Response Schema: application/json
object (Price List) Price Lists represents a set of prices that overrides 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"
}
}
List Price Lists
Retrieves a list of Price Lists.
Authorizations:
query Parameters
limit | number Default: "10" The number of items to get |
offset | number Default: "0" The offset at which to get items |
expand | string (Comma separated) Which fields should be expanded in each item of the result. |
order | string field to order results by. |
id | string ID to search for. |
q | string query to search in price list description, price list name, and customer group name fields. |
status | Array of strings Items Enum: "active" "draft" Status to search for. |
name | string price list name to search for. |
customer_groups | Array of strings Customer Group IDs to search for. |
type | Array of strings Items Enum: "sale" "override" Type to search for. |
object Date comparison for when resulting price lists were created. | |
object Date comparison for when resulting price lists were updated. | |
object Date comparison for when resulting price lists were deleted. |
Responses
Response Schema: application/json
Array of objects (Price List) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Delete a Price List
Deletes a Price List
Authorizations:
path Parameters
id required | string The ID of the Price List to delete. |
Responses
Response Schema: application/json
id | string The ID of the deleted Price List. |
object | string Default: "price-list" The type of the object that was deleted. |
deleted | 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(price_list_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "price-list",
- "deleted": true
}
Get a Price List
Retrieves a Price List.
Authorizations:
path Parameters
id required | string The ID of the Price List. |
Responses
Response Schema: application/json
object (Price List) Price Lists represents a set of prices that overrides 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(price_list_id) .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
Updates a Price List
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 A 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. |
Array of objects The prices of the Price List. | |
Array of objects A list of customer groups that the Price List applies to. | |
includes_tax | boolean [EXPERIMENTAL] Tax included in prices of price list |
Responses
Response Schema: application/json
object (Price List) Price Lists represents a set of prices that overrides 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 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 that the Money Amounts that will be deleted belongs to. |
product_id required | string The ID of the product from which the money amount will be deleted. |
Responses
Response Schema: application/json
ids | Array of strings The price ids that have been deleted. |
object | string Default: "money-amount" The type of the object that was deleted. |
deleted | 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(price_list_id, product_id) .then(({ ids, object, deleted }) => { console.log(ids.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "ids": [
- "string"
], - "object": "money-amount",
- "deleted": true
}
Delete 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 that the Money Amounts that will be deleted belongs to. |
variant_id required | string The ID of the variant from which the money amount will be deleted. |
Responses
Response Schema: application/json
ids | Array of strings The price ids that have been deleted. |
object | string Default: "money-amount" The type of the object that was deleted. |
deleted | 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(price_list_id, variant_id) .then(({ ids, object, deleted }) => { console.log(ids); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "ids": [
- "string"
], - "object": "money-amount",
- "deleted": true
}
List Products
Retrieves a list of Product that are part of a Price List
Authorizations:
path Parameters
id required | string ID of the price list. |
query Parameters
q | string Query used for searching product title and description, variant title and sku, and collection title. |
id | string ID of the product to search for. |
status | Array of strings Items Enum: "draft" "proposed" "published" "rejected" Product status to search for |
collection_id | Array of strings Collection IDs to search for |
tags | Array of strings Tag IDs to search for |
title | string product title to search for. |
description | string product description to search for. |
handle | string product handle to search for. |
is_giftcard | string Search for giftcards using is_giftcard=true. |
type | string to search for. |
order | string field to sort results by. |
object Date comparison for when resulting products were created. | |
object Date comparison for when resulting products were updated. | |
object Date comparison for when resulting products were deleted. | |
offset | integer Default: 0 How many products to skip in the result. |
limit | integer Default: 50 Limit the number of products returned. |
expand | string (Comma separated) Which fields should be expanded in each product of the result. |
fields | string (Comma separated) Which fields should be included in each product of the result. |
Responses
Response Schema: application/json
Array of objects (Product) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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(price_list_id) .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": { }
}, - "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
}
Add an Option
Adds 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 The title the Product Option will be identified by i.e. "Size" |
Responses
Response Schema: application/json
object (Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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": { }
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_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"
}
}, - "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
}
], - "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 Product
Creates a Product
Authorizations:
Request Body schema: application/json
title required | string The title of the Product |
subtitle | string The subtitle of the Product |
description | string A 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 LineItems generated from this Product |
images | Array of strings Images of the Product. |
thumbnail | string The thumbnail to use for the Product. |
handle | string A unique handle to identify the Product by. |
status | string Default: "draft" Enum: "draft" "proposed" "published" "rejected" The status of the product. |
object The Product Type to associate the Product with. | |
collection_id | string The ID of the Collection the Product should belong to. |
Array of objects Tags to associate the Product with. | |
Array of objects [EXPERIMENTAL] Sales channels to associate the Product with. | |
Array of objects Categories to add the Product to. | |
Array of objects The Options that the Product should have. These define on which properties the Product's Product Variants will differ. | |
Array of objects A list of Product Variants to create with the Product. | |
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 for the Product Variant. |
origin_country | string The country of origin of the Product. |
mid_code | string The Manufacturer Identification code for 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
object (Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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": { }
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_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"
}
}, - "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
}
], - "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 Products
Retrieves a list of Product
Authorizations:
query Parameters
q | string Query used for searching product title and description, variant title and sku, and collection title. |
discount_condition_id | string The discount condition id on which to filter the product. |
string or Array of strings Filter by product IDs. | |
status | Array of strings Items Enum: "draft" "proposed" "published" "rejected" Status to search for |
collection_id | Array of strings Collection ids to search for. |
tags | Array of strings Tag IDs to search for |
price_list_id | Array of strings Price List IDs to search for |
sales_channel_id | Array of strings Sales Channel IDs to filter products by |
type_id | Array of strings Type IDs to filter products by |
category_id | Array of strings Category IDs to filter products by |
include_category_children | boolean Include category children when filtering by category_id |
title | string title to search for. |
description | string description to search for. |
handle | string handle to search for. |
is_giftcard | boolean Search for giftcards using is_giftcard=true. |
object Date comparison for when resulting products were created. | |
object Date comparison for when resulting products were updated. | |
object Date comparison for when resulting products were deleted. | |
offset | integer Default: 0 How many products to skip in the result. |
limit | integer Default: 50 Limit the number of products returned. |
expand | string (Comma separated) Which fields should be expanded in each product of the result. |
fields | string (Comma separated) Which fields should be included in each product of the result. |
order | string the field used to order the products. |
Responses
Response Schema: application/json
Array of Product (object) or Priced Product (object) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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": { }
}, - "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 Variant
Creates a Product Variant. 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 to identify the Product Variant by. |
required | Array of objects |
required | Array of objects |
sku | string The unique SKU for 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 for the Product Variant. |
hs_code | string The Harmonized System code for the Product Variant. |
inventory_quantity | integer Default: 0 The amount of stock kept for 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 for 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 for 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
object (Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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": { }
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_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"
}
}, - "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
}
], - "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
Retrieves a list of the Product Variants associated with a Product.
Authorizations:
path Parameters
id required | string ID of the product to search for the variants. |
query Parameters
fields | string Comma separated string of the column to select. |
expand | string Comma separated string of the relations to include. |
offset | integer Default: 0 How many items to skip before the results. |
limit | integer Default: 100 Limit the number of items returned. |
Responses
Response Schema: application/json
Array of objects (Product Variant) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | integer The number of items per page |
Request samples
- cURL
curl --location --request GET 'https://medusa-url.com/admin/products/{id}/variants' \ --header '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"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Delete a Product Option
Deletes a Product Option. Before a Product Option can be deleted all Option Values for the Product Option must be the same. You may, for example, have to delete some of your variants prior to 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 | string The ID of the deleted Product Option |
object | string Default: "option" The type of the object that was deleted. |
deleted | boolean Default: true Whether or not the items were deleted. |
object (Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
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(product_id, option_id) .then(({ option_id, object, delete, 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": { }
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_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"
}
}, - "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
}
], - "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
Updates a Product Option
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
object (Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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": { }
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_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"
}
}, - "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
}
], - "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
Deletes a Product and it's associated Product Variants.
Authorizations:
path Parameters
id required | string The ID of the Product. |
Responses
Response Schema: application/json
id | string The ID of the deleted Product. |
object | string Default: "product" The type of the object that was deleted. |
deleted | 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(product_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "product",
- "deleted": true
}
Get a Product
Retrieves a Product.
Authorizations:
path Parameters
id required | string The ID of the Product. |
Responses
Response Schema: application/json
object (Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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(product_id) .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": { }
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_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"
}
}, - "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
}
], - "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
Updates a Product
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 A description of the Product. |
discountable | boolean A flag to indicate if discounts can be applied to the LineItems generated from this Product |
images | Array of strings Images of the Product. |
thumbnail | string The thumbnail to use for the Product. |
handle | string A unique handle to identify the Product by. |
status | string Enum: "draft" "proposed" "published" "rejected" The status of the product. |
object The Product Type to associate the Product with. | |
collection_id | string The ID of the Collection the Product should belong to. |
Array of objects Tags to associate the Product with. | |
Array of objects [EXPERIMENTAL] Sales channels to associate the Product with. | |
Array of objects Categories to add the Product to. | |
Array of objects A list of Product Variants to create with the Product. | |
weight | number The wieght 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 for 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
object (Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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": { }
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_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"
}
}, - "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
}
], - "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
Deletes 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 | string The ID of the deleted Product Variant. |
object | string Default: "product-variant" The type of the object that was deleted. |
deleted | boolean Default: true Whether or not the items were deleted. |
object (Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. |
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(product_id, variant_id) .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": { }
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_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"
}
}, - "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
}
], - "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.
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
required | Array of objects |
title | string The title to identify the Product Variant by. |
sku | string The unique SKU for 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 for the Product Variant. |
hs_code | string The Harmonized System code for the Product Variant. |
inventory_quantity | integer The amount of stock kept for 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 for 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 for 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 |
Responses
Response Schema: application/json
object (Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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": { }
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_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"
}
}, - "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
}
], - "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 Product Types Deprecated
Retrieves a list of Product Types.
Authorizations:
Responses
Response Schema: application/json
Array of objects (Product Type) | |||||||||||||
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"
}
}
]
}
Set Product Metadata
Set metadata key/value pair for 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
object (Product) Products are a grouping of Product Variants that have common properties such as images and descriptions. Products can have multiple options which define the properties that Product Variants differ by. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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": { }
}
], - "categories": [
- {
- "id": null,
- "name": null,
- "handle": null,
- "mpath": null,
- "is_internal": null,
- "is_active": null,
- "category_children": [ ],
- "parent_category_id": null,
- "parent_category": { },
- "products": [ ],
- "created_at": null,
- "updated_at": null,
- "deleted_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"
}
}, - "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
}
], - "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 Products to a category
Assign a batch of products to a product category.
Authorizations:
path Parameters
id required | string The ID of the Product Category. |
query Parameters
expand | string (Comma separated) Category fields to be expanded in the response. |
fields | string (Comma separated) Category fields to be retrieved in the response. |
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
object (ProductCategory) Represents a product category | |||||||||||||||||||||||||||
|
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,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Delete Products
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) Category fields to be expanded in the response. |
fields | string (Comma separated) Category fields to be retrieved in the response. |
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
object (ProductCategory) Represents a product category | |||||||||||||||||||||||||||
|
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,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
Create a Product Category
Creates a Product Category.
Authorizations:
query Parameters
expand | string (Comma separated) Which fields should be expanded in the results. |
fields | string (Comma separated) Which fields should be retrieved in the results. |
Request Body schema: application/json
name required | string The name to identify the Product Category by. |
handle | string An optional handle to be used in slugs, if none is provided we will kebab-case the title. |
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 |
Responses
Response Schema: application/json
object (ProductCategory) Represents a product category | |||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "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,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
List Product Categories
Retrieve a list of product categories.
Authorizations:
query Parameters
q | string Query used for searching product category names orhandles. |
is_internal | boolean Search for only internal categories. |
is_active | boolean Search for only active categories |
parent_category_id | string Returns categories scoped by parent |
offset | integer Default: 0 How many product categories to skip in the result. |
limit | integer Default: 100 Limit the number of product categories returned. |
expand | string (Comma separated) Which fields should be expanded in the product category. |
fields | string (Comma separated) Which fields should be included in the product category. |
Responses
Response Schema: application/json
Array of objects (ProductCategory) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "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
}
Delete a Product Category
Deletes a ProductCategory.
Authorizations:
path Parameters
id required | string The ID of the Product Category |
Responses
Response Schema: application/json
id | string The ID of the deleted product category |
object | string Default: "product-category" The type of the object that was deleted. |
deleted | 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(product_category_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "product-category",
- "deleted": true
}
Get a Product Category
Retrieves 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 the results. |
fields | string (Comma separated) Which fields should be included in the results. |
Responses
Response Schema: application/json
object (ProductCategory) Represents a product category | |||||||||||||||||||||||||||
|
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(product_category_id) .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,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_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. |
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 |
Responses
Response Schema: application/json
object (ProductCategory) Represents a product category | |||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "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,
- "category_children": [
- { }
], - "parent_category_id": null,
- "parent_category": { },
- "products": [
- { }
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}
List Reservations
Retrieve a list of Reservations.
Authorizations:
query Parameters
location_id | Array of strings Location ids to search for. |
inventory_item_id | Array of strings Inventory Item ids to search for. |
line_item_id | Array of strings Line Item ids to search for. |
object Filter by reservation quantity | |
offset | integer Default: 0 How many Reservations to skip in the result. |
limit | integer Default: 20 Limit the number of Reservations returned. |
expand | string (Comma separated) Which fields should be expanded in the product category. |
fields | string (Comma separated) Which fields should be included in the product category. |
Responses
Response Schema: application/json
Array of objects (Reservation item) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | integer The number of items per page |
Request samples
- cURL
curl --location --request GET 'https://medusa-url.com/admin/product-categories' \ --header 'Authorization: Bearer {api_token}'
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "reservations": [
- {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "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"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
List Product Tags
Retrieve a list of Product Tags.
Authorizations:
query Parameters
limit | integer Default: 10 The number of tags to return. |
offset | integer Default: 0 The number of items to skip before the results. |
order | string The field to sort items by. |
discount_condition_id | string The discount condition id on which to filter the tags. |
value | Array of strings The tag values to search for |
q | string A query string to search values for |
id | Array of strings The tag IDs to search for |
object Date comparison for when resulting product tags were created. | |
object Date comparison for when resulting product tags were updated. |
Responses
Response Schema: application/json
Array of objects (Product Tag) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
List Tags Usage Number
Retrieves a list of Product Tags with how many times each is used.
Authorizations:
Responses
Response Schema: application/json
Array of objects | |||||||
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
Retrieve a list of Product Types.
Authorizations:
query Parameters
limit | integer Default: 20 The number of types to return. |
offset | integer Default: 0 The number of items to skip before the results. |
order | string The field to sort items by. |
discount_condition_id | string The discount condition id on which to filter the product types. |
value | Array of strings The type values to search for |
id | Array of strings The type IDs to search for |
q | string A query string to search values for |
object Date comparison for when resulting product types were created. | |
object Date comparison for when resulting product types were updated. |
Responses
Response Schema: application/json
Array of objects (Product Type) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Get inventory of Variant.
Returns the available inventory of a Variant.
Authorizations:
path Parameters
id required | string The Product Variant id to get inventory for. |
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": {
- "id": "string",
- "inventory": "string",
- "sales_channel_availability": {
- "channel_name": "string",
- "channel_id": "string",
- "available_quantity": 0
}
}
}
List Product Variants
Retrieves a list of Product Variants
Authorizations:
query Parameters
id | string A Product Variant id to filter by. |
ids | string A comma separated list of Product Variant ids to filter by. |
expand | string A comma separated list of Product Variant relations to load. |
fields | string A comma separated list of Product Variant fields to include. |
offset | number Default: "0" How many product variants to skip in the result. |
limit | number Default: "100" Maximum number of Product Variants to return. |
cart_id | string The id of the cart to use for price selection. |
region_id | string The id of the region to use for price selection. |
currency_code | string The currency code to use for price selection. |
customer_id | string The id of the customer to use for price selection. |
string or Array of strings product variant title to search for. | |
number or object Filter by available inventory quantity |
Responses
Response Schema: application/json
Array of objects (Product Variant) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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"
}
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Add SalesChannels
Assign a batch 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
object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. | |||||||||||||||
|
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"
}
}
Delete SalesChannels
Remove a batch of sales channels from 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 delete from the publishable api key | ||
Array
|
Responses
Response Schema: application/json
object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. | |||||||||||||||
|
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"
}
}
Create PublishableApiKey
Creates a PublishableApiKey.
Authorizations:
Request Body schema: application/json
title required | string A title for the publishable api key |
Responses
Response Schema: application/json
object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. | |||||||||||||||
|
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 PublishableApiKeys
List PublishableApiKeys.
Authorizations:
query Parameters
q | string Query used for searching publishable api keys by title. |
limit | number Default: "20" The number of items in the response |
offset | number Default: "0" The offset of items in response |
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
Array of objects (Publishable API key) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Delete PublishableApiKey
Deletes a PublishableApiKeys
Authorizations:
path Parameters
id required | string The ID of the PublishableApiKeys to delete. |
Responses
Response Schema: application/json
id | string The ID of the deleted PublishableApiKey. |
object | string Default: "publishable_api_key" The type of the object that was deleted. |
deleted | boolean Default: true Whether the PublishableApiKeys 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
}
Get a PublishableApiKey
Retrieve the Publishable Api Key.
Authorizations:
path Parameters
id required | string The ID of the PublishableApiKey. |
Responses
Response Schema: application/json
object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. | |||||||||||||||
|
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"
}
}
List SalesChannels
List PublishableApiKey's SalesChannels
Authorizations:
path Parameters
id required | string The ID of the Publishable Api Key. |
query Parameters
q | string Query used for searching sales channels' names and descriptions. |
Responses
Response Schema: application/json
Array of objects (Sales Channel) | |||||||||||||||||
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"
}
]
}
Revoke PublishableApiKey
Revokes a PublishableApiKey.
Authorizations:
path Parameters
id required | string The ID of the PublishableApiKey. |
Responses
Response Schema: application/json
object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. | |||||||||||||||
|
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"
}
}
Update PublishableApiKey
Updates a PublishableApiKey.
Authorizations:
path Parameters
id required | string The ID of the PublishableApiKey. |
Request Body schema: application/json
title | string A title to update for the key. |
Responses
Response Schema: application/json
object (Publishable API key) Publishable API key defines scopes (i.e. resources) that are available within a request. | |||||||||||||||
|
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"
}
}
Add Country
Adds 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
object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. 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"
}
}
}
Add Fulfillment Provider
Adds a Fulfillment Provider to 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 to add. |
Responses
Response Schema: application/json
object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. 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"
}
}
}
Add Payment Provider
Adds a Payment Provider to 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 to add. |
Responses
Response Schema: application/json
object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. 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"
}
}
}
Create a Region
Creates 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 on Orders in the Region. |
payment_providers required | Array of strings A list of Payment Provider IDs that should be enabled for the Region |
fulfillment_providers required | Array of strings A list of Fulfillment Provider IDs that should be enabled for 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 An optional tax code the Region. |
includes_tax | boolean [EXPERIMENTAL] Tax included in prices of region |
Responses
Response Schema: application/json
object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. 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"
}
}
}
List Regions
Retrieves a list of Regions.
Authorizations:
query Parameters
limit | integer Default: 50 limit the number of regions in response |
offset | integer Default: 0 Offset of regions in response (used for pagination) |
created_at | object Date comparison for when resulting region was created, i.e. less than, greater than etc. |
updated_at | object Date comparison for when resulting region was updated, i.e. less than, greater than etc. |
deleted_at | object Date comparison for when resulting region was deleted, i.e. less than, greater than etc. |
Responses
Response Schema: application/json
Array of objects (Region) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Delete a Region
Deletes a Region.
Authorizations:
path Parameters
id required | string The ID of the Region. |
Responses
Response Schema: application/json
id | string The ID of the deleted Region. |
object | string Default: "region" The type of the object that was deleted. |
deleted | 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(region_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "region",
- "deleted": true
}
Get a Region
Retrieves a Region.
Authorizations:
path Parameters
id required | string The ID of the Region. |
Responses
Response Schema: application/json
object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. 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(region_id) .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
Updates a Region
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 true Medusa will automatically calculate taxes for carts in this region. If false you have to manually call POST /carts/:id/taxes. |
gift_cards_taxable | boolean Whether gift cards in this region should be applied sales tax when purchasing a gift card |
tax_provider_id | string The ID of the tax provider to use; if null the system tax provider is used |
tax_code | string An optional tax code the Region. |
tax_rate | number The tax rate to use on Orders in the Region. |
includes_tax | boolean [EXPERIMENTAL] Tax included in prices of region |
payment_providers | Array of strings A list of Payment Provider IDs that should be enabled for the Region |
fulfillment_providers | Array of strings A list of Fulfillment Provider IDs that should be enabled for 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
object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. 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"
}
}
}
List Fulfillment Options
Gathers all the fulfillment options available to in the Region.
Authorizations:
path Parameters
id required | string The ID of the Region. |
Responses
Response Schema: application/json
Array of objects | |||||
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(region_id) .then(({ fulfillment_options }) => { console.log(fulfillment_options.length); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "fulfillment_options": [
- {
- "provider_id": "string",
- "options": [
- {
- "id": "manual-fulfillment"
}, - {
- "id": "manual-fulfillment-return",
- "is_return": true
}
]
}
]
}
Delete Country
Removes a Country from the list of Countries in a Region
Authorizations:
path Parameters
id required | string The ID of the Region. |
country_code required |
Responses
Response Schema: application/json
object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. 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(region_id, '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"
}
}
}
Del. Fulfillment Provider
Removes a Fulfillment Provider.
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
object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. 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(region_id, '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"
}
}
}
Delete Payment Provider
Removes a Payment Provider.
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
object (Region) Regions hold settings for how Customers in a given geographical location shop. The is, for example, where currencies and tax rates are defined. 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(region_id, '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"
}
}
}
Creates a Reservation
Creates a Reservation which can be associated with any resource as required.
Authorizations:
Request Body schema: application/json
required | object (Reservation item) Represents a reservation of an inventory item at a stock location | ||||||||||||||||
|
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
{- "reservation": {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "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"
}
}
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "reservation": {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "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
Deletes a Reservation.
Authorizations:
path Parameters
id required | string The ID of the Reservation to delete. |
Responses
Response Schema: application/json
id | string The ID of the deleted Reservation. |
object | string Default: "reservation" The type of the object that was deleted. |
deleted | 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(reservation.id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "reservation",
- "deleted": true
}
Get a Reservation
Retrieves a single reservation using its id
Authorizations:
path Parameters
id required | string The ID of the reservation to retrieve. |
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(reservation_id) .then(({ reservation }) => { console.log(reservation.id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "reservation": {
- "id": "string",
- "location_id": "string",
- "inventory_item_id": "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"
}
}
Updates a Reservation
Updates a Reservation which can be associated with any resource as required.
Authorizations:
path Parameters
id required | string The ID of the Reservation to update. |
Request Body schema: application/json
location_id | string The id of the location of the reservation |
quantity | number The id of the reservation item |
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",
- "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"
}
}
Request a Return
Requests a Return. If applicable a return label will be created and other plugins notified.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string Comma separated list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
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 A flag to indicate if no notifications should be emitted related to the requested Return. |
refund | integer The amount to refund. |
Responses
Response Schema: application/json
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 Return
Registers a Return as canceled.
Authorizations:
path Parameters
id required | string The ID of the Return. |
Responses
Response Schema: application/json
object (Order) Represents 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.returns.cancel(return_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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"
}
}
}
List Returns
Retrieves a list of Returns
Authorizations:
query Parameters
limit | number Default: "50" The upper limit for the amount of responses returned. |
offset | number Default: "0" The offset of the list returned. |
Responses
Response Schema: application/json
Array of objects (Return) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Receive a Return
Registers a Return as received. Updates statuses on Orders and Swaps 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
object (Return) Return orders hold information about Line Items that a Customer wishes to send back, along with how the items will be returned. Returns can be used as part of a Swap. | |||||||||||||||||||||||||||||||||||||||
|
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"
}
}
}
Create a Return Reason
Creates a Return Reason
Authorizations:
Request Body schema: application/json
label required | string The label to display to the Customer. |
value required | string The value that the Return Reason will be identified by. Must be unique. |
parent_return_reason_id | string The ID of the parent return reason. |
description | string An optional description to for the Reason. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
object (Return Reason) A Reason for why a given product is returned. A Return Reason 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"
}
}
}
List Return Reasons
Retrieves a list of Return Reasons.
Authorizations:
Responses
Response Schema: application/json
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"
}
}
]
}
Delete a Return Reason
Deletes a return reason.
Authorizations:
path Parameters
id required | string The ID of the return reason |
Responses
Response Schema: application/json
id | string The ID of the deleted return reason |
object | string Default: "return_reason" The type of the object that was deleted. |
deleted | 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(return_reason_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "return_reason",
- "deleted": true
}
Get a Return Reason
Retrieves a Return Reason.
Authorizations:
path Parameters
id required | string The ID of the Return Reason. |
Responses
Response Schema: application/json
object (Return Reason) A Reason for why a given product is returned. A Return Reason 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(return_reason_id) .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
Updates a Return Reason
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 The value that the Return Reason will be identified by. Must be unique. |
description | string An optional description to for the Reason. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
object (Return Reason) A Reason for why a given product is returned. A Return Reason 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"
}
}
}
Add Products
Assign a batch of product 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
object (Sales Channel) A Sales Channel | |||||||||||||||||
|
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"
}
}
Delete Products
Remove a list of products from 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 delete from the Sales Channel. | ||
Array
|
Responses
Response Schema: application/json
object (Sales Channel) A Sales Channel | |||||||||||||||||
|
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"
}
}
Associate a stock location to a Sales Channel
Associates a stock location to 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
object (Sales Channel) A Sales Channel | |||||||||||||||||
|
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"
}
}
Remove a stock location from a Sales Channel
Removes a stock location from 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
id | string The ID of the removed stock location from a sales channel |
object | string Default: "stock-location" The type of the object that was removed. |
deleted | 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
}
Create a Sales Channel
Creates 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 or not. |
Responses
Response Schema: application/json
object (Sales Channel) A Sales Channel | |||||||||||||||||
|
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"
}
}
List Sales Channels
Retrieves a list of sales channels
Authorizations:
query Parameters
id | string ID of the sales channel |
name | string Name of the sales channel |
description | string Description of the sales channel |
q | string Query used for searching sales channels' names and descriptions. |
order | string The field to order the results by. |
object Date comparison for when resulting collections were created. | |
object Date comparison for when resulting collections were updated. | |
object Date comparison for when resulting collections were deleted. | |
offset | integer Default: 0 How many sales channels to skip in the result. |
limit | integer Default: 20 Limit the number of sales channels returned. |
expand | string (Comma separated) Which fields should be expanded in each sales channel of the result. |
fields | string (Comma separated) Which fields should be included in each sales channel of the result. |
Responses
Response Schema: application/json
Array of objects (Sales Channel) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Delete a Sales Channel
Deletes the sales channel.
Authorizations:
path Parameters
id required | string The ID of the Sales channel. |
Responses
Response Schema: application/json
id | string The ID of the deleted sales channel |
object | string Default: "sales-channel" The type of the object that was deleted. |
deleted | 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(sales_channel_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "sales-channel",
- "deleted": true
}
Get a Sales Channel
Retrieves the sales channel.
Authorizations:
path Parameters
id required | string The ID of the Sales channel. |
Responses
Response Schema: application/json
object (Sales Channel) A Sales Channel | |||||||||||||||||
|
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(sales_channel_id) .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"
}
}
Update a Sales Channel
Updates a Sales Channel.
Authorizations:
path Parameters
id required | string The ID of the Sales Channel. |
Request Body schema: application/json
name | string Name of the sales channel. |
description | string Sales Channel description. |
is_disabled | boolean Indication of if the sales channel is active. |
Responses
Response Schema: application/json
object (Sales Channel) A Sales Channel | |||||||||||||||||
|
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"
}
}
List Stock Locations
Retrieves a list of stock locations
Authorizations:
query Parameters
id | string ID of the stock location |
name | string Name of the stock location |
order | string The field to order the results by. |
object Date comparison for when resulting collections were created. | |
object Date comparison for when resulting collections were updated. | |
object Date comparison for when resulting collections were deleted. | |
offset | integer Default: 0 How many stock locations to skip in the result. |
limit | integer Default: 20 Limit the number of stock locations returned. |
expand | string (Comma separated) Which fields should be expanded in each stock location of the result. |
fields | string (Comma separated) Which fields should be included in each stock location of the result. |
Responses
Response Schema: application/json
Array of objects (Stock Location) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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"
}
], - "count": 0,
- "offset": 0,
- "limit": 0
}
Create Shipping Option
Creates 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. |
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 defines a return shipment. |
admin_only | boolean Default: false If true, the option can be used for draft orders |
metadata | object An optional set of key-value pairs with additional information. |
includes_tax | boolean [EXPERIMENTAL] Tax included in prices of shipping option |
Responses
Response Schema: application/json
object (Shipping Option) Shipping Options represent 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"
}
}
}
List Shipping Options
Retrieves a list of Shipping Options.
Authorizations:
query Parameters
region_id | string Region ID to fetch options from |
is_return | boolean Flag for fetching return options only |
admin_only | boolean Flag for fetching admin specific options |
Responses
Response Schema: application/json
Array of objects (Shipping Option) | |
count | integer The total number of items available |
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
}
Delete a Shipping Option
Deletes a Shipping Option.
Authorizations:
path Parameters
id required | string The ID of the Shipping Option. |
Responses
Response Schema: application/json
id | string The ID of the deleted Shipping Option. |
object | string Default: "shipping-option" The type of the object that was deleted. |
deleted | 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(option_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "shipping-option",
- "deleted": true
}
Get a Shipping Option
Retrieves a Shipping Option.
Authorizations:
path Parameters
id required | string The ID of the Shipping Option. |
Responses
Response Schema: application/json
object (Shipping Option) Shipping Options represent 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(option_id) .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
Updates a Shipping Option
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. |
admin_only | boolean If true, the option can be used for draft orders |
metadata | object An optional set of key-value pairs with additional information. |
includes_tax | boolean [EXPERIMENTAL] Tax included in prices of shipping option |
Responses
Response Schema: application/json
object (Shipping Option) Shipping Options represent 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"
}
}
}
Create a Shipping Profile
Creates 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
object (Shipping Profile) Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products. | |||||||||||||||||||
|
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"
}
}
}
List Shipping Profiles
Retrieves a list of Shipping Profile.
Authorizations:
Responses
Response Schema: application/json
Array of objects (Shipping Profile) | |||||||||||||||||||
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"
}
}
]
}
Delete a Shipping Profile
Deletes a Shipping Profile.
Authorizations:
path Parameters
id required | string The ID of the Shipping Profile. |
Responses
Response Schema: application/json
id | string The ID of the deleted Shipping Profile. |
object | string Default: "shipping_profile" The type of the object that was deleted. |
deleted | 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(profile_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "shipping_profile",
- "deleted": true
}
Get a Shipping Profile
Retrieves a Shipping Profile.
Authorizations:
path Parameters
id required | string The ID of the Shipping Profile. |
Responses
Response Schema: application/json
object (Shipping Profile) Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of 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.shippingProfiles.retrieve(profile_id) .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
Updates a Shipping Profile
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 An optional array of product ids to associate with the Shipping Profile |
shipping_options | Array of arrays An optional array of shipping option ids to associate with the Shipping Profile |
Responses
Response Schema: application/json
object (Shipping Profile) Shipping Profiles have a set of defined Shipping Options that can be used to fulfill a given set of Products. | |||||||||||||||||||
|
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"
}
}
}
Create a Stock Location
Creates a Stock Location.
Authorizations:
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Request Body schema: application/json
name required | 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
object (Stock Location) 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"
}
}
Get a Stock Location
Retrieves the Stock Location.
Authorizations:
path Parameters
id required | string The ID of the Stock Location. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
Responses
Response Schema: application/json
object (Stock Location) 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(stock_location_id) .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"
}
}
Update a Stock Location
Updates a Stock Location.
Authorizations:
path Parameters
id required | string The ID of the Stock Location. |
query Parameters
expand | string Comma separated list of relations to include in the results. |
fields | string Comma separated list of fields to include in the results. |
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
object (Stock Location) 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"
}
}
Delete a Stock Location
Delete a Stock Location
Authorizations:
path Parameters
id required | string The ID of the Stock Location to delete. |
Responses
Response Schema: application/json
id | string The ID of the deleted Stock Location. |
object | string <stock_location> The type of the object that was deleted. |
deleted | boolean Default: true Whether or not the Stock Location 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.stockLocations.delete(stock_location_id) .then(({ id, object, deleted }) => { console.log(id) })
Response samples
- 200
- 400
{- "id": "string",
- "object": "string",
- "deleted": true
}
Add a Currency Code
Adds a Currency Code to the available currencies.
Authorizations:
path Parameters
code required |
Responses
Response Schema: application/json
object (Store) Holds settings for the Store, such as name, currencies, etc. | |||||||||||||||||||||||||||||
|
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.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"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Delete a Currency Code
Removes a Currency Code from the available currencies.
Authorizations:
path Parameters
code required |
Responses
Response Schema: application/json
object (Store) Holds settings for the Store, such as name, currencies, etc. | |||||||||||||||||||||||||||||
|
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.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"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Get Store details
Retrieves the Store details
Authorizations:
Responses
Response Schema: application/json
object (Store) Holds settings for the Store, such as name, currencies, etc. | |||||||||||||||||||||||||||||
|
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"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
Update Store Details
Updates the Store details
Authorizations:
Request Body schema: application/json
name | string The name of the Store |
swap_link_template | string A template for Swap links - use |
payment_link_template | string A template for payment links links - use |
invite_link_template | string A template for invite links - use |
default_currency_code | |
currencies | Array of strings Array of currencies in 2 character ISO code format. |
metadata | object An optional set of key-value pairs with additional information. |
Responses
Response Schema: application/json
object (Store) Holds settings for the Store, such as name, currencies, etc. | |||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS Client
- cURL
{- "name": "string",
- "swap_link_template": "string",
- "payment_link_template": "string",
- "invite_link_template": "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"
}, - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "metadata": {
- "car": "white"
}
}
}
List Payment Providers
Retrieves the configured Payment Providers
Authorizations:
Responses
Response Schema: application/json
Array of objects (Payment Provider) | |||||
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
Retrieves the configured Tax Providers
Authorizations:
Responses
Response Schema: application/json
Array of objects (Tax Provider) | |||||
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
}
]
}
Cancels a Swap
Cancels a Swap
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 list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Responses
Response Schema: application/json
object (Order) Represents 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.orders.cancelSwap(order_id, swap_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 Swap Shipment
Registers a Swap Fulfillment as 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 list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
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
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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
Creates a Swap. Swaps are used to handle Return of previously purchased goods and Fulfillment of replacements simultaneously.
Authorizations:
path Parameters
id required | string The ID of the Order. |
query Parameters
expand | string (Comma separated) Which fields should be expanded the order of the result. |
fields | string (Comma separated) Which fields should be included the order of the result. |
Request Body schema: application/json
required | Array of objects The Line Items to return as part of the Swap. |
object How the Swap will be returned. | |
Array of objects The new items to send to the Customer. | |
Array of objects The custom shipping options to potentially create a Shipping Method from. | |
no_notification | boolean If set to true no notification will be send related to this Swap. |
allow_backorder | boolean Default: true If true, swaps can be completed with items out of stock |
Responses
Response Schema: application/json
object (Order) Represents an order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 Swap Payment
When there are differences between the returned and shipped Products in a Swap, the difference must be processed. Either a Refund will be issued or a Payment will be captured.
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 list of relations to include in the result. |
fields | string Comma separated list of fields to include in the result. |
Responses
Response Schema: application/json
object (Order) Represents 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.orders.processSwapPayment(order_id, swap_id) .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,
- "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"
}, - "shipping_total": 1000,
- "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,
- "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 a Swap
Retrieves a Swap.
Authorizations:
path Parameters
id required | string The ID of the Swap. |
Responses
Response Schema: application/json
object (Swap) Swaps can be created when a Customer wishes to exchange Products that they have purchased to different Products. Swaps consist of a Return of previously purchased Products and a Fulfillment of new Products, the amount paid for the Products being returned will be used towards payment for the new Products. In the case where the amount paid for the the Products being returned exceed the amount to be paid for the new Products, a Refund will be issued for the difference. | |||||||||||||||||||||||||||||||||||||||||||||||||
|
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(swap_id) .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,
- "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"
}
}
}
List Swaps
Retrieves a list of Swaps.
Authorizations:
query Parameters
limit | number Default: "50" The upper limit for the amount of responses returned. |
offset | number Default: "0" The offset of the list returned. |
Responses
Response Schema: application/json
Array of objects (Swap) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
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 Which fields should be included in the result. |
expand | Array of strings Which fields should be expanded and retrieved in the result. |
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
object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products 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,
- "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 from Product Types
Removes a Tax Rate from a list of Product Types
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Which fields should be included in the result. |
expand | Array of strings Which fields should be expanded and retrieved in the result. |
Request Body schema: application/json
product_types required | Array of strings The IDs of the types of products to remove association with this tax rate |
Responses
Response Schema: application/json
object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products 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,
- "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 Which fields should be included in the result. |
expand | Array of strings Which fields should be expanded and retrieved in the result. |
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
object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products 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,
- "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 from Products
Removes a Tax Rate from a list of Products
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Which fields should be included in the result. |
expand | Array of strings Which fields should be expanded and retrieved in the result. |
Request Body schema: application/json
products required | Array of strings The IDs of the products to remove association with this tax rate |
Responses
Response Schema: application/json
object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products 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,
- "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 Which fields should be included in the result. |
expand | Array of strings Which fields should be expanded and retrieved in the result. |
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
object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products 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,
- "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"
}
}
}
Del. for Shipping Options
Removes a Tax Rate from a list of Shipping Options
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Which fields should be included in the result. |
expand | Array of strings Which fields should be expanded and retrieved in the result. |
Request Body schema: application/json
shipping_options required | Array of strings The IDs of the shipping options to remove association with this tax rate |
Responses
Response Schema: application/json
object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products 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,
- "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"
}
}
}
Create a Tax Rate
Creates a Tax Rate
Authorizations:
query Parameters
fields | Array of strings Which fields should be included in the result. |
expand | Array of strings Which fields should be expanded and retrieved in the result. |
Request Body schema: application/json
code required | string A code to identify the tax type by |
name required | string A human friendly name for the tax |
region_id required | string The ID of the Region that the 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
object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products 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,
- "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"
}
}
}
List Tax Rates
Retrieves a list of TaxRates
Authorizations:
query Parameters
name | string Name of tax rate to retrieve |
string or Array of strings Filter by Region ID | |
code | string code to search for. |
number or object Filter by Rate | |
offset | integer Default: 0 How many tax rates to skip before retrieving the result. |
limit | integer Default: 50 Limit the number of tax rates returned. |
fields | Array of strings Which fields should be included in each item. |
expand | Array of strings Which fields should be expanded and retrieved for each item. |
Responses
Response Schema: application/json
Array of objects (Tax Rate) | |
count | integer The total number of items available |
offset | integer The number of items skipped before these items |
limit | 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
}
Delete a Tax Rate
Deletes a Tax Rate
Authorizations:
path Parameters
id required | string The ID of the Shipping Option. |
Responses
Response Schema: application/json
id | string The ID of the deleted Shipping Option. |
object | string Default: "tax-rate" The type of the object that was deleted. |
deleted | 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(tax_rate_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "tax-rate",
- "deleted": true
}
Get a Tax Rate
Retrieves a TaxRate
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Which fields should be included in the result. |
expand | Array of strings Which fields should be expanded and retrieved in the result. |
Responses
Response Schema: application/json
object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products 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(tax_rate_id) .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,
- "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
Updates a Tax Rate
Authorizations:
path Parameters
id required | string ID of the tax rate. |
query Parameters
fields | Array of strings Which fields should be included in the result. |
expand | Array of strings Which fields should be expanded and retrieved in the result. |
Request Body schema: application/json
code | string A code to identify the tax type by |
name | string A human friendly name for the tax |
region_id | string The ID of the Region that the 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
object (Tax Rate) A Tax Rate can be used to associate a certain rate to charge on products 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,
- "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"
}
}
}
Protected File Upload
Uploads at least one file with ACL or a non-public bucket to the specific fileservice that is installed in Medusa.
Authorizations:
Request Body schema: multipart/form-data
files | string <binary> |
Responses
Response Schema: application/json
Array of objects | |||
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
{
}
Upload files
Uploads at least one file to the specific fileservice that is installed in Medusa.
Authorizations:
Request Body schema: multipart/form-data
files | string <binary> |
Responses
Response Schema: application/json
Array of objects | |||
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
Removes an uploaded file using the installed fileservice
Authorizations:
Request Body schema: application/json
file_key required | string key of the file to delete |
Responses
Response Schema: application/json
id | string The file key of the upload deleted |
object | string Default: "file" The type of the object that was deleted. |
deleted | 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
Creates a presigned download url for a file
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 | 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"
}
Create a User
Creates a User
Authorizations:
Request Body schema: application/json
email required | string <email> The Users email. |
password required | string <password> The Users password. |
first_name | string The name of the User. |
last_name | string The name of the User. |
role | string Enum: "admin" "member" "developer" Userrole assigned to the user. |
Responses
Response Schema: application/json
object (User) Represents a User who can manage store settings. | |||||||||||||||||||||
|
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"
}
}
}
List Users
Retrieves all users.
Authorizations:
Responses
Response Schema: application/json
Array of objects (User) | |||||||||||||||||||||
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"
}
}
]
}
Delete a User
Deletes a User
Authorizations:
path Parameters
id required | string The ID of the User. |
Responses
Response Schema: application/json
id | string The ID of the deleted user. |
object | string Default: "user" The type of the object that was deleted. |
deleted | 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(user_id) .then(({ id, object, deleted }) => { console.log(id); });
Response samples
- 200
- 400
- 404
- 409
- 422
- 500
{- "id": "string",
- "object": "user",
- "deleted": true
}
Get a User
Retrieves a User.
Authorizations:
path Parameters
id required | string The ID of the User. |
Responses
Response Schema: application/json
object (User) Represents a User who can manage store settings. | |||||||||||||||||||||
|
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(user_id) .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
Updates a User
Authorizations:
path Parameters
id required | string The ID of the User. |
Request Body schema: application/json
first_name | string The name of the User. |
last_name | string The name of the User. |
role | string Enum: "admin" "member" "developer" Userrole assigned to the user. |
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
object (User) Represents a User who can manage store settings. | |||||||||||||||||||||
|
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"
}
}
}
Request Password Reset
Generates a password token for a User with a given email.
Authorizations:
Request Body schema: application/json
email required | string <email> The Users 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
Sets the password for a User given the correct token.
Authorizations:
Request Body schema: application/json
token required | string The token generated from the 'password-token' endpoint. |
password required | string <password> The Users new password. |
string <email> The Users email. |
Responses
Response Schema: application/json
object (User) Represents a User who can manage store settings. | |||||||||||||||||||||
|
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"
}
}
}