Files
medusa-store/docs/api/admin-spec3.json
2023-02-23 17:49:38 +02:00

32505 lines
984 KiB
JSON

openapi: 3.0.0
info:
version: 1.0.0
title: Medusa Admin API
description: >
API reference for Medusa's Admin endpoints. All endpoints are prefixed with
`/admin`.
## Authentication
There are two ways to send authenticated requests to the Medusa server:
Using a user's API token, or using a Cookie Session ID.
<!-- ReDoc-Inject: <SecurityDefinitions> -->
## Expanding Fields
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`:
```bash
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`:
```bash
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:
```bash
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`.
## Selecting Fields
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:
```bash
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:
```bash
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:
```bash
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:
```bash
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:
```bash
curl "http://localhost:9000/admin/products?fields&expand" \
-H 'Authorization: Bearer {api_token}'
```
## Query Parameter Types
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:
```bash
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`:
```bash
curl "http://localhost:9000/admin/products?title=Blue%20Shirt" \
-H 'Authorization: Bearer {api_token}'
```
You can use tools like [this one](https://www.urlencoder.org/) to learn how
a value can be encoded.
### Integers
You can pass an integer value in the form of `<parameter_name>=<value>`.
For example:
```bash
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:
```bash
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:
```bash
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:
```bash
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:
```bash
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](https://curl.se/docs/manpage.html#-g).
### Object
Object parameters must be passed as separate query parameters in the form
`<parameter_name>[<key>]=<value>`.
For example:
```bash
curl -g
"http://localhost:9000/admin/products?created_at[lt]=2023-02-17&created_at[gt]=2022-09-17"
\
-H 'Authorization: Bearer {api_token}'
```
## Pagination
### 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:
```bash
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`.
license:
name: MIT
url: 'https://github.com/medusajs/medusa/blob/master/LICENSE'
tags:
- name: Auth
description: >-
Auth endpoints that allow authorization of admin Users and manages their
sessions.
- name: App
description: App endpoints that allow handling apps in Medusa.
- name: Batch Job
description: Batch Job endpoints that allow handling batch jobs in Medusa.
- name: Claim
description: Claim endpoints that allow handling claims in Medusa.
- name: Collection
description: Collection endpoints that allow handling collections in Medusa.
- name: Customer
description: Customer endpoints that allow handling customers in Medusa.
- name: Customer Group
description: Customer Group endpoints that allow handling customer groups in Medusa.
- name: Discount
description: Discount endpoints that allow handling discounts in Medusa.
- name: Discount Condition
description: >-
Discount Condition endpoints that allow handling discount conditions in
Medusa.
- name: Draft Order
description: Draft Order endpoints that allow handling draft orders in Medusa.
- name: Gift Card
description: Gift Card endpoints that allow handling gift cards in Medusa.
- name: Invite
description: Invite endpoints that allow handling invites in Medusa.
- name: Note
description: Note endpoints that allow handling notes in Medusa.
- name: Notification
description: Notification endpoints that allow handling notifications in Medusa.
- name: Order
description: Order endpoints that allow handling orders in Medusa.
- name: Price List
description: Price List endpoints that allow handling price lists in Medusa.
- name: Product
description: Product endpoints that allow handling products in Medusa.
- name: Product Tag
description: Product Tag endpoints that allow handling product tags in Medusa.
- name: Product Type
description: Product Types endpoints that allow handling product types in Medusa.
- name: Product Variant
description: Product Variant endpoints that allow handling product variants in Medusa.
- name: Region
description: Region endpoints that allow handling regions in Medusa.
- name: Return Reason
description: Return Reason endpoints that allow handling return reasons in Medusa.
- name: Return
description: Return endpoints that allow handling returns in Medusa.
- name: Sales Channel
description: Sales Channel endpoints that allow handling sales channels in Medusa.
- name: Shipping Option
description: Shipping Option endpoints that allow handling shipping options in Medusa.
- name: Shipping Profile
description: >-
Shipping Profile endpoints that allow handling shipping profiles in
Medusa.
- name: Store
description: Store endpoints that allow handling stores in Medusa.
- name: Swap
description: Swap endpoints that allow handling swaps in Medusa.
- name: Tax Rate
description: Tax Rate endpoints that allow handling tax rates in Medusa.
- name: Upload
description: Upload endpoints that allow handling uploads in Medusa.
- name: User
description: User endpoints that allow handling users in Medusa.
servers:
- url: 'https://api.medusa-commerce.com/admin'
paths:
/apps/authorizations:
post:
operationId: PostApps
summary: Generate Token for App
description: Generates a token for an application.
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostAppsReq'
x-codegen:
method: authorize
x-codeSamples:
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/apps/authorizations' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"application_name": "example",
"state": "ready",
"code": "token"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- App
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminAppsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/apps:
get:
operationId: GetApps
summary: List Applications
description: Retrieve a list of applications.
x-authenticated: true
x-codegen:
method: list
x-codeSamples:
- lang: Shell
label: cURL
source: |
curl --location --request GET 'https://medusa-url.com/admin/apps' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- App
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminAppsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/auth:
post:
operationId: PostAuth
summary: User Login
x-authenticated: false
description: Logs a User in and authorizes them to manage Store settings.
parameters: []
requestBody:
content:
application/json:
schema:
type: object
required:
- email
- password
properties:
email:
type: string
description: The User's email.
password:
type: string
description: The User's password.
x-codegen:
method: createSession
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries:
3 })
medusa.admin.auth.createSession({
email: 'user@example.com',
password: 'supersecret'
}).then((({ user }) => {
console.log(user.id);
});
- lang: Shell
label: cURL
source: |
curl --location --request POST 'https://medusa-url.com/admin/auth' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com",
"password": "supersecret"
}'
tags:
- Auth
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminAuthRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/incorrect_credentials'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteAuth
summary: User Logout
x-authenticated: true
description: Deletes the current session for the logged in user.
x-codegen:
method: deleteSession
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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()
- lang: Shell
label: cURL
source: >
curl --location --request DELETE 'https://medusa-url.com/admin/auth'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Auth
responses:
'200':
description: OK
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetAuth
summary: Get Current User
x-authenticated: true
description: Gets the currently logged in User.
x-codegen:
method: getSession
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: |
curl --location --request GET 'https://medusa-url.com/admin/auth' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Auth
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminAuthRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/batch-jobs/{id}/cancel':
post:
operationId: PostBatchJobsBatchJobCancel
summary: Cancel a Batch Job
description: Marks a batch job as canceled
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the batch job.
schema:
type: string
x-codegen:
method: cancel
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/batch-jobs/{id}/cancel' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Batch Job
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminBatchJobRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/batch-jobs/{id}/confirm':
post:
operationId: PostBatchJobsBatchJobConfirmProcessing
summary: Confirm a Batch Job
description: Confirms that a previously requested batch job should be executed.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the batch job.
schema:
type: string
x-codegen:
method: confirm
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/batch-jobs/{id}/confirm' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Batch Job
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminBatchJobRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/batch-jobs:
post:
operationId: PostBatchJobs
summary: Create a Batch Job
description: Creates a Batch Job.
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostBatchesReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
type: 'product-export',
context: {},
dry_run: false
}).then((({ batch_job }) => {
console.log(batch_job.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/batch-jobs' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_token}' \
--data-raw '{
"type": "product-export",
"context": { }
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Batch Job
responses:
'201':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminBatchJobRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetBatchJobs
summary: List Batch Jobs
description: Retrieve a list of Batch Jobs.
x-authenticated: true
parameters:
- in: query
name: limit
description: The number of batch jobs to return.
schema:
type: integer
default: 10
- in: query
name: offset
description: The number of batch jobs to skip before results.
schema:
type: integer
default: 0
- in: query
name: id
style: form
explode: false
description: Filter by the batch ID
schema:
oneOf:
- type: string
description: batch job ID
- type: array
description: multiple batch job IDs
items:
type: string
- in: query
name: type
style: form
explode: false
description: Filter by the batch type
schema:
type: array
items:
type: string
- in: query
name: confirmed_at
style: form
explode: false
description: >-
Date comparison for when resulting collections was confirmed, i.e.
less than, greater than etc.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: pre_processed_at
style: form
explode: false
description: >-
Date comparison for when resulting collections was pre processed,
i.e. less than, greater than etc.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: completed_at
style: form
explode: false
description: >-
Date comparison for when resulting collections was completed, i.e.
less than, greater than etc.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: failed_at
style: form
explode: false
description: >-
Date comparison for when resulting collections was failed, i.e. less
than, greater than etc.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: canceled_at
style: form
explode: false
description: >-
Date comparison for when resulting collections was canceled, i.e.
less than, greater than etc.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: order
description: Field used to order retrieved batch jobs
schema:
type: string
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each order of
the result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each order of
the result.
schema:
type: string
- in: query
name: created_at
style: form
explode: false
description: >-
Date comparison for when resulting collections was created, i.e.
less than, greater than etc.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
style: form
explode: false
description: >-
Date comparison for when resulting collections was updated, i.e.
less than, greater than etc.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
x-codegen:
method: list
queryParams: AdminGetBatchParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/batch-jobs' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Batch Job
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminBatchJobListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/batch-jobs/{id}':
get:
operationId: GetBatchJobsBatchJob
summary: Get a Batch Job
description: Retrieves a Batch Job.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Batch Job
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/batch-jobs/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Batch Job
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminBatchJobRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/collections/{id}/products/batch':
post:
operationId: PostProductsToCollection
summary: Update Products
description: Updates products associated with a Product Collection
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Collection.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostProductsToCollectionReq'
x-codegen:
method: addProducts
x-codeSamples:
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/collections/{id}/products/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"product_ids": [
"prod_01G1G5V2MBA328390B5AXJ610F"
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Collection
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCollectionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteProductsFromCollection
summary: Remove Product
description: Removes products associated with a Product Collection
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Collection.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDeleteProductsFromCollectionReq'
x-codegen:
method: removeProducts
x-codeSamples:
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/collections/{id}/products/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"product_ids": [
"prod_01G1G5V2MBA328390B5AXJ610F"
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Collection
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDeleteProductsFromCollectionRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/collections:
post:
operationId: PostCollections
summary: Create a Collection
description: Creates a Product Collection.
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostCollectionsReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
title: 'New Collection'
})
.then(({ collection }) => {
console.log(collection.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/collections' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "New Collection"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Collection
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCollectionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetCollections
summary: List Collections
description: Retrieve a list of Product Collection.
x-authenticated: true
parameters:
- in: query
name: limit
description: The number of collections to return.
schema:
type: integer
default: 10
- in: query
name: offset
description: The number of collections to skip before the results.
schema:
type: integer
default: 0
- in: query
name: title
description: The title of collections to return.
schema:
type: string
- in: query
name: handle
description: The handle of collections to return.
schema:
type: string
- in: query
name: q
description: a search term to search titles and handles.
schema:
type: string
- in: query
name: discount_condition_id
description: >-
The discount condition id on which to filter the product
collections.
schema:
type: string
- in: query
name: created_at
description: Date comparison for when resulting collections were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting collections were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: deleted_at
description: Date comparison for when resulting collections were deleted.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
x-codegen:
method: list
queryParams: AdminGetCollectionsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/collections' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Collection
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCollectionsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/collections/{id}':
delete:
operationId: DeleteCollectionsCollection
summary: Delete a Collection
description: Deletes a Product Collection.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Collection.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/collections/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Collection
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCollectionsDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetCollectionsCollection
summary: Get a Collection
description: Retrieves a Product Collection.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product Collection
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/collections/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Collection
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCollectionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostCollectionsCollection
summary: Update a Collection
description: Updates a Product Collection.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Collection.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostCollectionsCollectionReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(collection_id, {
title: 'New Collection'
})
.then(({ collection }) => {
console.log(collection.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/collections/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "New Collection"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Collection
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCollectionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/currencies:
get:
operationId: GetCurrencies
summary: List Currency
description: Retrieves a list of Currency
x-authenticated: true
parameters:
- in: query
name: code
description: Code of the currency to search for.
schema:
type: string
- in: query
name: includes_tax
description: Search for tax inclusive currencies.
schema:
type: boolean
- in: query
name: order
description: order to retrieve products in.
schema:
type: string
- in: query
name: offset
description: How many products to skip in the result.
schema:
type: number
default: '0'
- in: query
name: limit
description: Limit the number of products returned.
schema:
type: number
default: '20'
x-codegen:
method: list
queryParams: AdminGetCurrenciesParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/currencies' \
--header 'Authorization: Bearer {api_token}'
tags:
- Currency
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCurrenciesListRes'
'/currencies/{code}':
post:
operationId: PostCurrenciesCurrency
summary: Update a Currency
description: Update a Currency
x-authenticated: true
parameters:
- in: path
name: code
required: true
description: The code of the Currency.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostCurrenciesCurrencyReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(code, {
includes_tax: true
})
.then(({ currency }) => {
console.log(currency.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/currencies/{code}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"includes_tax": true
}'
tags:
- Currency
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCurrenciesRes'
'/customer-groups/{id}/customers/batch':
post:
operationId: PostCustomerGroupsGroupCustomersBatch
summary: Add Customers
description: 'Adds a list of customers, represented by id''s, to a customer group.'
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the customer group.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostCustomerGroupsGroupCustomersBatchReq
x-codegen:
method: addCustomers
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addCustomers(customer_group_id, {
customer_ids: [
{
id: customer_id
}
]
})
.then(({ customer_group }) => {
console.log(customer_group.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/customer-groups/{id}/customers/batch'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"customer_ids": [
{
"id": "cus_01G2Q4BS9GAHDBMDEN4ZQZCJB2"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer Group
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomerGroupsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteCustomerGroupsGroupCustomerBatch
summary: Remove Customers
description: 'Removes a list of customers, represented by id''s, from a customer group.'
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the customer group.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminDeleteCustomerGroupsGroupCustomerBatchReq
x-codegen:
method: removeCustomers
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.removeCustomers(customer_group_id, {
customer_ids: [
{
id: customer_id
}
]
})
.then(({ customer_group }) => {
console.log(customer_group.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/customer-groups/{id}/customers/batch'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"customer_ids": [
{
"id": "cus_01G2Q4BS9GAHDBMDEN4ZQZCJB2"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer Group
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomerGroupsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/customer-groups:
post:
operationId: PostCustomerGroups
summary: Create a Customer Group
description: Creates a CustomerGroup.
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostCustomerGroupsReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
name: 'VIP'
})
.then(({ customer_group }) => {
console.log(customer_group.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/customer-groups' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "VIP"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer Group
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomerGroupsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetCustomerGroups
summary: List Customer Groups
description: Retrieve a list of customer groups.
x-authenticated: true
parameters:
- in: query
name: q
description: Query used for searching customer group names.
schema:
type: string
- in: query
name: offset
description: How many groups to skip in the result.
schema:
type: integer
default: 0
- in: query
name: order
description: the field used to order the customer groups.
schema:
type: string
- in: query
name: discount_condition_id
description: The discount condition id on which to filter the customer groups.
schema:
type: string
- in: query
name: id
style: form
explode: false
description: Filter by the customer group ID
schema:
oneOf:
- type: string
description: customer group ID
- type: array
description: multiple customer group IDs
items:
type: string
- type: object
properties:
lt:
type: string
description: filter by IDs less than this ID
gt:
type: string
description: filter by IDs greater than this ID
lte:
type: string
description: filter by IDs less than or equal to this ID
gte:
type: string
description: filter by IDs greater than or equal to this ID
- in: query
name: name
style: form
explode: false
description: Filter by the customer group name
schema:
type: array
description: multiple customer group names
items:
type: string
description: customer group name
- in: query
name: created_at
description: Date comparison for when resulting customer groups were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting customer groups were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: limit
description: Limit the number of customer groups returned.
schema:
type: integer
default: 10
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each customer
groups of the result.
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetCustomerGroupsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/customer-groups' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer Group
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomerGroupsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/customer-groups/{id}':
delete:
operationId: DeleteCustomerGroupsCustomerGroup
summary: Delete a Customer Group
description: Deletes a CustomerGroup.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Customer Group
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/customer-groups/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer Group
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomerGroupsDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetCustomerGroupsGroup
summary: Get a Customer Group
description: Retrieves a Customer Group.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Customer Group.
schema:
type: string
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in the customer
group.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in the customer
group.
schema:
type: string
x-codegen:
method: retrieve
queryParams: AdminGetCustomerGroupsGroupParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/customer-groups/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer Group
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomerGroupsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostCustomerGroupsGroup
summary: Update a Customer Group
description: Update a CustomerGroup.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the customer group.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostCustomerGroupsGroupReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(customer_group_id, {
name: 'VIP'
})
.then(({ customer_group }) => {
console.log(customer_group.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/customer-groups/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "VIP"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer Group
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomerGroupsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/customer-groups/{id}/customers':
get:
operationId: GetCustomerGroupsGroupCustomers
summary: List Customers
description: Retrieves a list of customers in a customer group
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the customer group.
schema:
type: string
- in: query
name: limit
description: The number of items to return.
schema:
type: integer
default: 50
- in: query
name: offset
description: The items to skip before result.
schema:
type: integer
default: 0
- in: query
name: expand
description: (Comma separated) Which fields should be expanded in each customer.
schema:
type: string
- in: query
name: q
description: 'a search term to search email, first_name, and last_name.'
schema:
type: string
x-codegen:
method: listCustomers
queryParams: AdminGetGroupsGroupCustomersParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/customer-groups/{id}/customers' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer Group
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomersListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/customers:
post:
operationId: PostCustomers
summary: Create a Customer
description: Creates a Customer.
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostCustomersReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
email: 'user@example.com',
first_name: 'Caterina',
last_name: 'Yost',
password: 'supersecret'
})
.then(({ customer }) => {
console.log(customer.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/customers' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com",
"first_name": "Caterina",
"last_name": "Yost",
"password": "supersecret"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer
responses:
'201':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetCustomers
summary: List Customers
description: Retrieves a list of Customers.
x-authenticated: true
parameters:
- in: query
name: limit
description: The number of items to return.
schema:
type: integer
default: 50
- in: query
name: offset
description: The items to skip before result.
schema:
type: integer
default: 0
- in: query
name: expand
description: (Comma separated) Which fields should be expanded in each customer.
schema:
type: string
- in: query
name: q
description: 'a search term to search email, first_name, and last_name.'
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetCustomersParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/customers' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomersListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/customers/{id}':
get:
operationId: GetCustomersCustomer
summary: Get a Customer
description: Retrieves a Customer.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Customer.
schema:
type: string
- in: query
name: expand
description: (Comma separated) Which fields should be expanded in the customer.
schema:
type: string
- in: query
name: fields
description: (Comma separated) Which fields should be included in the customer.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/customers/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostCustomersCustomer
summary: Update a Customer
description: Updates a Customer.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Customer.
schema:
type: string
- in: query
name: expand
description: (Comma separated) Which fields should be expanded in each customer.
schema:
type: string
- in: query
name: fields
description: (Comma separated) Which fields should be retrieved in each customer.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostCustomersCustomerReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(customer_id, {
first_name: 'Dolly'
})
.then(({ customer }) => {
console.log(customer.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/customers/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"first_name": "Dolly"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Customer
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCustomersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/discounts/{id}/regions/{region_id}':
post:
operationId: PostDiscountsDiscountRegionsRegion
summary: Add Region
description: Adds a Region to the list of Regions that a Discount can be used in.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Discount.
schema:
type: string
- in: path
name: region_id
required: true
description: The ID of the Region.
schema:
type: string
x-codegen:
method: addRegion
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/discounts/{id}/regions/{region_id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteDiscountsDiscountRegionsRegion
summary: Remove Region
x-authenticated: true
description: >-
Removes a Region from the list of Regions that a Discount can be used
in.
parameters:
- in: path
name: id
required: true
description: The ID of the Discount.
schema:
type: string
- in: path
name: region_id
required: true
description: The ID of the Region.
schema:
type: string
x-codegen:
method: removeRegion
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/discounts/{id}/regions/{region_id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/discounts/{discount_id}/conditions/{condition_id}/batch':
post:
operationId: PostDiscountsDiscountConditionsConditionBatch
summary: Add Batch Resources
description: Add a batch of resources to a discount condition.
x-authenticated: true
parameters:
- in: path
name: discount_id
required: true
description: The ID of the Product.
schema:
type: string
- in: path
name: condition_id
required: true
description: The ID of the condition on which to add the item.
schema:
type: string
- in: query
name: expand
description: >-
(Comma separated) Which relations should be expanded in each
discount of the result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each discount
of the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostDiscountsDiscountConditionsConditionBatchReq
x-codegen:
method: addConditionResourceBatch
queryParams: AdminPostDiscountsDiscountConditionsConditionBatchParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addConditionResourceBatch(discount_id,
condition_id, {
resources: [{ id: item_id }]
})
.then(({ discount }) => {
console.log(discount.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}/batch'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"resources": [{ "id": "item_id" }]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount Condition
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteDiscountsDiscountConditionsConditionBatch
summary: Delete Batch Resources
description: Delete a batch of resources from a discount condition.
x-authenticated: true
parameters:
- in: path
name: discount_id
required: true
description: The ID of the Product.
schema:
type: string
- in: path
name: condition_id
required: true
description: The ID of the condition on which to add the item.
schema:
type: string
- in: query
name: expand
description: >-
(Comma separated) Which relations should be expanded in each
discount of the result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each discount
of the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminDeleteDiscountsDiscountConditionsConditionBatchReq
x-codegen:
method: deleteConditionResourceBatch
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.deleteConditionResourceBatch(discount_id,
condition_id, {
resources: [{ id: item_id }]
})
.then(({ discount }) => {
console.log(discount.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}/batch'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"resources": [{ "id": "item_id" }]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount Condition
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/discounts/{discount_id}/conditions':
post:
operationId: PostDiscountsDiscountConditions
summary: Create a Condition
description: >-
Creates a DiscountCondition. Only one of `products`, `product_types`,
`product_collections`, `product_tags`, and `customer_groups` should be
provided.
x-authenticated: true
parameters:
- in: path
name: discount_id
required: true
description: The ID of the Product.
schema:
type: string
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each product of
the result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each product of
the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostDiscountsDiscountConditions'
x-codegen:
method: createCondition
queryParams: AdminPostDiscountsDiscountConditionsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@medusajs/medusa-js"
import { DiscountConditionOperator } from "@medusajs/medusa"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries:
3 })
// must be previously logged in or use api token
medusa.admin.discounts.createCondition(discount_id, {
operator: DiscountConditionOperator.IN
})
.then(({ discount }) => {
console.log(discount.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/discounts/{id}/conditions' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"operator": "in"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount Condition
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/discounts:
post:
operationId: PostDiscounts
summary: Creates a Discount
x-authenticated: true
description: >-
Creates a Discount with a given set of rules that define how the
Discount behaves.
parameters:
- in: query
name: expand
description: (Comma separated) Which fields should be expanded in the results.
schema:
type: string
- in: query
name: fields
description: (Comma separated) Which fields should be retrieved in the results.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostDiscountsReq'
x-codegen:
method: create
queryParams: AdminPostDiscountsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@medusajs/medusa-js"
import { AllocationType, DiscountRuleType } from "@medusajs/medusa"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries:
3 })
// must be previously logged in or use api token
medusa.admin.discounts.create({
code: 'TEST',
rule: {
type: DiscountRuleType.FIXED,
value: 10,
allocation: AllocationType.ITEM
},
regions: ["reg_XXXXXXXX"],
is_dynamic: false,
is_disabled: false
})
.then(({ discount }) => {
console.log(discount.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/discounts' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"code": "TEST",
"rule": {
"type": "fixed",
"value": 10,
"allocation": "item"
},
"regions": ["reg_XXXXXXXX"]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetDiscounts
summary: List Discounts
x-authenticated: true
description: Retrieves a list of Discounts
parameters:
- in: query
name: q
description: Search query applied on the code field.
schema:
type: string
- in: query
name: rule
description: Discount Rules filters to apply on the search
schema:
type: object
properties:
type:
type: string
enum:
- fixed
- percentage
- free_shipping
description: >-
The type of the Discount, can be `fixed` for discounts that
reduce the price by a fixed amount, `percentage` for
percentage reductions or `free_shipping` for shipping
vouchers.
allocation:
type: string
enum:
- total
- item
description: >-
The value that the discount represents; this will depend on
the type of the discount
- in: query
name: is_dynamic
description: Return only dynamic discounts.
schema:
type: boolean
- in: query
name: is_disabled
description: Return only disabled discounts.
schema:
type: boolean
- in: query
name: limit
description: The number of items in the response
schema:
type: number
default: '20'
- in: query
name: offset
description: The offset of items in response
schema:
type: number
default: '0'
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetDiscountsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/discounts' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/discounts/{id}/dynamic-codes':
post:
operationId: PostDiscountsDiscountDynamicCodes
summary: Create a Dynamic Code
description: >-
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.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Discount to create the dynamic code from."
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostDiscountsDiscountDynamicCodesReq'
x-codegen:
method: createDynamicCode
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.createDynamicCode(discount_id, {
code: 'TEST',
usage_limit: 1
})
.then(({ discount }) => {
console.log(discount.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/discounts/{id}/dynamic-codes' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"code": "TEST"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/discounts/{discount_id}/conditions/{condition_id}':
delete:
operationId: DeleteDiscountsDiscountConditionsCondition
summary: Delete a Condition
description: Deletes a DiscountCondition
x-authenticated: true
parameters:
- in: path
name: discount_id
required: true
description: The ID of the Discount
schema:
type: string
- in: path
name: condition_id
required: true
description: The ID of the DiscountCondition
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codegen:
method: deleteCondition
queryParams: AdminDeleteDiscountsDiscountConditionsConditionParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount Condition
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountConditionsDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetDiscountsDiscountConditionsCondition
summary: Get a Condition
description: Gets a DiscountCondition
x-authenticated: true
parameters:
- in: path
name: discount_id
required: true
description: The ID of the Discount.
schema:
type: string
- in: path
name: condition_id
required: true
description: The ID of the DiscountCondition.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codegen:
method: getCondition
queryParams: AdminGetDiscountsDiscountConditionsConditionParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/discounts/{id}/conditions/{condition_id}'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount Condition
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountConditionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostDiscountsDiscountConditionsCondition
summary: Update a Condition
description: >-
Updates a DiscountCondition. Only one of `products`, `product_types`,
`product_collections`, `product_tags`, and `customer_groups` should be
provided.
x-authenticated: true
parameters:
- in: path
name: discount_id
required: true
description: The ID of the Product.
schema:
type: string
- in: path
name: condition_id
required: true
description: The ID of the DiscountCondition.
schema:
type: string
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each item of
the result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each item of
the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostDiscountsDiscountConditionsCondition
x-codegen:
method: updateCondition
queryParams: AdminPostDiscountsDiscountConditionsConditionParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.updateCondition(discount_id, condition_id, {
products: [
product_id
]
})
.then(({ discount }) => {
console.log(discount.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/discounts/{id}/conditions/{condition}'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"products": [
"prod_01G1G5V2MBA328390B5AXJ610F"
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/discounts/{id}':
delete:
operationId: DeleteDiscountsDiscount
summary: Delete a Discount
description: Deletes a Discount.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Discount
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/discounts/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetDiscountsDiscount
summary: Get a Discount
description: Retrieves a Discount
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Discount
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codegen:
method: retrieve
queryParams: AdminGetDiscountParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/discounts/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostDiscountsDiscount
summary: Update a Discount
description: >-
Updates a Discount with a given set of rules that define how the
Discount behaves.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Discount.
schema:
type: string
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each item of
the result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each item of
the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostDiscountsDiscountReq'
x-codegen:
method: update
queryParams: AdminPostDiscountsDiscountParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(discount_id, {
code: 'TEST'
})
.then(({ discount }) => {
console.log(discount.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/discounts/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"code": "TEST"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/discounts/{id}/dynamic-codes/{code}':
delete:
operationId: DeleteDiscountsDiscountDynamicCodesCode
summary: Delete a Dynamic Code
description: Deletes a dynamic code from a Discount.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Discount
schema:
type: string
- in: path
name: code
required: true
description: The ID of the Discount
schema:
type: string
x-codegen:
method: deleteDynamicCode
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/discounts/{id}/dynamic-codes/{code}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/discounts/code/{code}':
get:
operationId: GetDiscountsDiscountCode
summary: Get Discount by Code
description: Retrieves a Discount by its discount code
x-authenticated: true
parameters:
- in: path
name: code
required: true
description: The code of the Discount
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codegen:
method: retrieveByCode
queryParams: AdminGetDiscountsDiscountCodeParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/discounts/code/{code}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Discount
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDiscountsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/draft-orders:
post:
operationId: PostDraftOrders
summary: Create a Draft Order
description: Creates a Draft Order
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostDraftOrdersReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
email: 'user@example.com',
region_id,
items: [
{
quantity: 1
}
],
shipping_methods: [
{
option_id
}
],
})
.then(({ draft_order }) => {
console.log(draft_order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/draft-orders' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com",
"region_id": "{region_id}"
"items": [
{
"quantity": 1
}
],
"shipping_methods": [
{
"option_id": "{option_id}"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Draft Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDraftOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetDraftOrders
summary: List Draft Orders
description: Retrieves an list of Draft Orders
x-authenticated: true
parameters:
- in: query
name: offset
description: The number of items to skip before the results.
schema:
type: number
default: '0'
- in: query
name: limit
description: Limit the number of items returned.
schema:
type: number
default: '50'
- in: query
name: q
description: >-
a search term to search emails in carts associated with draft orders
and display IDs of draft orders
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetDraftOrdersParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/draft-orders' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Draft Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDraftOrdersListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/draft-orders/{id}/line-items':
post:
operationId: PostDraftOrdersDraftOrderLineItems
summary: Create a Line Item
description: Creates a Line Item for the Draft Order
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Draft Order.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostDraftOrdersDraftOrderLineItemsReq'
x-codegen:
method: addLineItem
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addLineItem(draft_order_id, {
quantity: 1
})
.then(({ draft_order }) => {
console.log(draft_order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/draft-orders/{id}/line-items' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"quantity": 1
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Draft Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDraftOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/draft-orders/{id}':
delete:
operationId: DeleteDraftOrdersDraftOrder
summary: Delete a Draft Order
description: Deletes a Draft Order
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Draft Order.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/draft-orders/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Draft Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDraftOrdersDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetDraftOrdersDraftOrder
summary: Get a Draft Order
description: Retrieves a Draft Order.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Draft Order.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/draft-orders/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Draft Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDraftOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/draft-orders/{id}/line-items/{line_id}':
delete:
operationId: DeleteDraftOrdersDraftOrderLineItemsItem
summary: Delete a Line Item
description: Removes a Line Item from a Draft Order.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Draft Order.
schema:
type: string
- in: path
name: line_id
required: true
description: The ID of the Draft Order.
schema:
type: string
x-codegen:
method: removeLineItem
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Draft Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDraftOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostDraftOrdersDraftOrderLineItemsItem
summary: Update a Line Item
description: Updates a Line Item for a Draft Order
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Draft Order.
schema:
type: string
- in: path
name: line_id
required: true
description: The ID of the Line Item.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostDraftOrdersDraftOrderLineItemsItemReq
x-codegen:
method: updateLineItem
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.updateLineItem(draft_order_id, line_id, {
quantity: 1
})
.then(({ draft_order }) => {
console.log(draft_order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/draft-orders/{id}/line-items/{line_id}'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"quantity": 1
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Draft Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDraftOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/draft-orders/{id}/pay':
post:
summary: Registers a Payment
operationId: PostDraftOrdersDraftOrderRegisterPayment
description: Registers a payment for a Draft Order.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The Draft Order id.
schema:
type: string
x-codegen:
method: markPaid
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/draft-orders/{id}/pay' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Draft Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostDraftOrdersDraftOrderRegisterPaymentRes
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/admin/draft-orders/{id}':
post:
operationId: PostDraftOrdersDraftOrder
summary: Update a Draft Order
description: Updates a Draft Order.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Draft Order.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostDraftOrdersDraftOrderReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(draft_order_id, {
email: "user@example.com"
})
.then(({ draft_order }) => {
console.log(draft_order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/draft-orders/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Draft Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDraftOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/gift-cards:
post:
operationId: PostGiftCards
summary: Create a Gift Card
description: >-
Creates a Gift Card that can redeemed by its unique code. The Gift Card
is only valid within 1 region.
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostGiftCardsReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
region_id
})
.then(({ gift_card }) => {
console.log(gift_card.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/gift-cards' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"region_id": "{region_id}"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Gift Card
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminGiftCardsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetGiftCards
summary: List Gift Cards
description: Retrieves a list of Gift Cards.
x-authenticated: true
parameters:
- in: query
name: offset
description: The number of items to skip before the results.
schema:
type: number
default: '0'
- in: query
name: limit
description: Limit the number of items returned.
schema:
type: number
default: '50'
- in: query
name: q
description: a search term to search by code or display ID
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetGiftCardsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/gift-cards' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Gift Card
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminGiftCardsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/gift-cards/{id}':
delete:
operationId: DeleteGiftCardsGiftCard
summary: Delete a Gift Card
description: Deletes a Gift Card
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Gift Card to delete.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/gift-cards/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Gift Card
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminGiftCardsDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetGiftCardsGiftCard
summary: Get a Gift Card
description: Retrieves a Gift Card.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Gift Card.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/gift-cards/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Gift Card
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminGiftCardsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostGiftCardsGiftCard
summary: Update a Gift Card
description: >-
Update a Gift Card that can redeemed by its unique code. The Gift Card
is only valid within 1 region.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Gift Card.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostGiftCardsGiftCardReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(gift_card_id, {
region_id
})
.then(({ gift_card }) => {
console.log(gift_card.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/gift-cards/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"region_id": "{region_id}"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Gift Card
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminGiftCardsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/inventory-items/{id}/location-levels':
post:
operationId: PostInventoryItemsInventoryItemLocationLevels
summary: Create an Inventory Location Level for a given Inventory Item.
description: Creates an Inventory Location Level for a given Inventory Item.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Inventory Item.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostInventoryItemsItemLocationLevelsReq
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.createLocationLevel(inventoryItemId, {
location_id: 'sloc',
stocked_quantity: 10,
})
.then(({ inventory_item }) => {
console.log(inventory_item.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/inventory-items/{id}/location-levels'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"location_id": "sloc",
"stocked_quantity": 10
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Inventory Items
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminInventoryItemsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetInventoryItemsInventoryItemLocationLevels
summary: List stock levels of a given location.
description: Lists stock levels of a given location.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Inventory Item.
schema:
type: string
- in: query
name: offset
description: How many stock locations levels to skip in the result.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of stock locations levels returned.
schema:
type: integer
default: 20
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/inventory-items/{id}/location-levels'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json'
security:
- api_token: []
- cookie_auth: []
tags:
- Inventory Items
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminInventoryItemsLocationLevelsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/inventory-items/{id}':
delete:
operationId: DeleteInventoryItemsInventoryItem
summary: Delete an Inventory Item
description: Delete an Inventory Item
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Inventory Item to delete.
schema:
type: string
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/inventory-items/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- InventoryItem
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminInventoryItemsDeleteRes'
'400':
$ref: '#/components/responses/400_error'
get:
operationId: GetInventoryItemsInventoryItem
summary: Retrive an Inventory Item.
description: Retrives an Inventory Item.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Inventory Item.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/inventory-items/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json'
security:
- api_token: []
- cookie_auth: []
tags:
- Inventory Items
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminInventoryItemsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostInventoryItemsInventoryItem
summary: Update an Inventory Item.
description: Updates an Inventory Item.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Inventory Item.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostInventoryItemsInventoryItemReq'
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(inventoryItemId, {
origin_country: "US",
})
.then(({ inventory_item }) => {
console.log(inventory_item.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/inventory-items/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"origin_country": "US"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Inventory Items
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminInventoryItemsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/inventory-items/{id}/location-levels/{location_id}':
delete:
operationId: DeleteInventoryItemsInventoryIteLocationLevelsLocation
summary: Delete a location level of an Inventory Item.
description: Delete a location level of an Inventory Item.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Inventory Item.
schema:
type: string
- in: path
name: location_id
required: true
description: The ID of the location.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/inventory-items/{id}/location-levels/{location_id}'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json'
security:
- api_token: []
- cookie_auth: []
tags:
- Inventory Items
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminInventoryItemsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostInventoryItemsInventoryItemLocationLevelsLocationLevel
summary: Update an Inventory Location Level for a given Inventory Item.
description: Updates an Inventory Location Level for a given Inventory Item.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Inventory Item.
schema:
type: string
- in: path
name: location_id
required: true
description: The ID of the Location.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostInventoryItemsItemLocationLevelsLevelReq
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.updateLocationLevel(inventoryItemId,
locationId, {
stocked_quantity: 15,
})
.then(({ inventory_item }) => {
console.log(inventory_item.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/inventory-items/{id}/location-levels/{location_id}'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"stocked_quantity": 15
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Inventory Items
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminInventoryItemsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/inventory-items:
get:
operationId: GetInventoryItems
summary: List inventory items.
description: Lists inventory items.
x-authenticated: true
parameters:
- in: query
name: offset
description: How many inventory items to skip in the result.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of inventory items returned.
schema:
type: integer
default: 20
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
- in: query
name: q
description: >-
Query used for searching product inventory items and their
properties.
schema:
type: string
- in: query
name: location_id
style: form
explode: false
description: Locations ids to search for.
schema:
type: array
items:
type: string
- in: query
name: id
description: id to search for.
schema:
type: string
- in: query
name: sku
description: sku to search for.
schema:
type: string
- in: query
name: origin_country
description: origin_country to search for.
schema:
type: string
- in: query
name: mid_code
description: mid_code to search for.
schema:
type: string
- in: query
name: material
description: material to search for.
schema:
type: string
- in: query
name: hs_code
description: hs_code to search for.
schema:
type: string
- in: query
name: weight
description: weight to search for.
schema:
type: string
- in: query
name: length
description: length to search for.
schema:
type: string
- in: query
name: height
description: height to search for.
schema:
type: string
- in: query
name: width
description: width to search for.
schema:
type: string
- in: query
name: requires_shipping
description: requires_shipping to search for.
schema:
type: string
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/inventory-items' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json'
security:
- api_token: []
- cookie_auth: []
tags:
- Inventory Items
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminInventoryItemsListWithVariantsAndLocationLevelsRes
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/invites/accept:
post:
operationId: PostInvitesInviteAccept
summary: Accept an Invite
description: Accepts an Invite and creates a corresponding user
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostInvitesInviteAcceptReq'
x-codegen:
method: accept
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.accept({
token,
user: {
first_name: 'Brigitte',
last_name: 'Collier',
password: 'supersecret'
}
})
.then(() => {
// successful
})
.catch(() => {
// an error occurred
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/invites/accept' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"token": "{token}",
"user": {
"first_name": "Brigitte",
"last_name": "Collier",
"password": "supersecret"
}
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Invite
responses:
'200':
description: OK
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/invites:
post:
operationId: PostInvites
summary: Create an Invite
description: Creates an Invite and triggers an 'invite' created event
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostInvitesReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
user: "user@example.com",
role: "admin"
})
.then(() => {
// successful
})
.catch(() => {
// an error occurred
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/invites' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"user": "user@example.com",
"role": "admin"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Invite
responses:
'200':
description: OK
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetInvites
summary: Lists Invites
description: Lists all Invites
x-authenticated: true
x-codegen:
method: list
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET 'https://medusa-url.com/admin/invites'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Invite
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminListInvitesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/invites/{invite_id}':
delete:
operationId: DeleteInvitesInvite
summary: Delete an Invite
description: Deletes an Invite
x-authenticated: true
parameters:
- in: path
name: invite_id
required: true
description: The ID of the Invite
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/invites/{invite_id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Invite
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminInviteDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/invites/{invite_id}/resend':
post:
operationId: PostInvitesInviteResend
summary: Resend an Invite
description: Resends an Invite by triggering the 'invite' created event again
x-authenticated: true
parameters:
- in: path
name: invite_id
required: true
description: The ID of the Invite
schema:
type: string
x-codegen:
method: resend
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/invites/{invite_id}/resend' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Invite
responses:
'200':
description: OK
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/notes:
post:
operationId: PostNotes
summary: Creates a Note
description: Creates a Note which can be associated with any resource as required.
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostNotesReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
resource_id,
resource_type: 'order',
value: 'We delivered this order'
})
.then(({ note }) => {
console.log(note.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST 'https://medusa-url.com/admin/notes'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"resource_id": "{resource_id}",
"resource_type": "order",
"value": "We delivered this order"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Note
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminNotesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetNotes
summary: List Notes
x-authenticated: true
description: Retrieves a list of notes
parameters:
- in: query
name: limit
description: The number of notes to get
schema:
type: number
default: '50'
- in: query
name: offset
description: The offset at which to get notes
schema:
type: number
default: '0'
- in: query
name: resource_id
description: The ID which the notes belongs to
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetNotesParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: |
curl --location --request GET 'https://medusa-url.com/admin/notes' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Note
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminNotesListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/notes/{id}':
delete:
operationId: DeleteNotesNote
summary: Delete a Note
description: Deletes a Note.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Note to delete.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/notes/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Note
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminNotesDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetNotesNote
summary: Get a Note
description: Retrieves a single note using its id
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the note to retrieve.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/notes/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Note
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminNotesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostNotesNote
summary: Update a Note
x-authenticated: true
description: Updates a Note associated with some resource
parameters:
- in: path
name: id
required: true
description: The ID of the Note to update
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostNotesNoteReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(note_id, {
value: 'We delivered this order'
})
.then(({ note }) => {
console.log(note.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/notes/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"value": "We delivered this order"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Note
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminNotesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/notifications:
get:
operationId: GetNotifications
summary: List Notifications
description: Retrieves a list of Notifications.
x-authenticated: true
parameters:
- in: query
name: offset
description: >-
The number of notifications to skip before starting to collect the
notifications set
schema:
type: integer
default: 0
- in: query
name: limit
description: The number of notifications to return
schema:
type: integer
default: 50
- in: query
name: fields
description: Comma separated fields to include in the result set
schema:
type: string
- in: query
name: expand
description: Comma separated fields to populate
schema:
type: string
- in: query
name: event_name
description: The name of the event that the notification was sent for.
schema:
type: string
- in: query
name: resource_type
description: The type of resource that the Notification refers to.
schema:
type: string
- in: query
name: resource_id
description: The ID of the resource that the Notification refers to.
schema:
type: string
- in: query
name: to
description: >-
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
schema:
type: string
- in: query
name: include_resends
description: >-
A boolean indicating whether the result set should include resent
notifications or not
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetNotificationsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/notifications' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Notification
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminNotificationsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/notifications/{id}/resend':
post:
operationId: PostNotificationsNotificationResend
summary: Resend Notification
description: >-
Resends a previously sent notifications, with the same data but
optionally to a different address
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Notification
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostNotificationsNotificationResendReq'
x-codegen:
method: resend
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.resend(notification_id)
.then(({ notification }) => {
console.log(notification.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/notifications/{id}/resend' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Notification
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminNotificationsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/order-edits/{id}/items':
post:
operationId: PostOrderEditsEditLineItems
summary: Add a Line Item
description: Create an OrderEdit LineItem.
parameters:
- in: path
name: id
required: true
description: The ID of the Order Edit.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrderEditsEditLineItemsReq'
x-authenticated: true
x-codegen:
method: addLineItem
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addLineItem(order_edit_id, {
variant_id,
quantity
})
.then(({ order_edit }) => {
console.log(order_edit.id)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/order-edits/{id}/items' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{ "variant_id": "variant_01G1G5V2MRX2V3PVSR2WXYPFB6",
"quantity": 3 }'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/order-edits/{id}/cancel':
post:
operationId: PostOrderEditsOrderEditCancel
summary: Cancel an OrderEdit
description: Cancels an OrderEdit.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the OrderEdit.
schema:
type: string
x-codegen:
method: cancel
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/order-edits/{id}/cancel' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'500':
$ref: '#/components/responses/500_error'
'/order-edits/{id}/confirm':
post:
operationId: PostOrderEditsOrderEditConfirm
summary: Confirms an OrderEdit
description: Confirms an OrderEdit.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the order edit.
schema:
type: string
x-codegen:
method: confirm
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/order-edits/{id}/confirm' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'500':
$ref: '#/components/responses/500_error'
/order-edits:
post:
operationId: PostOrderEdits
summary: Create an OrderEdit
description: Creates an OrderEdit.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrderEditsReq'
x-authenticated: true
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({ order_id })
.then(({ order_edit }) => {
console.log(order_edit.id)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/order-edits' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{ "order_id": "my_order_id", "internal_note":
"my_optional_note" }'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetOrderEdits
summary: List OrderEdits
description: List OrderEdits.
x-authenticated: true
parameters:
- in: query
name: q
description: Query used for searching order edit internal note.
schema:
type: string
- in: query
name: order_id
description: List order edits by order id.
schema:
type: string
- in: query
name: limit
description: The number of items in the response
schema:
type: number
default: '20'
- in: query
name: offset
description: The offset of items in response
schema:
type: number
default: '0'
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codegen:
method: list
queryParams: GetOrderEditsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/order-edits' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/order-edits/{id}/items/{item_id}':
delete:
operationId: DeleteOrderEditsOrderEditLineItemsLineItem
summary: Delete a Line Item
description: Delete line items from an order edit and create change item
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order Edit to delete from.
schema:
type: string
- in: path
name: item_id
required: true
description: The ID of the order edit item to delete from order.
schema:
type: string
x-codegen:
method: removeLineItem
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostOrderEditsEditLineItemsLineItem
summary: Upsert Line Item Change
description: Create or update the order edit change holding the line item changes
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order Edit to update.
schema:
type: string
- in: path
name: item_id
required: true
description: The ID of the order edit item to update.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrderEditsEditLineItemsLineItemReq'
x-codegen:
method: updateLineItem
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.updateLineItem(order_edit_id, line_item_id,
{
quantity: 5
})
.then(({ order_edit }) => {
console.log(order_edit.id)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/order-edits/{id}/items/{item_id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{ "quantity": 5 }'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/order-edits/{id}/changes/{change_id}':
delete:
operationId: DeleteOrderEditsOrderEditItemChange
summary: Delete a Line Item Change
description: Deletes an Order Edit Item Change
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order Edit to delete.
schema:
type: string
- in: path
name: change_id
required: true
description: The ID of the Order Edit Item Change to delete.
schema:
type: string
x-codegen:
method: deleteItemChange
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/order-edits/{id}/changes/{change_id}'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditItemChangeDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'/order-edits/{id}':
delete:
operationId: DeleteOrderEditsOrderEdit
summary: Delete an Order Edit
description: Delete an Order Edit
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order Edit to delete.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/order-edits/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditDeleteRes'
'400':
$ref: '#/components/responses/400_error'
get:
operationId: GetOrderEditsOrderEdit
summary: Get an OrderEdit
description: Retrieves a OrderEdit.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the OrderEdit.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codegen:
method: retrieve
queryParams: GetOrderEditsOrderEditParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/order-edits/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostOrderEditsOrderEdit
summary: Update an OrderEdit
description: Updates a OrderEdit.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the OrderEdit.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrderEditsOrderEditReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(order_edit_id, {
internal_note: "internal reason XY"
})
.then(({ order_edit }) => {
console.log(order_edit.id)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/order-edits/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"internal_note": "internal reason XY"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/order-edits/{id}/request':
post:
operationId: PostOrderEditsOrderEditRequest
summary: Request Confirmation
description: Request customer confirmation of an Order Edit
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order Edit to request confirmation from.
schema:
type: string
x-codegen:
method: requestConfirmation
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/order-edits/{id}/request' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- OrderEdit
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrderEditsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/shipping-methods':
post:
operationId: PostOrdersOrderShippingMethods
summary: Add a Shipping Method
description: >-
Adds a Shipping Method to an Order. If another Shipping Method exists
with the same Shipping Profile, the previous Shipping Method will be
replaced.
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrdersOrderShippingMethodsReq'
x-authenticated: true
x-codegen:
method: addShippingMethod
params: AdminPostOrdersOrderShippingMethodsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addShippingMethod(order_id, {
price: 1000,
option_id
})
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/shipping-methods' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"price": 1000,
"option_id": "{option_id}"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/archive':
post:
operationId: PostOrdersOrderArchive
summary: Archive Order
description: Archives the order with the given id.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
x-codegen:
method: archive
params: AdminPostOrdersOrderArchiveParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/archive' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/claims/{claim_id}/cancel':
post:
operationId: PostOrdersClaimCancel
summary: Cancel a Claim
description: Cancels a Claim
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: path
name: claim_id
required: true
description: The ID of the Claim.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
x-codegen:
method: cancelClaim
params: AdminPostOrdersClaimCancel
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/cancel'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Claim
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel':
post:
operationId: PostOrdersClaimFulfillmentsCancel
summary: Cancel Claim Fulfillment
description: Registers a claim's fulfillment as canceled.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order which the Claim relates to.
schema:
type: string
- in: path
name: claim_id
required: true
description: The ID of the Claim which the Fulfillment relates to.
schema:
type: string
- in: path
name: fulfillment_id
required: true
description: The ID of the Fulfillment.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
x-codegen:
method: cancelClaimFulfillment
params: AdminPostOrdersClaimFulfillmentsCancelParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/fulfillments/{fulfillment_id}/cancel'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Fulfillment
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel':
post:
operationId: PostOrdersSwapFulfillmentsCancel
summary: Cancel Swap's Fulfilmment
description: Registers a Swap's Fulfillment as canceled.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order which the Swap relates to.
schema:
type: string
- in: path
name: swap_id
required: true
description: The ID of the Swap which the Fulfillment relates to.
schema:
type: string
- in: path
name: fulfillment_id
required: true
description: The ID of the Fulfillment.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
x-codegen:
method: cancelSwapFulfillment
params: AdminPostOrdersSwapFulfillementsCancelParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/fulfillments/{fulfillment_id}/cancel'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Fulfillment
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/fulfillments/{fulfillment_id}/cancel':
post:
operationId: PostOrdersOrderFulfillmentsCancel
summary: Cancels a Fulfilmment
description: Registers a Fulfillment as canceled.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order which the Fulfillment relates to.
schema:
type: string
- in: path
name: fulfillment_id
required: true
description: The ID of the Fulfillment
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
x-codegen:
method: cancelFulfillment
params: AdminPostOrdersOrderFulfillementsCancelParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/fulfillments/{fulfillment_id}/cancel'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Fulfillment
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/cancel':
post:
operationId: PostOrdersOrderCancel
summary: Cancel an Order
description: >-
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.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
x-codegen:
method: cancel
params: AdminPostOrdersOrderCancel
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/cancel' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/swaps/{swap_id}/cancel':
post:
operationId: PostOrdersSwapCancel
summary: Cancels a Swap
description: Cancels a Swap
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: path
name: swap_id
required: true
description: The ID of the Swap.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
x-codegen:
method: cancelSwap
params: AdminPostOrdersSwapCancelParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{order_id}/swaps/{swap_id}/cancel'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Swap
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/capture':
post:
operationId: PostOrdersOrderCapture
summary: Capture Order's Payment
description: Captures all the Payments associated with an Order.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
x-codegen:
method: capturePayment
params: AdminPostOrdersOrderCaptureParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/capture' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/complete':
post:
operationId: PostOrdersOrderComplete
summary: Complete an Order
description: Completes an Order
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
x-codegen:
method: complete
params: AdminPostOrdersOrderCompleteParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/complete' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/claims/{claim_id}/shipments':
post:
operationId: PostOrdersOrderClaimsClaimShipments
summary: Create Claim Shipment
description: Registers a Claim Fulfillment as shipped.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: path
name: claim_id
required: true
description: The ID of the Claim.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrdersOrderClaimsClaimShipmentsReq'
x-codegen:
method: createClaimShipment
params: AdminPostOrdersOrderClaimsClaimShipmentsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.createClaimShipment(order_id, claim_id, {
fulfillment_id
})
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/shipments'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"fulfillment_id": "{fulfillment_id}"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Claim
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/order/{id}/claims':
post:
operationId: PostOrdersOrderClaims
summary: Create a Claim
description: Creates a Claim.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrdersOrderClaimsReq'
x-codegen:
method: createClaim
params: AdminPostOrdersOrderClaimsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.createClaim(order_id, {
type: 'refund',
claim_items: [
{
item_id,
quantity: 1
}
]
})
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/claims' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "refund",
"claim_items": [
{
"item_id": "asdsd",
"quantity": 1
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Claim
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/fulfillment':
post:
operationId: PostOrdersOrderFulfillments
summary: Create a Fulfillment
description: >-
Creates a Fulfillment of an Order - will notify Fulfillment Providers to
prepare a shipment.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrdersOrderFulfillmentsReq'
x-codegen:
method: createFulfillment
params: AdminPostOrdersOrderFulfillmentsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.createFulfillment(order_id, {
items: [
{
item_id,
quantity: 1
}
]
})
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/fulfillment' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"items": [
{
"item_id": "{item_id}",
"quantity": 1
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Fulfillment
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/line-items/{line_item_id}/reserve':
post:
operationId: PostOrdersOrderLineItemReservations
summary: Create a Reservation for a line item
description: >-
Creates a Reservation for a line item at a specified location,
optionally for a partial quantity.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: path
name: line_item_id
required: true
description: The ID of the Line item.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersOrderLineItemReservationReq'
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.createReservation(order_id, line_item_id, {
location_id
})
.then(({ reservation }) => {
console.log(reservation.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/line-items/{line_item_id}/reservations'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"location_id": "loc_1"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostReservationsReq'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/shipment':
post:
operationId: PostOrdersOrderShipment
summary: Create a Shipment
description: Registers a Fulfillment as shipped.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrdersOrderShipmentReq'
x-codegen:
method: createShipment
params: AdminPostOrdersOrderShipmentParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.createShipment(order_id, {
fulfillment_id
})
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/shipment' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"fulfillment_id": "{fulfillment_id}"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/swaps/{swap_id}/shipments':
post:
operationId: PostOrdersOrderSwapsSwapShipments
summary: Create Swap Shipment
description: Registers a Swap Fulfillment as shipped.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: path
name: swap_id
required: true
description: The ID of the Swap.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrdersOrderSwapsSwapShipmentsReq'
x-codegen:
method: createSwapShipment
params: AdminPostOrdersOrderSwapsSwapShipmentsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.createSwapShipment(order_id, swap_id, {
fulfillment_id
})
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/shipments'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"fulfillment_id": "{fulfillment_id}"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Swap
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/order/{id}/swaps':
post:
operationId: PostOrdersOrderSwaps
summary: Create a Swap
description: >-
Creates a Swap. Swaps are used to handle Return of previously purchased
goods and Fulfillment of replacements simultaneously.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded the order of the
result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included the order of the
result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrdersOrderSwapsReq'
x-codegen:
method: createSwap
queryParams: AdminPostOrdersOrderSwapsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.createSwap(order_id, {
return_items: [
{
item_id,
quantity: 1
}
]
})
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/swaps' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"return_items": [
{
"item_id": "asfasf",
"quantity": 1
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Swap
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/claims/{claim_id}/fulfillments':
post:
operationId: PostOrdersOrderClaimsClaimFulfillments
summary: Create Claim Fulfillment
description: Creates a Fulfillment for a Claim.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: path
name: claim_id
required: true
description: The ID of the Claim.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostOrdersOrderClaimsClaimFulfillmentsReq
x-codegen:
method: fulfillClaim
params: AdminPostOrdersOrderClaimsClaimFulfillmentsReq
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.fulfillClaim(order_id, claim_id)
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}/fulfillments'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Fulfillment
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/swaps/{swap_id}/fulfillments':
post:
operationId: PostOrdersOrderSwapsSwapFulfillments
summary: Create Swap Fulfillment
description: Creates a Fulfillment for a Swap.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: path
name: swap_id
required: true
description: The ID of the Swap.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostOrdersOrderSwapsSwapFulfillmentsReq
x-codegen:
method: fulfillSwap
params: AdminPostOrdersOrderSwapsSwapFulfillmentsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.fulfillSwap(order_id, swap_id)
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/fulfillments'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Fulfillment
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}':
get:
operationId: GetOrdersOrder
summary: Get an Order
description: Retrieves an Order
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codegen:
method: retrieve
queryParams: AdminGetOrdersOrderParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/orders/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostOrdersOrder
summary: Update an Order
description: Updates and order
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrdersOrderReq'
x-codegen:
method: update
params: AdminPostOrdersOrderParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(order_id, {
email: 'user@example.com'
})
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/adasda' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/reservations':
get:
operationId: GetOrdersOrderReservations
summary: Get reservations for an Order
description: Retrieves reservations for an Order
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: offset
description: How many reservations to skip before the results.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of reservations returned.
schema:
type: integer
default: 20
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/orders/{id}/reservations' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminGetReservationReservationsReq'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/orders:
get:
operationId: GetOrders
summary: List Orders
description: Retrieves a list of Orders
x-authenticated: true
parameters:
- in: query
name: q
description: >-
Query used for searching orders by shipping address first name,
orders' email, and orders' display ID
schema:
type: string
- in: query
name: id
description: ID of the order to search for.
schema:
type: string
- in: query
name: status
style: form
explode: false
description: Status to search for
schema:
type: array
items:
type: string
enum:
- pending
- completed
- archived
- canceled
- requires_action
- in: query
name: fulfillment_status
style: form
explode: false
description: Fulfillment status to search for.
schema:
type: array
items:
type: string
enum:
- not_fulfilled
- fulfilled
- partially_fulfilled
- shipped
- partially_shipped
- canceled
- returned
- partially_returned
- requires_action
- in: query
name: payment_status
style: form
explode: false
description: Payment status to search for.
schema:
type: array
items:
type: string
enum:
- captured
- awaiting
- not_paid
- refunded
- partially_refunded
- canceled
- requires_action
- in: query
name: display_id
description: Display ID to search for.
schema:
type: string
- in: query
name: cart_id
description: to search for.
schema:
type: string
- in: query
name: customer_id
description: to search for.
schema:
type: string
- in: query
name: email
description: to search for.
schema:
type: string
- in: query
name: region_id
style: form
explode: false
description: Regions to search orders by
schema:
oneOf:
- type: string
description: ID of a Region.
- type: array
items:
type: string
description: ID of a Region.
- in: query
name: currency_code
style: form
explode: false
description: Currency code to search for
schema:
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
- in: query
name: tax_rate
description: to search for.
schema:
type: string
- in: query
name: created_at
description: Date comparison for when resulting orders were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting orders were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: canceled_at
description: Date comparison for when resulting orders were canceled.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: sales_channel_id
style: form
explode: false
description: Filter by Sales Channels
schema:
type: array
items:
type: string
description: The ID of a Sales Channel
- in: query
name: offset
description: How many orders to skip before the results.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of orders returned.
schema:
type: integer
default: 50
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each order of
the result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each order of
the result.
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetOrdersParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET 'https://medusa-url.com/admin/orders'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/swaps/{swap_id}/process-payment':
post:
operationId: PostOrdersOrderSwapsSwapProcessPayment
summary: Process Swap Payment
description: >-
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.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: path
name: swap_id
required: true
description: The ID of the Swap.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
x-codegen:
method: processSwapPayment
params: AdminPostOrdersOrderSwapsSwapProcessPaymentParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/swaps/{swap_id}/process-payment'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Swap
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/refund':
post:
operationId: PostOrdersOrderRefunds
summary: Create a Refund
description: Issues a Refund.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrdersOrderRefundsReq'
x-codegen:
method: refundPayment
params: AdminPostOrdersOrderRefundsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.refundPayment(order_id, {
amount: 1000,
reason: 'Do not like it'
})
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/adasda/refund' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"amount": 1000,
"reason": "Do not like it"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/orders/{id}/return':
post:
operationId: PostOrdersOrderReturns
summary: Request a Return
description: >-
Requests a Return. If applicable a return label will be created and
other plugins notified.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrdersOrderReturnsReq'
x-codegen:
method: requestReturn
params: AdminPostOrdersOrderReturnsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.requestReturn(order_id, {
items: [
{
item_id,
quantity: 1
}
]
})
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/return' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"items": [
{
"item_id": "{item_id}",
"quantity": 1
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Return
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/order/{id}/claims/{claim_id}':
post:
operationId: PostOrdersOrderClaimsClaim
summary: Update a Claim
description: Updates a Claim.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Order.
schema:
type: string
- in: path
name: claim_id
required: true
description: The ID of the Claim.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the result.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the result.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostOrdersOrderClaimsClaimReq'
x-codegen:
method: updateClaim
params: AdminPostOrdersOrderClaimsClaimParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.updateClaim(order_id, claim_id, {
no_notification: true
})
.then(({ order }) => {
console.log(order.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/orders/{id}/claims/{claim_id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"no_notification": true
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Claim
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminOrdersRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/payment-collections/{id}':
delete:
operationId: DeletePaymentCollectionsPaymentCollection
summary: Del a PaymentCollection
description: Deletes a Payment Collection
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Payment Collection to delete.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/payment-collections/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- PaymentCollection
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPaymentCollectionDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
get:
operationId: GetPaymentCollectionsPaymentCollection
summary: Get a PaymentCollection
description: Retrieves a PaymentCollection.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the PaymentCollection.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codegen:
method: retrieve
queryParams: GetPaymentCollectionsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/payment-collections/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- PaymentCollection
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPaymentCollectionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostPaymentCollectionsPaymentCollection
summary: Update PaymentCollection
description: Updates a PaymentCollection.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the PaymentCollection.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUpdatePaymentCollectionsReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(payment_collection_id, {
description: "Description of payCol"
})
.then(({ payment_collection }) => {
console.log(payment_collection.id)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/payment-collections/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"description": "Description of payCol"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- PaymentCollection
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPaymentCollectionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/payment-collections/{id}/authorize':
post:
operationId: PostPaymentCollectionsPaymentCollectionAuthorize
summary: Mark Authorized
description: Sets the status of PaymentCollection as Authorized.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the PaymentCollection.
schema:
type: string
x-codegen:
method: markAsAuthorized
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/payment-collections/{id}/authorize' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- PaymentCollection
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPaymentCollectionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/payments/{id}/capture':
post:
operationId: PostPaymentsPaymentCapture
summary: Capture a Payment
description: Captures a Payment.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Payment.
schema:
type: string
x-codegen:
method: capturePayment
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/payments/{id}/capture' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Payment
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPaymentRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/payments/{id}':
get:
operationId: GetPaymentsPayment
summary: Get Payment details
description: Retrieves the Payment details
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Payment.
schema:
type: string
x-codegen:
method: retrieve
queryParams: GetPaymentsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/payments/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Payment
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPaymentRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/payments/{id}/refund':
post:
operationId: PostPaymentsPaymentRefunds
summary: Create a Refund
description: Issues a Refund.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Payment.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostPaymentRefundsReq'
x-codegen:
method: refundPayment
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.refundPayment(payment_id, {
amount: 1000,
reason: 'return',
note: 'Do not like it',
})
.then(({ payment }) => {
console.log(payment.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/payments/pay_123/refund' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"amount": 1000,
"reason": "return",
"note": "Do not like it"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Payment
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRefundRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/price-lists/{id}/prices/batch':
post:
operationId: PostPriceListsPriceListPricesBatch
summary: Update Prices
description: Batch update prices for a Price List
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Price List to update prices for.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostPriceListPricesPricesReq'
x-codegen:
method: addPrices
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addPrices(price_list_id, {
prices: [
{
amount: 1000,
variant_id,
currency_code: 'eur'
}
]
})
.then(({ price_list }) => {
console.log(price_list.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/price-lists/{id}/prices/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"prices": [
{
"amount": 100,
"variant_id": "afasfa",
"currency_code": "eur"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Price List
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPriceListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeletePriceListsPriceListPricesBatch
summary: Delete Prices
description: Batch delete prices that belong to a Price List
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: >-
The ID of the Price List that the Money Amounts (Prices) that will
be deleted belongs to.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDeletePriceListPricesPricesReq'
x-codegen:
method: deletePrices
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.deletePrices(price_list_id, {
price_ids: [
price_id
]
})
.then(({ ids, object, deleted }) => {
console.log(ids.length);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/price-lists/{id}/prices/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"price_ids": [
"adasfa"
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Price List
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPriceListDeleteBatchRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/price-lists:
post:
operationId: PostPriceListsPriceList
summary: Create a Price List
description: Creates a Price List
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostPriceListsPriceListReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@medusajs/medusa-js"
import { PriceListType } from "@medusajs/medusa"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries:
3 })
// must be previously logged in or use api token
medusa.admin.priceLists.create({
name: 'New Price List',
description: 'A new price list',
type: PriceListType.SALE,
prices: [
{
amount: 1000,
variant_id,
currency_code: 'eur'
}
]
})
.then(({ price_list }) => {
console.log(price_list.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/price-lists' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "New Price List",
"description": "A new price list",
"type": "sale",
"prices": [
{
"amount": 1000,
"variant_id": "afafa",
"currency_code": "eur"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Price List
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPriceListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetPriceLists
summary: List Price Lists
description: Retrieves a list of Price Lists.
x-authenticated: true
parameters:
- in: query
name: limit
description: The number of items to get
schema:
type: number
default: '10'
- in: query
name: offset
description: The offset at which to get items
schema:
type: number
default: '0'
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each item of
the result.
schema:
type: string
- in: query
name: order
description: field to order results by.
schema:
type: string
- in: query
name: id
description: ID to search for.
schema:
type: string
- in: query
name: q
description: >-
query to search in price list description, price list name, and
customer group name fields.
schema:
type: string
- in: query
name: status
style: form
explode: false
description: Status to search for.
schema:
type: array
items:
type: string
enum:
- active
- draft
- in: query
name: name
description: price list name to search for.
schema:
type: string
- in: query
name: customer_groups
style: form
explode: false
description: Customer Group IDs to search for.
schema:
type: array
items:
type: string
- in: query
name: type
style: form
explode: false
description: Type to search for.
schema:
type: array
items:
type: string
enum:
- sale
- override
- in: query
name: created_at
description: Date comparison for when resulting price lists were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting price lists were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: deleted_at
description: Date comparison for when resulting price lists were deleted.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
x-codegen:
method: list
queryParams: AdminGetPriceListPaginationParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/price-lists' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Price List
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPriceListsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/price-lists/{id}':
delete:
operationId: DeletePriceListsPriceList
summary: Delete a Price List
description: Deletes a Price List
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Price List to delete.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/price-lists/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Price List
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPriceListDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetPriceListsPriceList
summary: Get a Price List
description: Retrieves a Price List.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Price List.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/price-lists/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Price List
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPriceListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostPriceListsPriceListPriceList
summary: Update a Price List
description: Updates a Price List
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Price List.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostPriceListsPriceListPriceListReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(price_list_id, {
name: 'New Price List'
})
.then(({ price_list }) => {
console.log(price_list.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/price-lists/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "New Price List"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Price List
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPriceListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/price-lists/{id}/products/{product_id}/prices':
delete:
operationId: DeletePriceListsPriceListProductsProductPrices
summary: Delete Product's Prices
description: Delete all the prices related to a specific product in a price list
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: >-
The ID of the Price List that the Money Amounts that will be deleted
belongs to.
schema:
type: string
- in: path
name: product_id
required: true
description: The ID of the product from which the money amount will be deleted.
schema:
type: string
x-codegen:
method: deleteProductPrices
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/price-lists/{id}/products/{product_id}/prices'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Price List
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPriceListDeleteProductPricesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/price-lists/{id}/variants/{variant_id}/prices':
delete:
operationId: DeletePriceListsPriceListVariantsVariantPrices
summary: Delete Variant's Prices
description: Delete all the prices related to a specific variant in a price list
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: >-
The ID of the Price List that the Money Amounts that will be deleted
belongs to.
schema:
type: string
- in: path
name: variant_id
required: true
description: The ID of the variant from which the money amount will be deleted.
schema:
type: string
x-codegen:
method: deleteVariantPrices
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/price-lists/{id}/variants/{variant_id}/prices'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Price List
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPriceListDeleteVariantPricesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/price-lists/{id}/products':
get:
operationId: GetPriceListsPriceListProducts
summary: List Products
description: Retrieves a list of Product that are part of a Price List
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: ID of the price list.
schema:
type: string
- in: query
name: q
description: >-
Query used for searching product title and description, variant
title and sku, and collection title.
schema:
type: string
- in: query
name: id
description: ID of the product to search for.
schema:
type: string
- in: query
name: status
description: Product status to search for
style: form
explode: false
schema:
type: array
items:
type: string
enum:
- draft
- proposed
- published
- rejected
- in: query
name: collection_id
description: Collection IDs to search for
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: tags
description: Tag IDs to search for
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: title
description: product title to search for.
schema:
type: string
- in: query
name: description
description: product description to search for.
schema:
type: string
- in: query
name: handle
description: product handle to search for.
schema:
type: string
- in: query
name: is_giftcard
description: Search for giftcards using is_giftcard=true.
schema:
type: string
- in: query
name: type
description: to search for.
schema:
type: string
- in: query
name: order
description: field to sort results by.
schema:
type: string
- in: query
name: created_at
description: Date comparison for when resulting products were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting products were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: deleted_at
description: Date comparison for when resulting products were deleted.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: offset
description: How many products to skip in the result.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of products returned.
schema:
type: integer
default: 50
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each product of
the result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each product of
the result.
schema:
type: string
x-codegen:
method: listProducts
queryParams: AdminGetPriceListsPriceListProductsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/price-lists/{id}/products' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Price List
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPriceListsProductsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/product-categories/{id}/products/batch':
post:
operationId: PostProductCategoriesCategoryProductsBatch
summary: Add Products to a category
description: Assign a batch of products to a product category.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product Category.
schema:
type: string
- in: query
name: expand
description: (Comma separated) Category fields to be expanded in the response.
schema:
type: string
- in: query
name: fields
description: (Comma separated) Category fields to be retrieved in the response.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostProductCategoriesCategoryProductsBatchReq
x-codegen:
method: addProducts
queryParams: AdminPostProductCategoriesCategoryProductsBatchParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addProducts(product_category_id, {
product_ids: [
{
id: product_id
}
]
})
.then(({ product_category }) => {
console.log(product_category.id);
});
- lang: Shell
label: cURL
source: >
curl --location \
--request POST
'https://medusa-url.com/admin/product-categories/{product_category_id}/products/batch'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"product_ids": [
{
"id": "{product_id}"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Category
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductCategoriesCategoryRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteProductCategoriesCategoryProductsBatch
summary: Delete Products
description: Remove a list of products from a product category.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product Category.
schema:
type: string
- in: query
name: expand
description: (Comma separated) Category fields to be expanded in the response.
schema:
type: string
- in: query
name: fields
description: (Comma separated) Category fields to be retrieved in the response.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminDeleteProductCategoriesCategoryProductsBatchReq
x-codegen:
method: removeProducts
queryParams: AdminDeleteProductCategoriesCategoryProductsBatchParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.removeProducts(product_category_id, {
product_ids: [
{
id: product_id
}
]
})
.then(({ product_category }) => {
console.log(product_category.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/product-categories/{id}/products/batch'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"product_ids": [
{
"id": "{product_id}"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Category
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductCategoriesCategoryRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/product-categories:
post:
operationId: PostProductCategories
summary: Create a Product Category
description: Creates a Product Category.
x-authenticated: true
parameters:
- in: query
name: expand
description: (Comma separated) Which fields should be expanded in the results.
schema:
type: string
- in: query
name: fields
description: (Comma separated) Which fields should be retrieved in the results.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostProductCategoriesReq'
x-codegen:
method: create
queryParams: AdminPostProductCategoriesParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
name: "Skinny Jeans",
})
.then(({ product_category }) => {
console.log(product_category.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/product-categories' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Skinny Jeans",
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Category
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductCategoriesCategoryRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetProductCategories
summary: List Product Categories
description: Retrieve a list of product categories.
x-authenticated: true
parameters:
- in: query
name: q
description: Query used for searching product category names orhandles.
schema:
type: string
- in: query
name: is_internal
description: Search for only internal categories.
schema:
type: boolean
- in: query
name: is_active
description: Search for only active categories
schema:
type: boolean
- in: query
name: parent_category_id
description: Returns categories scoped by parent
schema:
type: string
- in: query
name: offset
description: How many product categories to skip in the result.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of product categories returned.
schema:
type: integer
default: 100
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in the product
category.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in the product
category.
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetProductCategoriesParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/product-categories' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Category
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductCategoriesListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/product-categories/{id}':
delete:
operationId: DeleteProductCategoriesCategory
summary: Delete a Product Category
description: Deletes a ProductCategory.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product Category
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/product-categories/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Category
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductCategoriesCategoryDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetProductCategoriesCategory
summary: Get a Product Category
description: Retrieves a Product Category.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product Category
schema:
type: string
- in: query
name: expand
description: (Comma separated) Which fields should be expanded in the results.
schema:
type: string
- in: query
name: fields
description: (Comma separated) Which fields should be included in the results.
schema:
type: string
x-codegen:
method: retrieve
queryParams: AdminGetProductCategoryParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/product-categories/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Category
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductCategoriesCategoryRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostProductCategoriesCategory
summary: Update a Product Category
description: Updates a Product Category.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product Category.
schema:
type: string
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each product
category.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be retrieved in each product
category.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostProductCategoriesCategoryReq'
x-codegen:
method: update
queryParams: AdminPostProductCategoriesCategoryParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(product_category_id, {
name: "Skinny Jeans"
})
.then(({ product_category }) => {
console.log(product_category.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/product-categories/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Skinny Jeans"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Category
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductCategoriesCategoryRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/product-tags:
get:
operationId: GetProductTags
summary: List Product Tags
description: Retrieve a list of Product Tags.
x-authenticated: true
parameters:
- in: query
name: limit
description: The number of tags to return.
schema:
type: integer
default: 10
- in: query
name: offset
description: The number of items to skip before the results.
schema:
type: integer
default: 0
- in: query
name: order
description: The field to sort items by.
schema:
type: string
- in: query
name: discount_condition_id
description: The discount condition id on which to filter the tags.
schema:
type: string
- in: query
name: value
style: form
explode: false
description: The tag values to search for
schema:
type: array
items:
type: string
- in: query
name: q
description: A query string to search values for
schema:
type: string
- in: query
name: id
style: form
explode: false
description: The tag IDs to search for
schema:
type: array
items:
type: string
- in: query
name: created_at
description: Date comparison for when resulting product tags were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting product tags were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
x-codegen:
method: list
queryParams: AdminGetProductTagsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/product-tags' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Tag
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductTagsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/product-types:
get:
operationId: GetProductTypes
summary: List Product Types
description: Retrieve a list of Product Types.
x-authenticated: true
parameters:
- in: query
name: limit
description: The number of types to return.
schema:
type: integer
default: 20
- in: query
name: offset
description: The number of items to skip before the results.
schema:
type: integer
default: 0
- in: query
name: order
description: The field to sort items by.
schema:
type: string
- in: query
name: discount_condition_id
description: The discount condition id on which to filter the product types.
schema:
type: string
- in: query
name: value
style: form
explode: false
description: The type values to search for
schema:
type: array
items:
type: string
- in: query
name: id
style: form
explode: false
description: The type IDs to search for
schema:
type: array
items:
type: string
- in: query
name: q
description: A query string to search values for
schema:
type: string
- in: query
name: created_at
description: Date comparison for when resulting product types were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting product types were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
x-codegen:
method: list
queryParams: AdminGetProductTypesParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/product-types' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Type
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductTypesListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/products/{id}/options':
post:
operationId: PostProductsProductOptions
summary: Add an Option
x-authenticated: true
description: Adds a Product Option to a Product
parameters:
- in: path
name: id
required: true
description: The ID of the Product.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostProductsProductOptionsReq'
x-codegen:
method: addOption
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addOption(product_id, {
title: 'Size'
})
.then(({ product }) => {
console.log(product.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/products/{id}/options' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Size"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/products:
post:
operationId: PostProducts
summary: Create a Product
x-authenticated: true
description: Creates a Product
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostProductsReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
title: 'Shirt',
is_giftcard: false,
discountable: true
})
.then(({ product }) => {
console.log(product.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/products' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Shirt"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetProducts
summary: List Products
description: Retrieves a list of Product
x-authenticated: true
parameters:
- in: query
name: q
description: >-
Query used for searching product title and description, variant
title and sku, and collection title.
schema:
type: string
- in: query
name: discount_condition_id
description: The discount condition id on which to filter the product.
schema:
type: string
- in: query
name: id
style: form
explode: false
description: Filter by product IDs.
schema:
oneOf:
- type: string
description: ID of the product to search for.
- type: array
items:
type: string
description: ID of a product.
- in: query
name: status
style: form
explode: false
description: Status to search for
schema:
type: array
items:
type: string
enum:
- draft
- proposed
- published
- rejected
- in: query
name: collection_id
style: form
explode: false
description: Collection ids to search for.
schema:
type: array
items:
type: string
- in: query
name: tags
style: form
explode: false
description: Tag IDs to search for
schema:
type: array
items:
type: string
- in: query
name: price_list_id
style: form
explode: false
description: Price List IDs to search for
schema:
type: array
items:
type: string
- in: query
name: sales_channel_id
style: form
explode: false
description: Sales Channel IDs to filter products by
schema:
type: array
items:
type: string
- in: query
name: type_id
style: form
explode: false
description: Type IDs to filter products by
schema:
type: array
items:
type: string
- in: query
name: category_id
style: form
explode: false
description: Category IDs to filter products by
schema:
type: array
items:
type: string
- in: query
name: include_category_children
description: Include category children when filtering by category_id
schema:
type: boolean
- in: query
name: title
description: title to search for.
schema:
type: string
- in: query
name: description
description: description to search for.
schema:
type: string
- in: query
name: handle
description: handle to search for.
schema:
type: string
- in: query
name: is_giftcard
description: Search for giftcards using is_giftcard=true.
schema:
type: boolean
- in: query
name: created_at
description: Date comparison for when resulting products were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting products were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: deleted_at
description: Date comparison for when resulting products were deleted.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: offset
description: How many products to skip in the result.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of products returned.
schema:
type: integer
default: 50
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each product of
the result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each product of
the result.
schema:
type: string
- in: query
name: order
description: the field used to order the products.
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetProductsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/products' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/products/{id}/variants':
post:
operationId: PostProductsProductVariants
summary: Create a Product Variant
description: >-
Creates a Product Variant. Each Product Variant must have a unique
combination of Product Option Values.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostProductsProductVariantsReq'
x-codegen:
method: createVariant
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.createVariant(product_id, {
title: 'Color',
prices: [
{
amount: 1000,
currency_code: "eur"
}
],
options: [
{
option_id,
value: 'S'
}
],
inventory_quantity: 100
})
.then(({ product }) => {
console.log(product.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/products/{id}/variants' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Color",
"prices": [
{
"amount": 1000,
"currency_code": "eur"
}
],
"options": [
{
"option_id": "asdasf",
"value": "S"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetProductsProductVariants
summary: List a Product's Variants
description: Retrieves a list of the Product Variants associated with a Product.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: ID of the product to search for the variants.
schema:
type: string
- in: query
name: fields
description: Comma separated string of the column to select.
schema:
type: string
- in: query
name: expand
description: Comma separated string of the relations to include.
schema:
type: string
- in: query
name: offset
description: How many items to skip before the results.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of items returned.
schema:
type: integer
default: 100
x-codegen:
method: listVariants
queryParams: AdminGetProductsVariantsParams
x-codeSamples:
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/products/{id}/variants' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsListVariantsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/products/{id}/options/{option_id}':
delete:
operationId: DeleteProductsProductOptionsOption
summary: Delete a Product Option
description: >-
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
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product.
schema:
type: string
- in: path
name: option_id
required: true
description: The ID of the Product Option.
schema:
type: string
x-codegen:
method: deleteOption
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/products/{id}/options/{option_id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsDeleteOptionRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostProductsProductOptionsOption
summary: Update a Product Option
description: Updates a Product Option
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product.
schema:
type: string
- in: path
name: option_id
required: true
description: The ID of the Product Option.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostProductsProductOptionsOption'
x-codegen:
method: updateOption
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.updateOption(product_id, option_id, {
title: 'Size'
})
.then(({ product }) => {
console.log(product.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/products/{id}/options/{option_id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Size"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/products/{id}':
delete:
operationId: DeleteProductsProduct
summary: Delete a Product
description: Deletes a Product and it's associated Product Variants.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/products/asfsaf' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetProductsProduct
summary: Get a Product
description: Retrieves a Product.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/products/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostProductsProduct
summary: Update a Product
description: Updates a Product
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostProductsProductReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(product_id, {
title: 'Shirt',
images: []
})
.then(({ product }) => {
console.log(product.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/products/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Size"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/products/{id}/variants/{variant_id}':
delete:
operationId: DeleteProductsProductVariantsVariant
summary: Delete a Product Variant
description: Deletes a Product Variant.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product.
schema:
type: string
- in: path
name: variant_id
required: true
description: The ID of the Product Variant.
schema:
type: string
x-codegen:
method: deleteVariant
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/products/{id}/variants/{variant_id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsDeleteVariantRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostProductsProductVariantsVariant
summary: Update a Product Variant
description: Update a Product Variant.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product.
schema:
type: string
- in: path
name: variant_id
required: true
description: The ID of the Product Variant.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostProductsProductVariantsVariantReq'
x-codegen:
method: updateVariant
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.updateVariant(product_id, variant_id, {
title: 'Color',
prices: [
{
amount: 1000,
currency_code: "eur"
}
],
options: [
{
option_id,
value: 'S'
}
],
inventory_quantity: 100
})
.then(({ product }) => {
console.log(product.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/products/asfsaf/variants/saaga' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Color",
"prices": [
{
"amount": 1000,
"currency_code": "eur"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/products/tag-usage:
get:
operationId: GetProductsTagUsage
summary: List Tags Usage Number
description: Retrieves a list of Product Tags with how many times each is used.
x-authenticated: true
x-codegen:
method: listTags
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/products/tag-usage' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Tag
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsListTagsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/products/types:
get:
deprecated: true
operationId: GetProductsTypes
summary: List Product Types
description: Retrieves a list of Product Types.
x-authenticated: true
x-codegen:
method: listTypes
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/products/types' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsListTypesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/products/{id}/metadata':
post:
operationId: PostProductsProductMetadata
summary: Set Product Metadata
description: Set metadata key/value pair for Product
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Product.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostProductsProductMetadataReq'
x-codegen:
method: setMetadata
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.setMetadata(product_id, {
key: 'test',
value: 'true'
})
.then(({ product }) => {
console.log(product.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/products/{id}/metadata' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"key": "test",
"value": "true"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminProductsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/publishable-api-keys/{id}/sales-channels/batch':
post:
operationId: PostPublishableApiKeySalesChannelsChannelsBatch
summary: Add SalesChannels
description: Assign a batch of sales channels to a publishable api key.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Publishable Api Key.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostPublishableApiKeySalesChannelsBatchReq
x-codegen:
method: addSalesChannelsBatch
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addSalesChannelsBatch(publishableApiKeyId,
{
sales_channel_ids: [
{
id: channel_id
}
]
})
.then(({ publishable_api_key }) => {
console.log(publishable_api_key.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/publishable-api-keys/{pak_id}/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"sales_channel_ids": [
{
"id": "{sales_channel_id}"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- PublishableApiKey
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPublishableApiKeysRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeletePublishableApiKeySalesChannelsChannelsBatch
summary: Delete SalesChannels
description: Remove a batch of sales channels from a publishable api key.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Publishable Api Key.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminDeletePublishableApiKeySalesChannelsBatchReq
x-codegen:
method: deleteSalesChannelsBatch
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.deleteSalesChannelsBatch(publishableApiKeyId,
{
sales_channel_ids: [
{
id: channel_id
}
]
})
.then(({ publishable_api_key }) => {
console.log(publishable_api_key.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/publishable-api-keys/{pka_id}/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"sales_channel_ids": [
{
"id": "{sales_channel_id}"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- PublishableApiKey
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPublishableApiKeysRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/publishable-api-keys:
post:
operationId: PostPublishableApiKeys
summary: Create PublishableApiKey
description: Creates a PublishableApiKey.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostPublishableApiKeysReq'
x-authenticated: true
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
title
})
.then(({ publishable_api_key }) => {
console.log(publishable_api_key.id)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/publishable-api-keys' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Web API Key"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- PublishableApiKey
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPublishableApiKeysRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetPublishableApiKeys
summary: List PublishableApiKeys
description: List PublishableApiKeys.
x-authenticated: true
parameters:
- in: query
name: q
description: Query used for searching publishable api keys by title.
schema:
type: string
- in: query
name: limit
description: The number of items in the response
schema:
type: number
default: '20'
- in: query
name: offset
description: The offset of items in response
schema:
type: number
default: '0'
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codegen:
method: list
queryParams: GetPublishableApiKeysParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/publishable-api-keys' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- PublishableApiKey
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPublishableApiKeysListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/publishable-api-keys/{id}':
delete:
operationId: DeletePublishableApiKeysPublishableApiKey
summary: Delete PublishableApiKey
description: Deletes a PublishableApiKeys
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the PublishableApiKeys to delete.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/publishable-api-key/{pka_id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- PublishableApiKey
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPublishableApiKeyDeleteRes'
'400':
$ref: '#/components/responses/400_error'
get:
operationId: GetPublishableApiKeysPublishableApiKey
summary: Get a PublishableApiKey
description: Retrieve the Publishable Api Key.
parameters:
- in: path
name: id
required: true
description: The ID of the PublishableApiKey.
schema:
type: string
x-authenticated: true
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/publishable-api-keys/{pka_id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- PublishableApiKey
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPublishableApiKeysRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/publishable-api-keys/{id}/sales-channels':
get:
operationId: GetPublishableApiKeySalesChannels
summary: List SalesChannels
description: List PublishableApiKey's SalesChannels
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Publishable Api Key.
schema:
type: string
- in: query
name: q
description: Query used for searching sales channels' names and descriptions.
schema:
type: string
x-codegen:
method: listSalesChannels
queryParams: GetPublishableApiKeySalesChannelsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/publishable-api-keys/{pka_id}/sales-channels'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- PublishableApiKey
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPublishableApiKeysListSalesChannelsRes
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/publishable-api-keys/{id}/revoke':
post:
operationId: PostPublishableApiKeysPublishableApiKeyRevoke
summary: Revoke PublishableApiKey
description: Revokes a PublishableApiKey.
parameters:
- in: path
name: id
required: true
description: The ID of the PublishableApiKey.
schema:
type: string
x-authenticated: true
x-codegen:
method: revoke
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/publishable-api-keys/{pka_id}/revoke'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- PublishableApiKey
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPublishableApiKeysRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/publishable-api-key/{id}':
post:
operationId: PostPublishableApiKysPublishableApiKey
summary: Update PublishableApiKey
description: Updates a PublishableApiKey.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the PublishableApiKey.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostPublishableApiKeysPublishableApiKeyReq
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(publishableApiKeyId, {
title: "new title"
})
.then(({ publishable_api_key }) => {
console.log(publishable_api_key.id)
})
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/publishable-api-key/{pka_id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "new title"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- PublishableApiKey
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPublishableApiKeysRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/regions/{id}/countries':
post:
operationId: PostRegionsRegionCountries
summary: Add Country
description: Adds a Country to the list of Countries in a Region
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Region.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostRegionsRegionCountriesReq'
x-codegen:
method: addCountry
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addCountry(region_id, {
country_code: 'dk'
})
.then(({ region }) => {
console.log(region.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/regions/{region_id}/countries' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"country_code": "dk"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRegionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/regions/{id}/fulfillment-providers':
post:
operationId: PostRegionsRegionFulfillmentProviders
summary: Add Fulfillment Provider
description: Adds a Fulfillment Provider to a Region
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Region.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostRegionsRegionFulfillmentProvidersReq
x-codegen:
method: addFulfillmentProvider
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addFulfillmentProvider(region_id, {
provider_id: 'manual'
})
.then(({ region }) => {
console.log(region.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/regions/{id}/fulfillment-providers' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"provider_id": "manual"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRegionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/regions/{id}/payment-providers':
post:
operationId: PostRegionsRegionPaymentProviders
summary: Add Payment Provider
description: Adds a Payment Provider to a Region
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Region.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostRegionsRegionPaymentProvidersReq'
x-codegen:
method: addPaymentProvider
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addPaymentProvider(region_id, {
provider_id: 'manual'
})
.then(({ region }) => {
console.log(region.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/regions/{id}/payment-providers' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"provider_id": "manual"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRegionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/regions:
post:
operationId: PostRegions
summary: Create a Region
description: Creates a Region
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostRegionsReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
name: 'Europe',
currency_code: 'eur',
tax_rate: 0,
payment_providers: [
'manual'
],
fulfillment_providers: [
'manual'
],
countries: [
'DK'
]
})
.then(({ region }) => {
console.log(region.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/regions' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Europe",
"currency_code": "eur",
"tax_rate": 0,
"payment_providers": [
"manual"
],
"fulfillment_providers": [
"manual"
],
"countries": [
"DK"
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRegionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetRegions
summary: List Regions
description: Retrieves a list of Regions.
x-authenticated: true
parameters:
- in: query
name: limit
schema:
type: integer
default: 50
required: false
description: limit the number of regions in response
- in: query
name: offset
schema:
type: integer
default: 0
required: false
description: Offset of regions in response (used for pagination)
- in: query
name: created_at
schema:
type: object
required: false
description: >-
Date comparison for when resulting region was created, i.e. less
than, greater than etc.
- in: query
name: updated_at
schema:
type: object
required: false
description: >-
Date comparison for when resulting region was updated, i.e. less
than, greater than etc.
- in: query
name: deleted_at
schema:
type: object
required: false
description: >-
Date comparison for when resulting region was deleted, i.e. less
than, greater than etc.
x-codegen:
method: list
queryParams: AdminGetRegionsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET 'https://medusa-url.com/admin/regions'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRegionsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/regions/{id}':
delete:
operationId: DeleteRegionsRegion
summary: Delete a Region
description: Deletes a Region.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Region.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/regions/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRegionsDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetRegionsRegion
summary: Get a Region
description: Retrieves a Region.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Region.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/regions/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRegionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostRegionsRegion
summary: Update a Region
description: Updates a Region
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Region.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostRegionsRegionReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(region_id, {
name: 'Europe'
})
.then(({ region }) => {
console.log(region.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/regions/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Europe"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRegionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/regions/{id}/fulfillment-options':
get:
operationId: GetRegionsRegionFulfillmentOptions
summary: List Fulfillment Options
description: Gathers all the fulfillment options available to in the Region.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Region.
schema:
type: string
x-codegen:
method: retrieveFulfillmentOptions
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/regions/{id}/fulfillment-options' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminGetRegionsRegionFulfillmentOptionsRes
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/regions/{id}/countries/{country_code}':
delete:
operationId: PostRegionsRegionCountriesCountry
summary: Delete Country
x-authenticated: true
description: Removes a Country from the list of Countries in a Region
parameters:
- in: path
name: id
required: true
description: The ID of the Region.
schema:
type: string
- in: path
name: country_code
description: The 2 character ISO code for the Country.
required: true
schema:
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
x-codegen:
method: deleteCountry
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/regions/{id}/countries/dk' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRegionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/regions/{id}/fulfillment-providers/{provider_id}':
delete:
operationId: PostRegionsRegionFulfillmentProvidersProvider
summary: Del. Fulfillment Provider
description: Removes a Fulfillment Provider.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Region.
schema:
type: string
- in: path
name: provider_id
required: true
description: The ID of the Fulfillment Provider.
schema:
type: string
x-codegen:
method: deleteFulfillmentProvider
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/regions/{id}/fulfillment-providers/manual'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRegionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/regions/{id}/payment-providers/{provider_id}':
delete:
operationId: PostRegionsRegionPaymentProvidersProvider
summary: Delete Payment Provider
description: Removes a Payment Provider.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Region.
schema:
type: string
- in: path
name: provider_id
required: true
description: The ID of the Payment Provider.
schema:
type: string
x-codegen:
method: deletePaymentProvider
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/regions/{id}/payment-providers/manual'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Region
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminRegionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/reservations:
post:
operationId: PostReservations
summary: Creates a Reservation
description: >-
Creates a Reservation which can be associated with any resource as
required.
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostReservationsReq'
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
})
.then(({ reservations }) => {
console.log(reservations.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/reservations' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"resource_id": "{resource_id}",
"resource_type": "order",
"value": "We delivered this order"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Reservation
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostReservationsReq'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetReservations
summary: List Reservations
description: Retrieve a list of Reservations.
x-authenticated: true
parameters:
- in: query
name: location_id
style: form
explode: false
description: Location ids to search for.
schema:
type: array
items:
type: string
- in: query
name: inventory_item_id
style: form
explode: false
description: Inventory Item ids to search for.
schema:
type: array
items:
type: string
- in: query
name: line_item_id
style: form
explode: false
description: Line Item ids to search for.
schema:
type: array
items:
type: string
- in: query
name: quantity
description: Filter by reservation quantity
schema:
type: object
properties:
lt:
type: number
description: filter by reservation quantity less than this number
gt:
type: number
description: filter by reservation quantity greater than this number
lte:
type: number
description: >-
filter by reservation quantity less than or equal to this
number
gte:
type: number
description: >-
filter by reservation quantity greater than or equal to this
number
- in: query
name: offset
description: How many Reservations to skip in the result.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of Reservations returned.
schema:
type: integer
default: 20
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in the product
category.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in the product
category.
schema:
type: string
x-codeSamples:
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/product-categories' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Category
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminGetReservationReservationsReq'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/reservations/{id}':
delete:
operationId: DeleteReservationsReservation
summary: Delete a Reservation
description: Deletes a Reservation.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Reservation to delete.
schema:
type: string
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/reservations/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Reservation
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: The ID of the deleted Reservation.
object:
type: string
description: The type of the object that was deleted.
default: reservation
deleted:
type: boolean
description: Whether or not the Reservation was deleted.
default: true
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetReservationsReservation
summary: Get a Reservation
description: Retrieves a single reservation using its id
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the reservation to retrieve.
schema:
type: string
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/reservations/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Reservation
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostReservationsReq'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostReservationsReservation
summary: Updates a Reservation
description: >-
Updates a Reservation which can be associated with any resource as
required.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Reservation to update.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostReservationsReservationReq'
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(reservation.id, {
quantity: 3
})
.then(({ reservations }) => {
console.log(reservations.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/reservations/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"quantity": 3,
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Reservation
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostReservationsReq'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/return-reasons:
post:
operationId: PostReturnReasons
summary: Create a Return Reason
description: Creates a Return Reason
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostReturnReasonsReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
label: 'Damaged',
value: 'damaged'
})
.then(({ return_reason }) => {
console.log(return_reason.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/return-reasons' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"label": "Damaged",
"value": "damaged"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminReturnReasonsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetReturnReasons
summary: List Return Reasons
description: Retrieves a list of Return Reasons.
x-authenticated: true
x-codegen:
method: list
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/return-reasons' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminReturnReasonsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/return-reasons/{id}':
delete:
operationId: DeleteReturnReason
summary: Delete a Return Reason
description: Deletes a return reason.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the return reason
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/return-reasons/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminReturnReasonsDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetReturnReasonsReason
summary: Get a Return Reason
description: Retrieves a Return Reason.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Return Reason.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/return-reasons/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminReturnReasonsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostReturnReasonsReason
summary: Update a Return Reason
description: Updates a Return Reason
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Return Reason.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostReturnReasonsReasonReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(return_reason_id, {
label: 'Damaged'
})
.then(({ return_reason }) => {
console.log(return_reason.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/return-reasons/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"label": "Damaged"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminReturnReasonsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/returns/{id}/cancel':
post:
operationId: PostReturnsReturnCancel
summary: Cancel a Return
description: Registers a Return as canceled.
parameters:
- in: path
name: id
required: true
description: The ID of the Return.
schema:
type: string
x-codegen:
method: cancel
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/returns/{id}/cancel' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Return
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminReturnsCancelRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/returns:
get:
operationId: GetReturns
summary: List Returns
description: Retrieves a list of Returns
parameters:
- in: query
name: limit
description: The upper limit for the amount of responses returned.
schema:
type: number
default: '50'
- in: query
name: offset
description: The offset of the list returned.
schema:
type: number
default: '0'
x-codegen:
method: list
queryParams: AdminGetReturnsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET 'https://medusa-url.com/admin/returns'
\
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Return
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminReturnsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/returns/{id}/receive':
post:
operationId: PostReturnsReturnReceive
summary: Receive a Return
description: >-
Registers a Return as received. Updates statuses on Orders and Swaps
accordingly.
parameters:
- in: path
name: id
required: true
description: The ID of the Return.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostReturnsReturnReceiveReq'
x-codegen:
method: receive
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.receive(return_id, {
items: [
{
item_id,
quantity: 1
}
]
})
.then((data) => {
console.log(data.return.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/returns/{id}/receive' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"items": [
{
"item_id": "asafg",
"quantity": 1
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Return
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminReturnsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/sales-channels/{id}/products/batch':
post:
operationId: PostSalesChannelsChannelProductsBatch
summary: Add Products
description: Assign a batch of product to a sales channel.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Sales channel.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostSalesChannelsChannelProductsBatchReq
x-codegen:
method: addProducts
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addProducts(sales_channel_id, {
product_ids: [
{
id: product_id
}
]
})
.then(({ sales_channel }) => {
console.log(sales_channel.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/sales-channels/afasf/products/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"product_ids": [
{
"id": "{product_id}"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Sales Channel
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSalesChannelsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteSalesChannelsChannelProductsBatch
summary: Delete Products
description: Remove a list of products from a sales channel.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Sales Channel
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminDeleteSalesChannelsChannelProductsBatchReq
x-codegen:
method: removeProducts
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.removeProducts(sales_channel_id, {
product_ids: [
{
id: product_id
}
]
})
.then(({ sales_channel }) => {
console.log(sales_channel.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/sales-channels/{id}/products/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"product_ids": [
{
"id": "{product_id}"
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Sales Channel
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSalesChannelsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/sales-channels/{id}/stock-locations':
post:
operationId: PostSalesChannelsSalesChannelStockLocation
summary: Associate a stock location to a Sales Channel
description: Associates a stock location to a Sales Channel.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Sales Channel.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminPostSalesChannelsChannelStockLocationsReq
x-codegen:
method: addLocation
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addLocation(sales_channel_id, {
location_id: 'App'
})
.then(({ sales_channel }) => {
console.log(sales_channel.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/sales-channels/{id}/stock-locations' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"locaton_id": "stock_location_id"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Sales Channel
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSalesChannelsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteSalesChannelsSalesChannelStockLocation
summary: Remove a stock location from a Sales Channel
description: Removes a stock location from a Sales Channel.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Sales Channel.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminDeleteSalesChannelsChannelStockLocationsReq
x-codegen:
method: removeLocation
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.removeLocation(sales_channel_id, {
location_id: 'App'
})
.then(({ sales_channel }) => {
console.log(sales_channel.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/sales-channels/{id}/stock-locations' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"locaton_id": "stock_location_id"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Sales Channel
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSalesChannelsDeleteLocationRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/sales-channels:
post:
operationId: PostSalesChannels
summary: Create a Sales Channel
description: Creates a Sales Channel.
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostSalesChannelsReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
name: 'App',
description: 'Mobile app'
})
.then(({ sales_channel }) => {
console.log(sales_channel.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/sales-channels' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "App"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Sales Channel
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSalesChannelsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetSalesChannels
summary: List Sales Channels
description: Retrieves a list of sales channels
x-authenticated: true
parameters:
- in: query
name: id
description: ID of the sales channel
schema:
type: string
- in: query
name: name
description: Name of the sales channel
schema:
type: string
- in: query
name: description
description: Description of the sales channel
schema:
type: string
- in: query
name: q
description: Query used for searching sales channels' names and descriptions.
schema:
type: string
- in: query
name: order
description: The field to order the results by.
schema:
type: string
- in: query
name: created_at
description: Date comparison for when resulting collections were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting collections were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: deleted_at
description: Date comparison for when resulting collections were deleted.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: offset
description: How many sales channels to skip in the result.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of sales channels returned.
schema:
type: integer
default: 20
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each sales
channel of the result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each sales
channel of the result.
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetSalesChannelsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/sales-channels' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Sales Channel
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSalesChannelsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/sales-channels/{id}':
delete:
operationId: DeleteSalesChannelsSalesChannel
summary: Delete a Sales Channel
description: Deletes the sales channel.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Sales channel.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/sales-channels/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Sales Channel
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSalesChannelsDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetSalesChannelsSalesChannel
summary: Get a Sales Channel
description: Retrieves the sales channel.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Sales channel.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/sales-channels/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Sales Channel
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSalesChannelsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostSalesChannelsSalesChannel
summary: Update a Sales Channel
description: Updates a Sales Channel.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Sales Channel.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostSalesChannelsSalesChannelReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(sales_channel_id, {
name: 'App'
})
.then(({ sales_channel }) => {
console.log(sales_channel.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/sales-channels/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "App"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Sales Channel
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSalesChannelsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/shipping-options:
post:
operationId: PostShippingOptions
summary: Create Shipping Option
description: Creates a Shipping Option
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostShippingOptionsReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
name: 'PostFake',
region_id: "saasf",
provider_id: "manual",
data: {
},
price_type: 'flat_rate'
})
.then(({ shipping_option }) => {
console.log(shipping_option.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/shipping-options' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "PostFake",
"region_id": "afasf",
"provider_id": "manual",
"data": {},
"price_type": "flat_rate"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Shipping Option
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminShippingOptionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetShippingOptions
summary: List Shipping Options
description: Retrieves a list of Shipping Options.
x-authenticated: true
parameters:
- in: query
name: region_id
schema:
type: string
description: Region ID to fetch options from
- in: query
name: is_return
schema:
type: boolean
description: Flag for fetching return options only
- in: query
name: admin_only
schema:
type: boolean
description: Flag for fetching admin specific options
x-codegen:
method: list
queryParams: AdminGetShippingOptionsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/shipping-options' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Shipping Option
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminShippingOptionsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/shipping-options/{id}':
delete:
operationId: DeleteShippingOptionsOption
summary: Delete a Shipping Option
description: Deletes a Shipping Option.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Shipping Option.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/shipping-options/{option_id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Shipping Option
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminShippingOptionsDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetShippingOptionsOption
summary: Get a Shipping Option
description: Retrieves a Shipping Option.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Shipping Option.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/shipping-options/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Shipping Option
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminShippingOptionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostShippingOptionsOption
summary: Update Shipping Option
description: Updates a Shipping Option
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Shipping Option.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostShippingOptionsOptionReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(option_id, {
name: 'PostFake',
requirements: [
{
id,
type: 'max_subtotal',
amount: 1000
}
]
})
.then(({ shipping_option }) => {
console.log(shipping_option.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/shipping-options/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"requirements": [
{
"type": "max_subtotal",
"amount": 1000
}
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Shipping Option
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminShippingOptionsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/shipping-profiles:
post:
operationId: PostShippingProfiles
summary: Create a Shipping Profile
description: Creates a Shipping Profile
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostShippingProfilesReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
name: 'Large Products'
})
.then(({ shipping_profile }) => {
console.log(shipping_profile.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/shipping-profiles' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Large Products"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Shipping Profile
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminShippingProfilesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetShippingProfiles
summary: List Shipping Profiles
description: Retrieves a list of Shipping Profile.
x-authenticated: true
x-codegen:
method: list
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/shipping-profiles' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Shipping Profile
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminShippingProfilesListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/shipping-profiles/{id}':
delete:
operationId: DeleteShippingProfilesProfile
summary: Delete a Shipping Profile
description: Deletes a Shipping Profile.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Shipping Profile.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/shipping-profiles/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Shipping Profile
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDeleteShippingProfileRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetShippingProfilesProfile
summary: Get a Shipping Profile
description: Retrieves a Shipping Profile.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Shipping Profile.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/shipping-profiles/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Shipping Profile
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminShippingProfilesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostShippingProfilesProfile
summary: Update a Shipping Profile
description: Updates a Shipping Profile
parameters:
- in: path
name: id
required: true
description: The ID of the Shipping Profile.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostShippingProfilesProfileReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(shipping_profile_id, {
name: 'Large Products'
})
.then(({ shipping_profile }) => {
console.log(shipping_profile.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/shipping-profiles/{id} \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Large Products"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Shipping Profile
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminShippingProfilesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/stock-locations:
post:
operationId: PostStockLocations
summary: Create a Stock Location
description: Creates a Stock Location.
x-authenticated: true
parameters:
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostStockLocationsReq'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
name: 'Main Warehouse',
location_id: 'sloc'
})
.then(({ stock_location }) => {
console.log(stock_location.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/stock-locations' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "App"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Stock Location
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminStockLocationsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetStockLocations
summary: List Stock Locations
description: Retrieves a list of stock locations
x-authenticated: true
parameters:
- in: query
name: id
description: ID of the stock location
schema:
type: string
- in: query
name: name
description: Name of the stock location
schema:
type: string
- in: query
name: order
description: The field to order the results by.
schema:
type: string
- in: query
name: created_at
description: Date comparison for when resulting collections were created.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: updated_at
description: Date comparison for when resulting collections were updated.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: deleted_at
description: Date comparison for when resulting collections were deleted.
schema:
type: object
properties:
lt:
type: string
description: filter by dates less than this date
format: date
gt:
type: string
description: filter by dates greater than this date
format: date
lte:
type: string
description: filter by dates less than or equal to this date
format: date
gte:
type: string
description: filter by dates greater than or equal to this date
format: date
- in: query
name: offset
description: How many stock locations to skip in the result.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of stock locations returned.
schema:
type: integer
default: 20
- in: query
name: expand
description: >-
(Comma separated) Which fields should be expanded in each stock
location of the result.
schema:
type: string
- in: query
name: fields
description: >-
(Comma separated) Which fields should be included in each stock
location of the result.
schema:
type: string
x-codegen:
method: list
queryParams: AdminGetStockLocationsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/stock-locations' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Sales Channel
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminStockLocationsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/stock-locations/{id}':
delete:
operationId: DeleteStockLocationsStockLocation
summary: Delete a Stock Location
description: Delete a Stock Location
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Stock Location to delete.
schema:
type: string
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/stock-locations/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- StockLocation
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: The ID of the deleted Stock Location.
object:
type: string
description: The type of the object that was deleted.
format: stock_location
deleted:
type: boolean
description: Whether or not the Stock Location was deleted.
default: true
'400':
$ref: '#/components/responses/400_error'
get:
operationId: GetStockLocationsStockLocation
summary: Get a Stock Location
description: Retrieves the Stock Location.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Stock Location.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
x-codegen:
method: retrieve
queryParams: AdminGetStockLocationsLocationParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/stock-locations/{id}' \
--header 'Authorization: Bearer {api_token}' \
security:
- api_token: []
- cookie_auth: []
tags:
- Stock Location
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminStockLocationsRes'
post:
operationId: PostStockLocationsStockLocation
summary: Update a Stock Location
description: Updates a Stock Location.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Stock Location.
schema:
type: string
- in: query
name: expand
description: Comma separated list of relations to include in the results.
schema:
type: string
- in: query
name: fields
description: Comma separated list of fields to include in the results.
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostStockLocationsLocationReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(stock_location_id, {
name: 'App'
})
.then(({ stock_location }) => {
console.log(stock_location.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/stock-locations/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "App"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Stock Location
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminStockLocationsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/store/currencies/{code}':
post:
operationId: PostStoreCurrenciesCode
summary: Add a Currency Code
description: Adds a Currency Code to the available currencies.
x-authenticated: true
parameters:
- in: path
name: code
required: true
description: The 3 character ISO currency code.
schema:
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
x-codegen:
method: addCurrency
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/store/currencies/eur' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Store
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminStoresRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteStoreCurrenciesCode
summary: Delete a Currency Code
description: Removes a Currency Code from the available currencies.
x-authenticated: true
parameters:
- in: path
name: code
required: true
description: The 3 character ISO currency code.
schema:
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
x-codegen:
method: deleteCurrency
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/store/currencies/eur' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Store
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminStoresRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/store:
get:
operationId: GetStore
summary: Get Store details
description: Retrieves the Store details
x-authenticated: true
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: |
curl --location --request GET 'https://medusa-url.com/admin/store' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Store
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminStoresRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostStore
summary: Update Store Details
description: Updates the Store details
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostStoreReq'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update({
name: 'Medusa Store'
})
.then(({ store }) => {
console.log(store.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST 'https://medusa-url.com/admin/store'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Medusa Store"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Store
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminStoresRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/store/payment-providers:
get:
operationId: GetStorePaymentProviders
summary: List Payment Providers
description: Retrieves the configured Payment Providers
x-authenticated: true
x-codegen:
method: listPaymentProviders
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/store/payment-providers' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Store
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPaymentProvidersList'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/store/tax-providers:
get:
operationId: GetStoreTaxProviders
summary: List Tax Providers
description: Retrieves the configured Tax Providers
x-authenticated: true
x-codegen:
method: listTaxProviders
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/store/tax-providers' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Store
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxProvidersList'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/swaps/{id}':
get:
operationId: GetSwapsSwap
summary: Get a Swap
description: Retrieves a Swap.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Swap.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/swaps/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Swap
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSwapsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/swaps:
get:
operationId: GetSwaps
summary: List Swaps
description: Retrieves a list of Swaps.
parameters:
- in: query
name: limit
description: The upper limit for the amount of responses returned.
schema:
type: number
default: '50'
- in: query
name: offset
description: The offset of the list returned.
schema:
type: number
default: '0'
x-authenticated: true
x-codegen:
method: list
queryParams: AdminGetSwapsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: |
curl --location --request GET 'https://medusa-url.com/admin/swaps' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Swap
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminSwapsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/tax-rates/{id}/product-types/batch':
post:
operationId: PostTaxRatesTaxRateProductTypes
summary: Add to Product Types
description: Associates a Tax Rate with a list of Product Types
parameters:
- in: path
name: id
required: true
description: ID of the tax rate.
schema:
type: string
- in: query
name: fields
description: Which fields should be included in the result.
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: expand
description: Which fields should be expanded and retrieved in the result.
style: form
explode: false
schema:
type: array
items:
type: string
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostTaxRatesTaxRateProductTypesReq'
x-codegen:
method: addProductTypes
queryParams: AdminPostTaxRatesTaxRateProductTypesParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addProductTypes(tax_rate_id, {
product_types: [
product_type_id
]
})
.then(({ tax_rate }) => {
console.log(tax_rate.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/tax-rates/{id}/product-types/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"product_types": [
"{product_type_id}"
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Tax Rate
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxRatesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteTaxRatesTaxRateProductTypes
summary: Delete from Product Types
description: Removes a Tax Rate from a list of Product Types
parameters:
- in: path
name: id
required: true
description: ID of the tax rate.
schema:
type: string
- in: query
name: fields
description: Which fields should be included in the result.
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: expand
description: Which fields should be expanded and retrieved in the result.
style: form
explode: false
schema:
type: array
items:
type: string
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDeleteTaxRatesTaxRateProductTypesReq'
x-codegen:
method: removeProductTypes
queryParams: AdminDeleteTaxRatesTaxRateProductTypesParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.removeProductTypes(tax_rate_id, {
product_types: [
product_type_id
]
})
.then(({ tax_rate }) => {
console.log(tax_rate.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/tax-rates/{id}/product-types/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"product_types": [
"{product_type_id}"
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Tax Rate
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxRatesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/tax-rates/{id}/products/batch':
post:
operationId: PostTaxRatesTaxRateProducts
summary: Add to Products
description: Associates a Tax Rate with a list of Products
parameters:
- in: path
name: id
required: true
description: ID of the tax rate.
schema:
type: string
- in: query
name: fields
description: Which fields should be included in the result.
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: expand
description: Which fields should be expanded and retrieved in the result.
style: form
explode: false
schema:
type: array
items:
type: string
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostTaxRatesTaxRateProductsReq'
x-codegen:
method: addProducts
queryParams: AdminPostTaxRatesTaxRateProductsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addProducts(tax_rate_id, {
products: [
product_id
]
})
.then(({ tax_rate }) => {
console.log(tax_rate.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/tax-rates/{id}/products/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"products": [
"{product_id}"
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Tax Rate
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxRatesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteTaxRatesTaxRateProducts
summary: Delete from Products
description: Removes a Tax Rate from a list of Products
parameters:
- in: path
name: id
required: true
description: ID of the tax rate.
schema:
type: string
- in: query
name: fields
description: Which fields should be included in the result.
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: expand
description: Which fields should be expanded and retrieved in the result.
style: form
explode: false
schema:
type: array
items:
type: string
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDeleteTaxRatesTaxRateProductsReq'
x-codegen:
method: removeProducts
queryParams: AdminDeleteTaxRatesTaxRateProductsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.removeProducts(tax_rate_id, {
products: [
product_id
]
})
.then(({ tax_rate }) => {
console.log(tax_rate.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/tax-rates/{id}/products/batch' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"products": [
"{product_id}"
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Tax Rate
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxRatesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/tax-rates/{id}/shipping-options/batch':
post:
operationId: PostTaxRatesTaxRateShippingOptions
summary: Add to Shipping Options
description: Associates a Tax Rate with a list of Shipping Options
parameters:
- in: path
name: id
required: true
description: ID of the tax rate.
schema:
type: string
- in: query
name: fields
description: Which fields should be included in the result.
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: expand
description: Which fields should be expanded and retrieved in the result.
style: form
explode: false
schema:
type: array
items:
type: string
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostTaxRatesTaxRateShippingOptionsReq'
x-codegen:
method: addShippingOptions
queryParams: AdminPostTaxRatesTaxRateShippingOptionsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.addShippingOptions(tax_rate_id, {
shipping_options: [
shipping_option_id
]
})
.then(({ tax_rate }) => {
console.log(tax_rate.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/tax-rates/{id}/shipping-options/batch'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"shipping_options": [
"{shipping_option_id}"
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Tax Rate
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxRatesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: DeleteTaxRatesTaxRateShippingOptions
summary: Del. for Shipping Options
description: Removes a Tax Rate from a list of Shipping Options
parameters:
- in: path
name: id
required: true
description: ID of the tax rate.
schema:
type: string
- in: query
name: fields
description: Which fields should be included in the result.
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: expand
description: Which fields should be expanded and retrieved in the result.
style: form
explode: false
schema:
type: array
items:
type: string
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: >-
#/components/schemas/AdminDeleteTaxRatesTaxRateShippingOptionsReq
x-codegen:
method: removeShippingOptions
queryParams: AdminDeleteTaxRatesTaxRateShippingOptionsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.removeShippingOptions(tax_rate_id, {
shipping_options: [
shipping_option_id
]
})
.then(({ tax_rate }) => {
console.log(tax_rate.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/tax-rates/{id}/shipping-options/batch'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"shipping_options": [
"{shipping_option_id}"
]
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Tax Rate
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxRatesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/tax-rates:
post:
operationId: PostTaxRates
summary: Create a Tax Rate
description: Creates a Tax Rate
parameters:
- in: query
name: fields
description: Which fields should be included in the result.
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: expand
description: Which fields should be expanded and retrieved in the result.
style: form
explode: false
schema:
type: array
items:
type: string
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostTaxRatesReq'
x-codegen:
method: create
queryParams: AdminPostTaxRatesParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
code: 'TEST',
name: 'New Tax Rate',
region_id
})
.then(({ tax_rate }) => {
console.log(tax_rate.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/tax-rates' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"code": "TEST",
"name": "New Tax Rate",
"region_id": "{region_id}"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Tax Rate
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxRatesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetTaxRates
summary: List Tax Rates
description: Retrieves a list of TaxRates
x-authenticated: true
parameters:
- in: query
name: name
description: Name of tax rate to retrieve
schema:
type: string
- in: query
name: region_id
style: form
explode: false
description: Filter by Region ID
schema:
oneOf:
- type: string
- type: array
items:
type: string
- in: query
name: code
description: code to search for.
schema:
type: string
- in: query
name: rate
style: form
explode: false
description: Filter by Rate
schema:
oneOf:
- type: number
- type: object
properties:
lt:
type: number
description: filter by rates less than this number
gt:
type: number
description: filter by rates greater than this number
lte:
type: number
description: filter by rates less than or equal to this number
gte:
type: number
description: filter by rates greater than or equal to this number
- in: query
name: offset
description: How many tax rates to skip before retrieving the result.
schema:
type: integer
default: 0
- in: query
name: limit
description: Limit the number of tax rates returned.
schema:
type: integer
default: 50
- in: query
name: fields
description: Which fields should be included in each item.
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: expand
description: Which fields should be expanded and retrieved for each item.
style: form
explode: false
schema:
type: array
items:
type: string
x-codegen:
method: list
queryParams: AdminGetTaxRatesParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/tax-rates' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Tax Rate
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxRatesListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/tax-rates/{id}':
delete:
operationId: DeleteTaxRatesTaxRate
summary: Delete a Tax Rate
description: Deletes a Tax Rate
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the Shipping Option.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/tax-rates/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Tax Rate
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxRatesDeleteRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetTaxRatesTaxRate
summary: Get a Tax Rate
description: Retrieves a TaxRate
parameters:
- in: path
name: id
required: true
description: ID of the tax rate.
schema:
type: string
- in: query
name: fields
description: Which fields should be included in the result.
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: expand
description: Which fields should be expanded and retrieved in the result.
style: form
explode: false
schema:
type: array
items:
type: string
x-authenticated: true
x-codegen:
method: retrieve
queryParams: AdminGetTaxRatesTaxRateParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/tax-rates/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Tax Rate
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxRatesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostTaxRatesTaxRate
summary: Update a Tax Rate
description: Updates a Tax Rate
parameters:
- in: path
name: id
required: true
description: ID of the tax rate.
schema:
type: string
- in: query
name: fields
description: Which fields should be included in the result.
style: form
explode: false
schema:
type: array
items:
type: string
- in: query
name: expand
description: Which fields should be expanded and retrieved in the result.
style: form
explode: false
schema:
type: array
items:
type: string
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostTaxRatesTaxRateReq'
x-codegen:
method: update
queryParams: AdminPostTaxRatesTaxRateParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(tax_rate_id, {
name: 'New Tax Rate'
})
.then(({ tax_rate }) => {
console.log(tax_rate.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/tax-rates/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "New Tax Rate"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Tax Rate
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminTaxRatesRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/uploads/protected:
post:
operationId: PostUploadsProtected
summary: Protected File Upload
description: >-
Uploads at least one file with ACL or a non-public bucket to the
specific fileservice that is installed in Medusa.
x-authenticated: true
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
files:
type: string
format: binary
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/uploads/protected' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: image/jpeg' \
--form 'files=@"<FILE_PATH_1>"' \
--form 'files=@"<FILE_PATH_1>"'
security:
- api_token: []
- cookie_auth: []
tags:
- Upload
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUploadsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/uploads:
post:
operationId: PostUploads
summary: Upload files
description: >-
Uploads at least one file to the specific fileservice that is installed
in Medusa.
x-authenticated: true
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
files:
type: string
format: binary
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/uploads' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: image/jpeg' \
--form 'files=@"<FILE_PATH_1>"' \
--form 'files=@"<FILE_PATH_1>"'
security:
- api_token: []
- cookie_auth: []
tags:
- Upload
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUploadsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
delete:
operationId: AdminDeleteUploads
summary: Delete an Uploaded File
description: Removes an uploaded file using the installed fileservice
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDeleteUploadsReq'
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.delete({
file_key
})
.then(({ id, object, deleted }) => {
console.log(id);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/uploads' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"file_key": "{file_key}"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Upload
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDeleteUploadsRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/uploads/download-url:
post:
operationId: PostUploadsDownloadUrl
summary: Get a File's Download URL
description: Creates a presigned download url for a file
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminPostUploadsDownloadUrlReq'
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.getPresignedDownloadUrl({
file_key
})
.then(({ download_url }) => {
console.log(download_url);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/uploads/download-url' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"file_key": "{file_key}"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- Upload
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUploadsDownloadUrlRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/users:
post:
operationId: PostUsers
summary: Create a User
description: Creates a User
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminCreateUserRequest'
x-codegen:
method: create
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.create({
email: 'user@example.com',
password: 'supersecret'
})
.then(({ user }) => {
console.log(user.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST 'https://medusa-url.com/admin/users'
\
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com",
"password": "supersecret"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- User
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUserRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetUsers
summary: List Users
description: Retrieves all users.
x-authenticated: true
x-codegen:
method: list
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: |
curl --location --request GET 'https://medusa-url.com/admin/users' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- User
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUsersListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/users/{id}':
delete:
operationId: DeleteUsersUser
summary: Delete a User
description: Deletes a User
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the User.
schema:
type: string
x-codegen:
method: delete
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request DELETE
'https://medusa-url.com/admin/users/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- User
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminDeleteUserRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
get:
operationId: GetUsersUser
summary: Get a User
description: Retrieves a User.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The ID of the User.
schema:
type: string
x-codegen:
method: retrieve
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/users/{id}' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- User
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUserRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
post:
operationId: PostUsersUser
summary: Update a User
description: Updates a User
parameters:
- in: path
name: id
required: true
description: The ID of the User.
schema:
type: string
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUpdateUserRequest'
x-codegen:
method: update
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.update(user_id, {
first_name: 'Marcellus'
})
.then(({ user }) => {
console.log(user.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/users/{id}' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"first_name": "Marcellus"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- User
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUserRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/users/password-token:
post:
operationId: PostUsersUserPasswordToken
summary: Request Password Reset
description: Generates a password token for a User with a given email.
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminResetPasswordTokenRequest'
x-codegen:
method: sendResetPasswordToken
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.sendResetPasswordToken({
email: 'user@example.com'
})
.then(() => {
// successful
})
.catch(() => {
// error occurred
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/users/password-token' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- User
responses:
'204':
description: OK
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/users/reset-password:
post:
operationId: PostUsersUserPassword
summary: Reset Password
description: Sets the password for a User given the correct token.
x-authenticated: true
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AdminResetPasswordRequest'
x-codegen:
method: resetPassword
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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.resetPassword({
token: 'supersecrettoken',
password: 'supersecret'
})
.then(({ user }) => {
console.log(user.id);
});
- lang: Shell
label: cURL
source: >
curl --location --request POST
'https://medusa-url.com/admin/users/reset-password' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"token": "supersecrettoken",
"password": "supersecret"
}'
security:
- api_token: []
- cookie_auth: []
tags:
- User
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUserRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
'/variants/{id}/inventory':
get:
operationId: GetVariantsVariantInventory
summary: Get inventory of Variant.
description: Returns the available inventory of a Variant.
x-authenticated: true
parameters:
- in: path
name: id
required: true
description: The Product Variant id to get inventory for.
schema:
type: string
x-codegen:
method: getInventory
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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)
})
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/variants' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Variant
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
variant:
type: object
$ref: '#/components/schemas/AdminGetVariantsVariantInventoryRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
/variants:
get:
operationId: GetVariants
summary: List Product Variants
description: Retrieves a list of Product Variants
x-authenticated: true
parameters:
- in: query
name: id
description: A Product Variant id to filter by.
schema:
type: string
- in: query
name: ids
description: A comma separated list of Product Variant ids to filter by.
schema:
type: string
- in: query
name: expand
description: A comma separated list of Product Variant relations to load.
schema:
type: string
- in: query
name: fields
description: A comma separated list of Product Variant fields to include.
schema:
type: string
- in: query
name: offset
description: How many product variants to skip in the result.
schema:
type: number
default: '0'
- in: query
name: limit
description: Maximum number of Product Variants to return.
schema:
type: number
default: '100'
- in: query
name: cart_id
description: The id of the cart to use for price selection.
schema:
type: string
- in: query
name: region_id
description: The id of the region to use for price selection.
schema:
type: string
- in: query
name: currency_code
description: The currency code to use for price selection.
schema:
type: string
- in: query
name: customer_id
description: The id of the customer to use for price selection.
schema:
type: string
- in: query
name: title
style: form
explode: false
description: product variant title to search for.
schema:
oneOf:
- type: string
description: a single title to search by
- type: array
description: multiple titles to search by
items:
type: string
- in: query
name: inventory_quantity
description: Filter by available inventory quantity
schema:
oneOf:
- type: number
description: a specific number to search by.
- type: object
description: search using less and greater than comparisons.
properties:
lt:
type: number
description: filter by inventory quantity less than this number
gt:
type: number
description: filter by inventory quantity greater than this number
lte:
type: number
description: >-
filter by inventory quantity less than or equal to this
number
gte:
type: number
description: >-
filter by inventory quantity greater than or equal to this
number
x-codegen:
method: list
queryParams: AdminGetVariantsParams
x-codeSamples:
- lang: JavaScript
label: JS Client
source: >
import Medusa from "@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);
});
- lang: Shell
label: cURL
source: >
curl --location --request GET
'https://medusa-url.com/admin/variants' \
--header 'Authorization: Bearer {api_token}'
security:
- api_token: []
- cookie_auth: []
tags:
- Product Variant
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdminVariantsListRes'
'400':
$ref: '#/components/responses/400_error'
'401':
$ref: '#/components/responses/unauthorized'
'404':
$ref: '#/components/responses/not_found_error'
'409':
$ref: '#/components/responses/invalid_state_error'
'422':
$ref: '#/components/responses/invalid_request_error'
'500':
$ref: '#/components/responses/500_error'
components:
responses:
default_error:
description: Default Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
code: unknown_error
message: An unknown error occurred.
type: unknown_error
invalid_state_error:
description: Invalid State Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
code: unknown_error
message: >-
The request conflicted with another request. You may retry the
request with the provided Idempotency-Key.
type: QueryRunnerAlreadyReleasedError
invalid_request_error:
description: Invalid Request Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
code: invalid_request_error
message: Discount with code TEST already exists.
type: duplicate_error
not_found_error:
description: Not Found Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
message: Entity with id 1 was not found
type: not_found
400_error:
description: Client Error or Multiple Errors
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Error'
- $ref: '#/components/schemas/MultipleErrors'
examples:
not_allowed:
$ref: '#/components/examples/not_allowed_error'
invalid_data:
$ref: '#/components/examples/invalid_data_error'
MultipleErrors:
$ref: '#/components/examples/multiple_errors'
500_error:
description: Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
database:
$ref: '#/components/examples/database_error'
unexpected_state:
$ref: '#/components/examples/unexpected_state_error'
invalid_argument:
$ref: '#/components/examples/invalid_argument_error'
default_error:
$ref: '#/components/examples/default_error'
unauthorized:
description: User is not authorized. Must log in first
content:
text/plain:
schema:
type: string
default: Unauthorized
example: Unauthorized
incorrect_credentials:
description: User does not exist or incorrect credentials
content:
text/plain:
schema:
type: string
default: Unauthorized
example: Unauthorized
examples:
not_allowed_error:
summary: Not Allowed Error
value:
message: Discount must be set to dynamic
type: not_allowed
invalid_data_error:
summary: Invalid Data Error
value:
message: first_name must be a string
type: invalid_data
multiple_errors:
summary: Multiple Errors
value:
message: >-
Provided request body contains errors. Please check the data and retry
the request
errors:
- message: first_name must be a string
type: invalid_data
- message: Discount must be set to dynamic
type: not_allowed
database_error:
summary: Database Error
value:
code: api_error
message: An error occured while hashing password
type: database_error
unexpected_state_error:
summary: Unexpected State Error
value:
message: cart.total must be defined
type: unexpected_state
invalid_argument_error:
summary: Invalid Argument Error
value:
message: cart.total must be defined
type: unexpected_state
default_error:
summary: Default Error
value:
code: unknown_error
message: An unknown error occurred.
type: unknown_error
securitySchemes:
api_token:
type: http
x-displayName: API Token
description: >
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:
```bash
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](https://randomkeygen.com/).
- `<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:
```ts
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`:
```tsx
<MedusaProvider
apiKey='api_token}'
//...
>
```
scheme: bearer
cookie_auth:
type: apiKey
in: cookie
name: connect.sid
x-displayName: Cookie Session ID
description: >
Use a cookie session to send authenticated requests.
### How to Obtain the Cookie Session
If you're sending requests through a browser, using JS Client, or using
tools like Postman, the cookie session should be automatically set when
the admin user is logged in.
If you're sending requests using cURL, you must set the Session ID in
the cookie manually.
To do that, send a request to [authenticate the
user](#tag/Auth/operation/PostAuth) and pass the cURL option `-v`:
```bash
curl -v --location --request POST 'https://medusa-url.com/admin/auth' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "user@example.com",
"password": "supersecret"
}'
```
The headers will be logged in the terminal as well as the response. You
should find in the headers a Cookie header similar to this:
```bash
Set-Cookie:
connect.sid=s%3A2Bu8BkaP9JUfHu9rG59G16Ma0QZf6Gj1.WT549XqX37PN8n0OecqnMCq798eLjZC5IT7yiDCBHPM;
```
Copy the value after `connect.sid` (without the `;` at the end) and pass
it as a cookie in subsequent requests as the following:
```bash
curl --location --request GET 'https://medusa-url.com/admin/products' \
--header 'Cookie: connect.sid={sid}'
```
Where `{sid}` is the value of `connect.sid` that you copied.
schemas:
AddressFields:
title: Address Fields
description: Address fields used when creating/updating an address.
type: object
properties:
company:
type: string
description: Company name
example: Acme
first_name:
type: string
description: First name
example: Arno
last_name:
type: string
description: Last name
example: Willms
address_1:
type: string
description: Address line 1
example: 14433 Kemmer Court
address_2:
type: string
description: Address line 2
example: Suite 369
city:
type: string
description: City
example: South Geoffreyview
country_code:
type: string
description: The 2 character ISO code of the country in lower case
externalDocs:
url: >-
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
description: See a list of codes.
example: st
province:
type: string
description: Province
example: Kentucky
postal_code:
type: string
description: Postal Code
example: 72093
phone:
type: string
description: Phone Number
example: 16128234334802
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
Address:
title: Address
description: An address.
type: object
required:
- address_1
- address_2
- city
- company
- country_code
- created_at
- customer_id
- deleted_at
- first_name
- id
- last_name
- metadata
- phone
- postal_code
- province
- updated_at
properties:
id:
type: string
description: ID of the address
example: addr_01G8ZC9VS1XVE149MGH2J7QSSH
customer_id:
description: ID of the customer this address belongs to
nullable: true
type: string
example: cus_01G2SG30J8C85S4A5CHM2S1NS2
customer:
description: Available if the relation `customer` is expanded.
nullable: true
$ref: '#/components/schemas/Customer'
company:
description: Company name
nullable: true
type: string
example: Acme
first_name:
description: First name
nullable: true
type: string
example: Arno
last_name:
description: Last name
nullable: true
type: string
example: Willms
address_1:
description: Address line 1
nullable: true
type: string
example: 14433 Kemmer Court
address_2:
description: Address line 2
nullable: true
type: string
example: Suite 369
city:
description: City
nullable: true
type: string
example: South Geoffreyview
country_code:
description: The 2 character ISO code of the country in lower case
nullable: true
type: string
externalDocs:
url: >-
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
description: See a list of codes.
example: st
country:
description: A country object. Available if the relation `country` is expanded.
nullable: true
$ref: '#/components/schemas/Country'
province:
description: Province
nullable: true
type: string
example: Kentucky
postal_code:
description: Postal Code
nullable: true
type: string
example: 72093
phone:
description: Phone Number
nullable: true
type: string
example: 16128234334802
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
BatchJob:
title: Batch Job
description: A Batch Job.
type: object
required:
- canceled_at
- completed_at
- confirmed_at
- context
- created_at
- created_by
- deleted_at
- dry_run
- failed_at
- id
- pre_processed_at
- processing_at
- result
- status
- type
- updated_at
properties:
id:
description: The unique identifier for the batch job.
type: string
example: batch_01G8T782965PYFG0751G0Z38B4
type:
description: The type of batch job.
type: string
enum:
- product-import
- product-export
status:
description: The status of the batch job.
type: string
enum:
- created
- pre_processed
- confirmed
- processing
- completed
- canceled
- failed
default: created
created_by:
description: The unique identifier of the user that created the batch job.
nullable: true
type: string
example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
created_by_user:
description: >-
A user object. Available if the relation `created_by_user` is
expanded.
nullable: true
$ref: '#/components/schemas/User'
context:
description: >-
The context of the batch job, the type of the batch job determines
what the context should contain.
nullable: true
type: 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
dry_run:
description: Specify if the job must apply the modifications or not.
type: boolean
default: false
result:
description: The result of the batch job.
nullable: true
allOf:
- type: object
example: {}
- type: object
properties:
count:
type: number
advancement_count:
type: number
progress:
type: number
errors:
type: object
properties:
message:
type: string
code:
oneOf:
- type: string
- type: number
err:
type: array
stat_descriptors:
type: object
properties:
key:
type: string
name:
type: string
message:
type: string
file_key:
type: string
file_size:
type: number
example:
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:
description: The date from which the job has been pre-processed.
nullable: true
type: string
format: date-time
processing_at:
description: The date the job is processing at.
nullable: true
type: string
format: date-time
confirmed_at:
description: The date when the confirmation has been done.
nullable: true
type: string
format: date-time
completed_at:
description: The date of the completion.
nullable: true
type: string
format: date-time
canceled_at:
description: The date of the concellation.
nullable: true
type: string
format: date-time
failed_at:
description: The date when the job failed.
nullable: true
type: string
format: date-time
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was last updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
Cart:
title: Cart
description: Represents a user cart
type: object
required:
- billing_address_id
- completed_at
- context
- created_at
- customer_id
- deleted_at
- email
- id
- idempotency_key
- metadata
- payment_authorized_at
- payment_id
- payment_session
- region_id
- shipping_address_id
- type
- updated_at
properties:
id:
description: The cart's ID
type: string
example: cart_01G8ZH853Y6TFXWPG5EYE81X63
email:
description: The email associated with the cart
nullable: true
type: string
format: email
billing_address_id:
description: The billing address's ID
nullable: true
type: string
example: addr_01G8ZH853YPY9B94857DY91YGW
billing_address:
description: Available if the relation `billing_address` is expanded.
nullable: true
$ref: '#/components/schemas/Address'
shipping_address_id:
description: The shipping address's ID
nullable: true
type: string
example: addr_01G8ZH853YPY9B94857DY91YGW
shipping_address:
description: Available if the relation `shipping_address` is expanded.
nullable: true
$ref: '#/components/schemas/Address'
items:
description: Available if the relation `items` is expanded.
type: array
items:
$ref: '#/components/schemas/LineItem'
region_id:
description: The region's ID
type: string
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: A region object. Available if the relation `region` is expanded.
nullable: true
$ref: '#/components/schemas/Region'
discounts:
description: Available if the relation `discounts` is expanded.
type: array
items:
$ref: '#/components/schemas/Discount'
gift_cards:
description: Available if the relation `gift_cards` is expanded.
type: array
items:
$ref: '#/components/schemas/GiftCard'
customer_id:
description: The customer's ID
nullable: true
type: string
example: cus_01G2SG30J8C85S4A5CHM2S1NS2
customer:
description: A customer object. Available if the relation `customer` is expanded.
nullable: true
$ref: '#/components/schemas/Customer'
payment_session:
description: The selected payment session in the cart.
nullable: true
$ref: '#/components/schemas/PaymentSession'
payment_sessions:
description: The payment sessions created on the cart.
type: array
items:
$ref: '#/components/schemas/PaymentSession'
payment_id:
description: The payment's ID if available
nullable: true
type: string
example: pay_01G8ZCC5W42ZNY842124G7P5R9
payment:
description: Available if the relation `payment` is expanded.
nullable: true
$ref: '#/components/schemas/Payment'
shipping_methods:
description: The shipping methods added to the cart.
type: array
items:
$ref: '#/components/schemas/ShippingMethod'
type:
description: The cart's type.
type: string
enum:
- default
- swap
- draft_order
- payment_link
- claim
default: default
completed_at:
description: The date with timezone at which the cart was completed.
nullable: true
type: string
format: date-time
payment_authorized_at:
description: The date with timezone at which the payment was authorized.
nullable: true
type: string
format: date-time
idempotency_key:
description: >-
Randomly generated key used to continue the completion of a cart in
case of failure.
nullable: true
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
context:
description: >-
The context of the cart which can include info like IP or user
agent.
nullable: true
type: object
example:
ip: '::1'
user_agent: PostmanRuntime/7.29.2
sales_channel_id:
description: The sales channel ID the cart is associated with.
nullable: true
type: string
example: null
sales_channel:
description: >-
A sales channel object. Available if the relation `sales_channel` is
expanded.
nullable: true
$ref: '#/components/schemas/SalesChannel'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
shipping_total:
description: The total of shipping
type: integer
example: 1000
discount_total:
description: The total of discount
type: integer
example: 800
item_tax_total:
description: The total of items with taxes
type: integer
example: 8000
shipping_tax_total:
description: The total of shipping with taxes
type: integer
example: 1000
tax_total:
description: The total of tax
type: integer
example: 0
refunded_total:
description: >-
The total amount refunded if the order associated with this cart is
returned.
type: integer
example: 0
total:
description: The total amount of the cart
type: integer
example: 8200
subtotal:
description: The subtotal of the cart
type: integer
example: 8000
refundable_amount:
description: The amount that can be refunded
type: integer
example: 8200
gift_card_total:
description: The total of gift cards
type: integer
example: 0
gift_card_tax_total:
description: The total of gift cards with taxes
type: integer
example: 0
ClaimImage:
title: Claim Image
description: Represents photo documentation of a claim.
type: object
required:
- claim_item_id
- created_at
- deleted_at
- id
- metadata
- updated_at
- url
properties:
id:
description: The claim image's ID
type: string
example: cimg_01G8ZH853Y6TFXWPG5EYE81X63
claim_item_id:
description: The ID of the claim item associated with the image
type: string
claim_item:
description: >-
A claim item object. Available if the relation `claim_item` is
expanded.
nullable: true
$ref: '#/components/schemas/ClaimItem'
url:
description: The URL of the image
type: string
format: uri
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ClaimItem:
title: Claim Item
description: >-
Represents a claimed item along with information about the reasons for
the claim.
type: object
required:
- claim_order_id
- created_at
- deleted_at
- id
- item_id
- metadata
- note
- quantity
- reason
- updated_at
- variant_id
properties:
id:
description: The claim item's ID
type: string
example: citm_01G8ZH853Y6TFXWPG5EYE81X63
images:
description: Available if the relation `images` is expanded.
type: array
items:
$ref: '#/components/schemas/ClaimImage'
claim_order_id:
description: The ID of the claim this item is associated with.
type: string
claim_order:
description: >-
A claim order object. Available if the relation `claim_order` is
expanded.
nullable: true
$ref: '#/components/schemas/ClaimOrder'
item_id:
description: The ID of the line item that the claim item refers to.
type: string
example: item_01G8ZM25TN49YV9EQBE2NC27KC
item:
description: Available if the relation `item` is expanded.
nullable: true
$ref: '#/components/schemas/LineItem'
variant_id:
description: The ID of the product variant that is claimed.
type: string
example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
variant:
description: A variant object. Available if the relation `variant` is expanded.
nullable: true
$ref: '#/components/schemas/ProductVariant'
reason:
description: The reason for the claim
type: string
enum:
- missing_item
- wrong_item
- production_failure
- other
note:
description: 'An optional note about the claim, for additional information'
nullable: true
type: string
example: I don't like it.
quantity:
description: >-
The quantity of the item that is being claimed; must be less than or
equal to the amount purchased in the original order.
type: integer
example: 1
tags:
description: >-
User defined tags for easy filtering and grouping. Available if the
relation 'tags' is expanded.
type: array
items:
$ref: '#/components/schemas/ClaimTag'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ClaimOrder:
title: Claim Order
description: >-
Claim Orders represent a group of faulty or missing items. Each claim
order consists of a subset of items associated with an original order,
and can contain additional information about fulfillments and returns.
type: object
required:
- canceled_at
- created_at
- deleted_at
- fulfillment_status
- id
- idempotency_key
- metadata
- no_notification
- order_id
- payment_status
- refund_amount
- shipping_address_id
- type
- updated_at
properties:
id:
description: The claim's ID
type: string
example: claim_01G8ZH853Y6TFXWPG5EYE81X63
type:
description: The claim's type
type: string
enum:
- refund
- replace
payment_status:
description: The status of the claim's payment
type: string
enum:
- na
- not_refunded
- refunded
default: na
fulfillment_status:
description: The claim's fulfillment status
type: string
enum:
- not_fulfilled
- partially_fulfilled
- fulfilled
- partially_shipped
- shipped
- partially_returned
- returned
- canceled
- requires_action
default: not_fulfilled
claim_items:
description: The items that have been claimed
type: array
items:
$ref: '#/components/schemas/ClaimItem'
additional_items:
description: >-
Refers to the new items to be shipped when the claim order has the
type `replace`
type: array
items:
$ref: '#/components/schemas/LineItem'
order_id:
description: The ID of the order that the claim comes from.
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
description: An order object. Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
return_order:
description: >-
A return object. Holds information about the return if the claim is
to be returned. Available if the relation 'return_order' is expanded
nullable: true
$ref: '#/components/schemas/Return'
shipping_address_id:
description: The ID of the address that the new items should be shipped to
nullable: true
type: string
example: addr_01G8ZH853YPY9B94857DY91YGW
shipping_address:
description: Available if the relation `shipping_address` is expanded.
nullable: true
$ref: '#/components/schemas/Address'
shipping_methods:
description: The shipping methods that the claim order will be shipped with.
type: array
items:
$ref: '#/components/schemas/ShippingMethod'
fulfillments:
description: The fulfillments of the new items to be shipped
type: array
items:
$ref: '#/components/schemas/Fulfillment'
refund_amount:
description: The amount that will be refunded in conjunction with the claim
nullable: true
type: integer
example: 1000
canceled_at:
description: The date with timezone at which the claim was canceled.
nullable: true
type: string
format: date-time
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
no_notification:
description: >-
Flag for describing whether or not notifications related to this
should be send.
nullable: true
type: boolean
example: false
idempotency_key:
description: >-
Randomly generated key used to continue the completion of the cart
associated with the claim in case of failure.
nullable: true
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
ClaimTag:
title: Claim Tag
description: >-
Claim Tags are user defined tags that can be assigned to claim items for
easy filtering and grouping.
type: object
required:
- created_at
- deleted_at
- id
- metadata
- updated_at
- value
properties:
id:
description: The claim tag's ID
type: string
example: ctag_01G8ZCC5Y63B95V6B5SHBZ91S4
value:
description: The value that the claim tag holds
type: string
example: Damaged
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
Country:
title: Country
description: Country details
type: object
required:
- display_name
- id
- iso_2
- iso_3
- name
- num_code
- region_id
properties:
id:
description: The country's ID
type: string
example: 109
iso_2:
description: The 2 character ISO code of the country in lower case
type: string
example: it
externalDocs:
url: >-
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
description: See a list of codes.
iso_3:
description: The 2 character ISO code of the country in lower case
type: string
example: ita
externalDocs:
url: >-
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements
description: See a list of codes.
num_code:
description: The numerical ISO code for the country.
type: string
example: 380
externalDocs:
url: >-
https://en.wikipedia.org/wiki/ISO_3166-1_numeric#Officially_assigned_code_elements
description: See a list of codes.
name:
description: The normalized country name in upper case.
type: string
example: ITALY
display_name:
description: The country name appropriate for display.
type: string
example: Italy
region_id:
description: The region ID this country is associated with.
nullable: true
type: string
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: A region object. Available if the relation `region` is expanded.
nullable: true
$ref: '#/components/schemas/Region'
Currency:
title: Currency
description: Currency
type: object
required:
- code
- name
- symbol
- symbol_native
properties:
code:
description: The 3 character ISO code for the currency.
type: string
example: usd
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
symbol:
description: The symbol used to indicate the currency.
type: string
example: $
symbol_native:
description: The native symbol used to indicate the currency.
type: string
example: $
name:
description: The written name of the currency
type: string
example: US Dollar
includes_tax:
description: '[EXPERIMENTAL] Does the currency prices include tax'
type: boolean
default: false
CustomShippingOption:
title: Custom Shipping Option
description: >-
Custom Shipping Options are 'overriden' Shipping Options. Store managers
can attach a Custom Shipping Option to a cart in order to set a custom
price for a particular Shipping Option
type: object
required:
- cart_id
- created_at
- deleted_at
- id
- metadata
- price
- shipping_option_id
- updated_at
properties:
id:
description: The custom shipping option's ID
type: string
example: cso_01G8X99XNB77DMFBJFWX6DN9V9
price:
description: >-
The custom price set that will override the shipping option's
original price
type: integer
example: 1000
shipping_option_id:
description: >-
The ID of the Shipping Option that the custom shipping option
overrides
type: string
example: so_01G1G5V27GYX4QXNARRQCW1N8T
shipping_option:
description: >-
A shipping option object. Available if the relation
`shipping_option` is expanded.
nullable: true
$ref: '#/components/schemas/ShippingOption'
cart_id:
description: The ID of the Cart that the custom shipping option is attached to
nullable: true
type: string
example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
description: A cart object. Available if the relation `cart` is expanded.
nullable: true
$ref: '#/components/schemas/Cart'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
CustomerGroup:
title: Customer Group
description: Represents a customer group
type: object
required:
- created_at
- deleted_at
- id
- metadata
- name
- updated_at
properties:
id:
description: The customer group's ID
type: string
example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63
name:
description: The name of the customer group
type: string
example: VIP
customers:
description: >-
The customers that belong to the customer group. Available if the
relation `customers` is expanded.
type: array
items:
$ref: '#/components/schemas/Customer'
price_lists:
description: >-
The price lists that are associated with the customer group.
Available if the relation `price_lists` is expanded.
type: array
items:
$ref: '#/components/schemas/PriceList'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
Customer:
title: Customer
description: Represents a customer
type: object
required:
- billing_address_id
- created_at
- deleted_at
- email
- first_name
- has_account
- id
- last_name
- metadata
- phone
- updated_at
properties:
id:
description: The customer's ID
type: string
example: cus_01G2SG30J8C85S4A5CHM2S1NS2
email:
description: The customer's email
type: string
format: email
first_name:
description: The customer's first name
nullable: true
type: string
example: Arno
last_name:
description: The customer's last name
nullable: true
type: string
example: Willms
billing_address_id:
description: The customer's billing address ID
nullable: true
type: string
example: addr_01G8ZH853YPY9B94857DY91YGW
billing_address:
description: Available if the relation `billing_address` is expanded.
nullable: true
$ref: '#/components/schemas/Address'
shipping_addresses:
description: Available if the relation `shipping_addresses` is expanded.
type: array
items:
$ref: '#/components/schemas/Address'
phone:
description: The customer's phone number
nullable: true
type: string
example: 16128234334802
has_account:
description: Whether the customer has an account or not
type: boolean
default: false
orders:
description: Available if the relation `orders` is expanded.
type: array
items:
$ref: '#/components/schemas/Order'
groups:
description: >-
The customer groups the customer belongs to. Available if the
relation `groups` is expanded.
type: array
items:
$ref: '#/components/schemas/CustomerGroup'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
DiscountConditionCustomerGroup:
title: Product Tag Discount Condition
description: Associates a discount condition with a customer group
type: object
required:
- condition_id
- created_at
- customer_group_id
- metadata
- updated_at
properties:
customer_group_id:
description: The ID of the Product Tag
type: string
example: cgrp_01G8ZH853Y6TFXWPG5EYE81X63
condition_id:
description: The ID of the Discount Condition
type: string
example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
customer_group:
description: Available if the relation `customer_group` is expanded.
nullable: true
$ref: '#/components/schemas/CustomerGroup'
discount_condition:
description: Available if the relation `discount_condition` is expanded.
nullable: true
$ref: '#/components/schemas/DiscountCondition'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
DiscountConditionProductCollection:
title: Product Collection Discount Condition
description: Associates a discount condition with a product collection
type: object
required:
- condition_id
- created_at
- metadata
- product_collection_id
- updated_at
properties:
product_collection_id:
description: The ID of the Product Collection
type: string
example: pcol_01F0YESBFAZ0DV6V831JXWH0BG
condition_id:
description: The ID of the Discount Condition
type: string
example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
product_collection:
description: Available if the relation `product_collection` is expanded.
nullable: true
$ref: '#/components/schemas/ProductCollection'
discount_condition:
description: Available if the relation `discount_condition` is expanded.
nullable: true
$ref: '#/components/schemas/DiscountCondition'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
DiscountConditionProductTag:
title: Product Tag Discount Condition
description: Associates a discount condition with a product tag
type: object
required:
- condition_id
- created_at
- metadata
- product_tag_id
- updated_at
properties:
product_tag_id:
description: The ID of the Product Tag
type: string
example: ptag_01F0YESHPZYY3H4SJ3A5918SBN
condition_id:
description: The ID of the Discount Condition
type: string
example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
product_tag:
description: Available if the relation `product_tag` is expanded.
nullable: true
$ref: '#/components/schemas/ProductTag'
discount_condition:
description: Available if the relation `discount_condition` is expanded.
nullable: true
$ref: '#/components/schemas/DiscountCondition'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
DiscountConditionProductType:
title: Product Type Discount Condition
description: Associates a discount condition with a product type
type: object
required:
- condition_id
- created_at
- metadata
- product_type_id
- updated_at
properties:
product_type_id:
description: The ID of the Product Tag
type: string
example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A
condition_id:
description: The ID of the Discount Condition
type: string
example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
product_type:
description: Available if the relation `product_type` is expanded.
nullable: true
$ref: '#/components/schemas/ProductType'
discount_condition:
description: Available if the relation `discount_condition` is expanded.
nullable: true
$ref: '#/components/schemas/DiscountCondition'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
DiscountConditionProduct:
title: Product Discount Condition
description: Associates a discount condition with a product
type: object
required:
- condition_id
- created_at
- metadata
- product_id
- updated_at
properties:
product_id:
description: The ID of the Product Tag
type: string
example: prod_01G1G5V2MBA328390B5AXJ610F
condition_id:
description: The ID of the Discount Condition
type: string
example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
product:
description: Available if the relation `product` is expanded.
nullable: true
$ref: '#/components/schemas/Product'
discount_condition:
description: Available if the relation `discount_condition` is expanded.
nullable: true
$ref: '#/components/schemas/DiscountCondition'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
DiscountCondition:
title: Discount Condition
description: Holds rule conditions for when a discount is applicable
type: object
required:
- created_at
- deleted_at
- discount_rule_id
- id
- metadata
- operator
- type
- updated_at
properties:
id:
description: The discount condition's ID
type: string
example: discon_01G8X9A7ESKAJXG2H0E6F1MW7A
type:
description: The type of the Condition
type: string
enum:
- products
- product_types
- product_collections
- product_tags
- customer_groups
operator:
description: The operator of the Condition
type: string
enum:
- in
- not_in
discount_rule_id:
description: The ID of the discount rule associated with the condition
type: string
example: dru_01F0YESMVK96HVX7N419E3CJ7C
discount_rule:
description: Available if the relation `discount_rule` is expanded.
nullable: true
$ref: '#/components/schemas/DiscountRule'
products:
description: >-
products associated with this condition if type = products.
Available if the relation `products` is expanded.
type: array
items:
$ref: '#/components/schemas/Product'
product_types:
description: >-
Product types associated with this condition if type =
product_types. Available if the relation `product_types` is
expanded.
type: array
items:
$ref: '#/components/schemas/ProductType'
product_tags:
description: >-
Product tags associated with this condition if type = product_tags.
Available if the relation `product_tags` is expanded.
type: array
items:
$ref: '#/components/schemas/ProductTag'
product_collections:
description: >-
Product collections associated with this condition if type =
product_collections. Available if the relation `product_collections`
is expanded.
type: array
items:
$ref: '#/components/schemas/ProductCollection'
customer_groups:
description: >-
Customer groups associated with this condition if type =
customer_groups. Available if the relation `customer_groups` is
expanded.
type: array
items:
$ref: '#/components/schemas/CustomerGroup'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
DiscountRule:
title: Discount Rule
description: >-
Holds the rules that governs how a Discount is calculated when applied
to a Cart.
type: object
required:
- allocation
- created_at
- deleted_at
- description
- id
- metadata
- type
- updated_at
- value
properties:
id:
description: The discount rule's ID
type: string
example: dru_01F0YESMVK96HVX7N419E3CJ7C
type:
description: >-
The type of the Discount, can be `fixed` for discounts that reduce
the price by a fixed amount, `percentage` for percentage reductions
or `free_shipping` for shipping vouchers.
type: string
enum:
- fixed
- percentage
- free_shipping
example: percentage
description:
description: A short description of the discount
nullable: true
type: string
example: 10 Percent
value:
description: >-
The value that the discount represents; this will depend on the type
of the discount
type: integer
example: 10
allocation:
description: The scope that the discount should apply to.
nullable: true
type: string
enum:
- total
- item
example: total
conditions:
description: >-
A set of conditions that can be used to limit when the discount can
be used. Available if the relation `conditions` is expanded.
type: array
items:
$ref: '#/components/schemas/DiscountCondition'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
Discount:
title: Discount
description: >-
Represents a discount that can be applied to a cart for promotional
purposes.
type: object
required:
- code
- created_at
- deleted_at
- ends_at
- id
- is_disabled
- is_dynamic
- metadata
- parent_discount_id
- rule_id
- starts_at
- updated_at
- usage_count
- usage_limit
- valid_duration
properties:
id:
description: The discount's ID
type: string
example: disc_01F0YESMW10MGHWJKZSDDMN0VN
code:
description: >-
A unique code for the discount - this will be used by the customer
to apply the discount
type: string
example: 10DISC
is_dynamic:
description: >-
A flag to indicate if multiple instances of the discount can be
generated. I.e. for newsletter discounts
type: boolean
example: false
rule_id:
description: The Discount Rule that governs the behaviour of the Discount
nullable: true
type: string
example: dru_01F0YESMVK96HVX7N419E3CJ7C
rule:
description: Available if the relation `rule` is expanded.
nullable: true
$ref: '#/components/schemas/DiscountRule'
is_disabled:
description: >-
Whether the Discount has been disabled. Disabled discounts cannot be
applied to carts
type: boolean
example: false
parent_discount_id:
description: >-
The Discount that the discount was created from. This will always be
a dynamic discount
nullable: true
type: string
example: disc_01G8ZH853YPY9B94857DY91YGW
parent_discount:
description: Available if the relation `parent_discount` is expanded.
nullable: true
$ref: '#/components/schemas/Discount'
starts_at:
description: The time at which the discount can be used.
type: string
format: date-time
ends_at:
description: The time at which the discount can no longer be used.
nullable: true
type: string
format: date-time
valid_duration:
description: Duration the discount runs between
nullable: true
type: string
example: P3Y6M4DT12H30M5S
regions:
description: >-
The Regions in which the Discount can be used. Available if the
relation `regions` is expanded.
type: array
items:
$ref: '#/components/schemas/Region'
usage_limit:
description: The maximum number of times that a discount can be used.
nullable: true
type: integer
example: 100
usage_count:
description: The number of times a discount has been used.
type: integer
example: 50
default: 0
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
DraftOrder:
title: DraftOrder
description: Represents a draft order
type: object
required:
- canceled_at
- cart_id
- completed_at
- created_at
- display_id
- id
- idempotency_key
- metadata
- no_notification_order
- order_id
- status
- updated_at
properties:
id:
description: The draft order's ID
type: string
example: dorder_01G8TJFKBG38YYFQ035MSVG03C
status:
description: The status of the draft order
type: string
enum:
- open
- completed
default: open
display_id:
description: The draft order's display ID
type: string
example: 2
cart_id:
description: The ID of the cart associated with the draft order.
nullable: true
type: string
example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
description: A cart object. Available if the relation `cart` is expanded.
nullable: true
$ref: '#/components/schemas/Cart'
order_id:
description: The ID of the order associated with the draft order.
nullable: true
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
description: An order object. Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
canceled_at:
description: The date the draft order was canceled at.
nullable: true
type: string
format: date-time
completed_at:
description: The date the draft order was completed at.
nullable: true
type: string
format: date-time
no_notification_order:
description: Whether to send the customer notifications regarding order updates.
nullable: true
type: boolean
example: false
idempotency_key:
description: >-
Randomly generated key used to continue the completion of the cart
associated with the draft order in case of failure.
nullable: true
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
FulfillmentItem:
title: Fulfillment Item
description: >-
Correlates a Line Item with a Fulfillment, keeping track of the quantity
of the Line Item.
type: object
required:
- fulfillment_id
- item_id
- quantity
properties:
fulfillment_id:
description: The id of the Fulfillment that the Fulfillment Item belongs to.
type: string
example: ful_01G8ZRTMQCA76TXNAT81KPJZRF
item_id:
description: The id of the Line Item that the Fulfillment Item references.
type: string
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
fulfillment:
description: >-
A fulfillment object. Available if the relation `fulfillment` is
expanded.
nullable: true
$ref: '#/components/schemas/Fulfillment'
item:
description: Available if the relation `item` is expanded.
nullable: true
$ref: '#/components/schemas/LineItem'
quantity:
description: The quantity of the Line Item that is included in the Fulfillment.
type: integer
example: 1
FulfillmentProvider:
title: Fulfillment Provider
description: >-
Represents a fulfillment provider plugin and holds its installation
status.
type: object
required:
- id
- is_installed
properties:
id:
description: The id of the fulfillment provider as given by the plugin.
type: string
example: manual
is_installed:
description: >-
Whether the plugin is installed in the current version. Plugins that
are no longer installed are not deleted by will have this field set
to `false`.
type: boolean
default: true
Fulfillment:
title: Fulfillment
description: >-
Fulfillments are created once store operators can prepare the purchased
goods. Fulfillments will eventually be shipped and hold information
about how to track shipments. Fulfillments are created through a
provider, which is typically an external shipping aggregator, shipping
partner og 3PL, most plugins will have asynchronous communications with
these providers through webhooks in order to automatically update and
synchronize the state of Fulfillments.
type: object
required:
- canceled_at
- claim_order_id
- created_at
- data
- id
- idempotency_key
- location_id
- metadata
- no_notification
- order_id
- provider_id
- shipped_at
- swap_id
- tracking_numbers
- updated_at
properties:
id:
description: The fulfillment's ID
type: string
example: ful_01G8ZRTMQCA76TXNAT81KPJZRF
claim_order_id:
description: The id of the Claim that the Fulfillment belongs to.
nullable: true
type: string
example: null
claim_order:
description: >-
A claim order object. Available if the relation `claim_order` is
expanded.
nullable: true
$ref: '#/components/schemas/ClaimOrder'
swap_id:
description: The id of the Swap that the Fulfillment belongs to.
nullable: true
type: string
example: null
swap:
description: A swap object. Available if the relation `swap` is expanded.
nullable: true
$ref: '#/components/schemas/Swap'
order_id:
description: The id of the Order that the Fulfillment belongs to.
nullable: true
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
description: An order object. Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
provider_id:
description: >-
The id of the Fulfillment Provider responsible for handling the
fulfillment
type: string
example: manual
provider:
description: Available if the relation `provider` is expanded.
nullable: true
$ref: '#/components/schemas/FulfillmentProvider'
location_id:
description: The id of the stock location the fulfillment will be shipped from
nullable: true
type: string
example: sloc_01G8TJSYT9M6AVS5N4EMNFS1EK
items:
description: >-
The Fulfillment Items in the Fulfillment - these hold information
about how many of each Line Item has been fulfilled. Available if
the relation `items` is expanded.
type: array
items:
$ref: '#/components/schemas/FulfillmentItem'
tracking_links:
description: >-
The Tracking Links that can be used to track the status of the
Fulfillment, these will usually be provided by the Fulfillment
Provider. Available if the relation `tracking_links` is expanded.
type: array
items:
$ref: '#/components/schemas/TrackingLink'
tracking_numbers:
description: >-
The tracking numbers that can be used to track the status of the
fulfillment.
deprecated: true
type: array
items:
type: string
data:
description: >-
This contains all the data necessary for the Fulfillment provider to
handle the fulfillment.
type: object
example: {}
shipped_at:
description: The date with timezone at which the Fulfillment was shipped.
nullable: true
type: string
format: date-time
no_notification:
description: >-
Flag for describing whether or not notifications related to this
should be sent.
nullable: true
type: boolean
example: false
canceled_at:
description: The date with timezone at which the Fulfillment was canceled.
nullable: true
type: string
format: date-time
idempotency_key:
description: >-
Randomly generated key used to continue the completion of the
fulfillment in case of failure.
nullable: true
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
GiftCardTransaction:
title: Gift Card Transaction
description: >-
Gift Card Transactions are created once a Customer uses a Gift Card to
pay for their Order
type: object
required:
- amount
- created_at
- gift_card_id
- id
- is_taxable
- order_id
- tax_rate
properties:
id:
description: The gift card transaction's ID
type: string
example: gct_01G8X9A7ESKAJXG2H0E6F1MW7A
gift_card_id:
description: The ID of the Gift Card that was used in the transaction.
type: string
example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ
gift_card:
description: >-
A gift card object. Available if the relation `gift_card` is
expanded.
nullable: true
$ref: '#/components/schemas/GiftCard'
order_id:
description: The ID of the Order that the Gift Card was used to pay for.
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
description: An order object. Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
amount:
description: The amount that was used from the Gift Card.
type: integer
example: 10
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
is_taxable:
description: Whether the transaction is taxable or not.
nullable: true
type: boolean
example: false
tax_rate:
description: The tax rate of the transaction
nullable: true
type: number
example: 0
GiftCard:
title: Gift Card
description: >-
Gift Cards are redeemable and represent a value that can be used towards
the payment of an Order.
type: object
required:
- balance
- code
- created_at
- deleted_at
- ends_at
- id
- is_disabled
- metadata
- order_id
- region_id
- tax_rate
- updated_at
- value
properties:
id:
description: The gift card's ID
type: string
example: gift_01G8XKBPBQY2R7RBET4J7E0XQZ
code:
description: >-
The unique code that identifies the Gift Card. This is used by the
Customer to redeem the value of the Gift Card.
type: string
example: 3RFT-MH2C-Y4YZ-XMN4
value:
description: The value that the Gift Card represents.
type: integer
example: 10
balance:
description: The remaining value on the Gift Card.
type: integer
example: 10
region_id:
description: The id of the Region in which the Gift Card is available.
type: string
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: A region object. Available if the relation `region` is expanded.
nullable: true
$ref: '#/components/schemas/Region'
order_id:
description: The id of the Order that the Gift Card was purchased in.
nullable: true
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
description: An order object. Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
is_disabled:
description: >-
Whether the Gift Card has been disabled. Disabled Gift Cards cannot
be applied to carts.
type: boolean
default: false
ends_at:
description: The time at which the Gift Card can no longer be used.
nullable: true
type: string
format: date-time
tax_rate:
description: The gift card's tax rate that will be applied on calculating totals
nullable: true
type: number
example: 0
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
IdempotencyKey:
title: Idempotency Key
description: >-
Idempotency Key is used to continue a process in case of any failure
that might occur.
type: object
required:
- created_at
- id
- idempotency_key
- locked_at
- recovery_point
- response_code
- response_body
- request_method
- request_params
- request_path
properties:
id:
description: The idempotency key's ID
type: string
example: ikey_01G8X9A7ESKAJXG2H0E6F1MW7A
idempotency_key:
description: >-
The unique randomly generated key used to determine the state of a
process.
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
created_at:
description: Date which the idempotency key was locked.
type: string
format: date-time
locked_at:
description: Date which the idempotency key was locked.
nullable: true
type: string
format: date-time
request_method:
description: The method of the request
nullable: true
type: string
example: POST
request_params:
description: The parameters passed to the request
nullable: true
type: object
example:
id: cart_01G8ZH853Y6TFXWPG5EYE81X63
request_path:
description: The request's path
nullable: true
type: string
example: /store/carts/cart_01G8ZH853Y6TFXWPG5EYE81X63/complete
response_code:
description: The response's code.
nullable: true
type: string
example: 200
response_body:
description: The response's body
nullable: true
type: object
example:
id: cart_01G8ZH853Y6TFXWPG5EYE81X63
recovery_point:
description: Where to continue from.
type: string
default: started
Image:
title: Image
description: Images holds a reference to a URL at which the image file can be found.
type: object
required:
- created_at
- deleted_at
- id
- metadata
- updated_at
- url
properties:
id:
type: string
description: The image's ID
example: img_01G749BFYR6T8JTVW6SGW3K3E6
url:
description: The URL at which the image file can be found.
type: string
format: uri
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
Invite:
title: Invite
description: Represents an invite
type: object
required:
- accepted
- created_at
- deleted_at
- expires_at
- id
- metadata
- role
- token
- updated_at
- user_email
properties:
id:
type: string
description: The invite's ID
example: invite_01G8TKE4XYCTHSCK2GDEP47RE1
user_email:
description: The email of the user being invited.
type: string
format: email
role:
description: The user's role.
nullable: true
type: string
enum:
- admin
- member
- developer
default: member
accepted:
description: Whether the invite was accepted or not.
type: boolean
default: false
token:
description: The token used to accept the invite.
type: string
expires_at:
description: The date the invite expires at.
type: string
format: date-time
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
LineItemAdjustment:
title: Line Item Adjustment
description: Represents a Line Item Adjustment
type: object
required:
- amount
- description
- discount_id
- id
- item_id
- metadata
properties:
id:
description: The Line Item Adjustment's ID
type: string
example: lia_01G8TKE4XYCTHSCK2GDEP47RE1
item_id:
description: The ID of the line item
type: string
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
item:
description: Available if the relation `item` is expanded.
nullable: true
$ref: '#/components/schemas/LineItem'
description:
description: The line item's adjustment description
type: string
example: Adjusted item's price.
discount_id:
description: The ID of the discount associated with the adjustment
nullable: true
type: string
example: disc_01F0YESMW10MGHWJKZSDDMN0VN
discount:
description: Available if the relation `discount` is expanded.
nullable: true
$ref: '#/components/schemas/Discount'
amount:
description: The adjustment amount
type: integer
example: 1000
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
LineItemTaxLine:
title: Line Item Tax Line
description: Represents a Line Item Tax Line
type: object
required:
- code
- created_at
- id
- item_id
- metadata
- name
- rate
- updated_at
properties:
id:
description: The line item tax line's ID
type: string
example: litl_01G1G5V2DRX1SK6NQQ8VVX4HQ8
code:
description: A code to identify the tax type by
nullable: true
type: string
example: tax01
name:
description: A human friendly name for the tax
type: string
example: Tax Example
rate:
description: The numeric rate to charge tax by
type: number
example: 10
item_id:
description: The ID of the line item
type: string
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
item:
description: Available if the relation `item` is expanded.
nullable: true
$ref: '#/components/schemas/LineItem'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
LineItem:
title: Line Item
description: >-
Line Items represent purchasable units that can be added to a Cart for
checkout. When Line Items are purchased they will get copied to the
resulting order and can eventually be referenced in Fulfillments and
Returns. Line Items may also be created when processing Swaps and
Claims.
type: object
required:
- allow_discounts
- cart_id
- claim_order_id
- created_at
- description
- fulfilled_quantity
- has_shipping
- id
- is_giftcard
- is_return
- metadata
- order_edit_id
- order_id
- original_item_id
- quantity
- returned_quantity
- shipped_quantity
- should_merge
- swap_id
- thumbnail
- title
- unit_price
- updated_at
- variant_id
properties:
id:
description: The line item's ID
type: string
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
cart_id:
description: The ID of the Cart that the Line Item belongs to.
nullable: true
type: string
example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
description: A cart object. Available if the relation `cart` is expanded.
nullable: true
$ref: '#/components/schemas/Cart'
order_id:
description: The ID of the Order that the Line Item belongs to.
nullable: true
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
description: An order object. Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
swap_id:
description: The id of the Swap that the Line Item belongs to.
nullable: true
type: string
example: null
swap:
description: A swap object. Available if the relation `swap` is expanded.
nullable: true
$ref: '#/components/schemas/Swap'
claim_order_id:
description: The id of the Claim that the Line Item belongs to.
nullable: true
type: string
example: null
claim_order:
description: >-
A claim order object. Available if the relation `claim_order` is
expanded.
nullable: true
$ref: '#/components/schemas/ClaimOrder'
tax_lines:
description: Available if the relation `tax_lines` is expanded.
type: array
items:
$ref: '#/components/schemas/LineItemTaxLine'
adjustments:
description: Available if the relation `adjustments` is expanded.
type: array
items:
$ref: '#/components/schemas/LineItemAdjustment'
original_item_id:
description: The id of the original line item
nullable: true
type: string
order_edit_id:
description: The ID of the order edit to which a cloned item belongs
nullable: true
type: string
order_edit:
description: >-
The order edit joined. Available if the relation `order_edit` is
expanded.
nullable: true
$ref: '#/components/schemas/OrderEdit'
title:
description: >-
The title of the Line Item, this should be easily identifiable by
the Customer.
type: string
example: Medusa Coffee Mug
description:
description: A more detailed description of the contents of the Line Item.
nullable: true
type: string
example: One Size
thumbnail:
description: A URL string to a small image of the contents of the Line Item.
nullable: true
type: string
format: uri
example: >-
https://medusa-public-images.s3.eu-west-1.amazonaws.com/coffee-mug.png
is_return:
description: Is the item being returned
type: boolean
default: false
is_giftcard:
description: Flag to indicate if the Line Item is a Gift Card.
type: boolean
default: false
should_merge:
description: >-
Flag to indicate if new Line Items with the same variant should be
merged or added as an additional Line Item.
type: boolean
default: true
allow_discounts:
description: >-
Flag to indicate if the Line Item should be included when doing
discount calculations.
type: boolean
default: true
has_shipping:
description: >-
Flag to indicate if the Line Item has fulfillment associated with
it.
nullable: true
type: boolean
example: false
unit_price:
description: >-
The price of one unit of the content in the Line Item. This should
be in the currency defined by the Cart/Order/Swap/Claim that the
Line Item belongs to.
type: integer
example: 8000
variant_id:
description: The id of the Product Variant contained in the Line Item.
nullable: true
type: string
example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
variant:
description: >-
A product variant object. The Product Variant contained in the Line
Item. Available if the relation `variant` is expanded.
nullable: true
$ref: '#/components/schemas/ProductVariant'
quantity:
description: The quantity of the content in the Line Item.
type: integer
example: 1
fulfilled_quantity:
description: The quantity of the Line Item that has been fulfilled.
nullable: true
type: integer
example: 0
returned_quantity:
description: The quantity of the Line Item that has been returned.
nullable: true
type: integer
example: 0
shipped_quantity:
description: The quantity of the Line Item that has been shipped.
nullable: true
type: integer
example: 0
refundable:
description: >-
The amount that can be refunded from the given Line Item. Takes
taxes and discounts into consideration.
type: integer
example: 0
subtotal:
description: The subtotal of the line item
type: integer
example: 8000
tax_total:
description: The total of tax of the line item
type: integer
example: 0
total:
description: The total amount of the line item
type: integer
example: 8000
original_total:
description: The original total amount of the line item
type: integer
example: 8000
original_tax_total:
description: The original tax total amount of the line item
type: integer
example: 0
discount_total:
description: The total of discount of the line item
type: integer
example: 0
gift_card_total:
description: The total of the gift card of the line item
type: integer
example: 0
includes_tax:
description: '[EXPERIMENTAL] Indicates if the line item unit_price include tax'
type: boolean
default: false
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
MoneyAmount:
title: Money Amount
description: >-
Money Amounts represents an amount that a given Product Variant can be
purcased for. Each Money Amount either has a Currency or Region
associated with it to indicate the pricing in a given Currency or, for
fully region-based pricing, the given price in a specific Region. If
region-based pricing is used the amount will be in the currency defined
for the Reigon.
type: object
required:
- amount
- created_at
- currency_code
- deleted_at
- id
- max_quantity
- min_quantity
- price_list_id
- region_id
- updated_at
- variant_id
properties:
id:
description: The money amount's ID
type: string
example: ma_01F0YESHRFQNH5S8Q0PK84YYZN
currency_code:
description: The 3 character currency code that the Money Amount is given in.
type: string
example: usd
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
currency:
description: Available if the relation `currency` is expanded.
nullable: true
$ref: '#/components/schemas/Currency'
amount:
description: >-
The amount in the smallest currecny unit (e.g. cents 100 cents to
charge $1) that the Product Variant will cost.
type: integer
example: 100
min_quantity:
description: >-
The minimum quantity that the Money Amount applies to. If this value
is not set, the Money Amount applies to all quantities.
nullable: true
type: integer
example: 1
max_quantity:
description: >-
The maximum quantity that the Money Amount applies to. If this value
is not set, the Money Amount applies to all quantities.
nullable: true
type: integer
example: 1
price_list_id:
description: The ID of the price list associated with the money amount
nullable: true
type: string
example: pl_01G8X3CKJXCG5VXVZ87H9KC09W
price_list:
description: Available if the relation `price_list` is expanded.
nullable: true
$ref: '#/components/schemas/PriceList'
variant_id:
description: The id of the Product Variant contained in the Line Item.
nullable: true
type: string
example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
variant:
description: >-
The Product Variant contained in the Line Item. Available if the
relation `variant` is expanded.
nullable: true
$ref: '#/components/schemas/ProductVariant'
region_id:
description: The region's ID
nullable: true
type: string
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: A region object. Available if the relation `region` is expanded.
nullable: true
$ref: '#/components/schemas/Region'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
Note:
title: Note
description: >-
Notes are elements which we can use in association with different
resources to allow users to describe additional information in relation
to these.
type: object
required:
- author_id
- created_at
- deleted_at
- id
- metadata
- resource_id
- resource_type
- updated_at
- value
properties:
id:
description: The note's ID
type: string
example: note_01G8TM8ENBMC7R90XRR1G6H26Q
resource_type:
description: The type of resource that the Note refers to.
type: string
example: order
resource_id:
description: The ID of the resource that the Note refers to.
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
value:
description: The contents of the note.
type: string
example: This order must be fulfilled on Monday
author_id:
description: The ID of the author (user)
nullable: true
type: string
example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
author:
description: Available if the relation `author` is expanded.
nullable: true
$ref: '#/components/schemas/User'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
NotificationProvider:
title: Notification Provider
description: >-
Represents a notification provider plugin and holds its installation
status.
type: object
required:
- id
- is_installed
properties:
id:
description: The id of the notification provider as given by the plugin.
type: string
example: sendgrid
is_installed:
description: >-
Whether the plugin is installed in the current version. Plugins that
are no longer installed are not deleted by will have this field set
to `false`.
type: boolean
default: true
Notification:
title: Notification
description: >-
Notifications a communications sent via Notification Providers as a
reaction to internal events such as `order.placed`. Notifications can be
used to show a chronological timeline for communications sent to a
Customer regarding an Order, and enables resends.
type: object
required:
- created_at
- customer_id
- data
- event_name
- id
- parent_id
- provider_id
- resource_type
- resource_id
- to
- updated_at
properties:
id:
description: The notification's ID
type: string
example: noti_01G53V9Y6CKMCGBM1P0X7C28RX
event_name:
description: The name of the event that the notification was sent for.
nullable: true
type: string
example: order.placed
resource_type:
description: The type of resource that the Notification refers to.
type: string
example: order
resource_id:
description: The ID of the resource that the Notification refers to.
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
customer_id:
description: The ID of the Customer that the Notification was sent to.
nullable: true
type: string
example: cus_01G2SG30J8C85S4A5CHM2S1NS2
customer:
description: A customer object. Available if the relation `customer` is expanded.
nullable: true
$ref: '#/components/schemas/Customer'
to:
description: >-
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
type: string
example: user@example.com
data:
description: >-
The data that the Notification was sent with. This contains all the
data necessary for the Notification Provider to initiate a resend.
type: object
example: {}
parent_id:
description: The notification's parent ID
nullable: true
type: string
example: noti_01G53V9Y6CKMCGBM1P0X7C28RX
parent_notification:
description: Available if the relation `parent_notification` is expanded.
nullable: true
$ref: '#/components/schemas/Notification'
resends:
description: >-
The resends that have been completed after the original
Notification. Available if the relation `resends` is expanded.
type: array
items:
$ref: '#/components/schemas/Notification'
provider_id:
description: The id of the Notification Provider that handles the Notification.
nullable: true
type: string
example: sengrid
provider:
description: Available if the relation `provider` is expanded.
nullable: true
$ref: '#/components/schemas/NotificationProvider'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
OAuth:
title: OAuth
description: Represent an OAuth app
type: object
required:
- application_name
- data
- display_name
- id
- install_url
- uninstall_url
properties:
id:
description: The app's ID
type: string
example: example_app
display_name:
description: The app's display name
type: string
example: Example app
application_name:
description: The app's name
type: string
example: example
install_url:
description: The URL to install the app
nullable: true
type: string
format: uri
uninstall_url:
description: The URL to uninstall the app
nullable: true
type: string
format: uri
data:
description: Any data necessary to the app.
nullable: true
type: object
example: {}
OrderEdit:
title: Order Edit
description: Order edit keeps track of order items changes.
type: object
required:
- canceled_at
- canceled_by
- confirmed_by
- confirmed_at
- created_at
- created_by
- declined_at
- declined_by
- declined_reason
- id
- internal_note
- order_id
- payment_collection_id
- requested_at
- requested_by
- status
- updated_at
properties:
id:
description: The order edit's ID
type: string
example: oe_01G8TJSYT9M6AVS5N4EMNFS1EK
order_id:
description: The ID of the order that is edited
type: string
example: order_01G2SG30J8C85S4A5CHM2S1NS2
order:
description: Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
changes:
description: Available if the relation `changes` is expanded.
type: array
items:
$ref: '#/components/schemas/OrderItemChange'
internal_note:
description: An optional note with additional details about the order edit.
nullable: true
type: string
example: Included two more items B to the order.
created_by:
description: >-
The unique identifier of the user or customer who created the order
edit.
type: string
requested_by:
description: >-
The unique identifier of the user or customer who requested the
order edit.
nullable: true
type: string
requested_at:
description: The date with timezone at which the edit was requested.
nullable: true
type: string
format: date-time
confirmed_by:
description: >-
The unique identifier of the user or customer who confirmed the
order edit.
nullable: true
type: string
confirmed_at:
description: The date with timezone at which the edit was confirmed.
nullable: true
type: string
format: date-time
declined_by:
description: >-
The unique identifier of the user or customer who declined the order
edit.
nullable: true
type: string
declined_at:
description: The date with timezone at which the edit was declined.
nullable: true
type: string
format: date-time
declined_reason:
description: An optional note why the order edit is declined.
nullable: true
type: string
canceled_by:
description: >-
The unique identifier of the user or customer who cancelled the
order edit.
nullable: true
type: string
canceled_at:
description: The date with timezone at which the edit was cancelled.
nullable: true
type: string
format: date-time
subtotal:
description: The total of subtotal
type: integer
example: 8000
discount_total:
description: The total of discount
type: integer
example: 800
shipping_total:
description: The total of the shipping amount
type: integer
example: 800
gift_card_total:
description: The total of the gift card amount
type: integer
example: 800
gift_card_tax_total:
description: The total of the gift card tax amount
type: integer
example: 800
tax_total:
description: The total of tax
type: integer
example: 0
total:
description: The total amount of the edited order.
type: integer
example: 8200
difference_due:
description: >-
The difference between the total amount of the order and total
amount of edited order.
type: integer
example: 8200
status:
description: The status of the order edit.
type: string
enum:
- confirmed
- declined
- requested
- created
- canceled
items:
description: Available if the relation `items` is expanded.
type: array
items:
$ref: '#/components/schemas/LineItem'
payment_collection_id:
description: The ID of the payment collection
nullable: true
type: string
example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
payment_collection:
description: Available if the relation `payment_collection` is expanded.
nullable: true
$ref: '#/components/schemas/PaymentCollection'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
OrderItemChange:
title: Order Item Change
description: Represents an order edit item change
type: object
required:
- created_at
- deleted_at
- id
- line_item_id
- order_edit_id
- original_line_item_id
- type
- updated_at
properties:
id:
description: The order item change's ID
type: string
example: oic_01G8TJSYT9M6AVS5N4EMNFS1EK
type:
description: The order item change's status
type: string
enum:
- item_add
- item_remove
- item_update
order_edit_id:
description: The ID of the order edit
type: string
example: oe_01G2SG30J8C85S4A5CHM2S1NS2
order_edit:
description: Available if the relation `order_edit` is expanded.
nullable: true
$ref: '#/components/schemas/OrderEdit'
original_line_item_id:
description: The ID of the original line item in the order
nullable: true
type: string
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
original_line_item:
description: Available if the relation `original_line_item` is expanded.
nullable: true
$ref: '#/components/schemas/LineItem'
line_item_id:
description: The ID of the cloned line item.
nullable: true
type: string
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
line_item:
description: Available if the relation `line_item` is expanded.
nullable: true
$ref: '#/components/schemas/LineItem'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
Order:
title: Order
description: Represents an order
type: object
required:
- billing_address_id
- canceled_at
- cart_id
- created_at
- currency_code
- customer_id
- draft_order_id
- display_id
- email
- external_id
- fulfillment_status
- id
- idempotency_key
- metadata
- no_notification
- object
- payment_status
- region_id
- shipping_address_id
- status
- tax_rate
- updated_at
properties:
id:
description: The order's ID
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
status:
description: The order's status
type: string
enum:
- pending
- completed
- archived
- canceled
- requires_action
default: pending
fulfillment_status:
description: The order's fulfillment status
type: string
enum:
- not_fulfilled
- partially_fulfilled
- fulfilled
- partially_shipped
- shipped
- partially_returned
- returned
- canceled
- requires_action
default: not_fulfilled
payment_status:
description: The order's payment status
type: string
enum:
- not_paid
- awaiting
- captured
- partially_refunded
- refunded
- canceled
- requires_action
default: not_paid
display_id:
description: The order's display ID
type: integer
example: 2
cart_id:
description: The ID of the cart associated with the order
nullable: true
type: string
example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
description: A cart object. Available if the relation `cart` is expanded.
nullable: true
$ref: '#/components/schemas/Cart'
customer_id:
description: The ID of the customer associated with the order
type: string
example: cus_01G2SG30J8C85S4A5CHM2S1NS2
customer:
description: A customer object. Available if the relation `customer` is expanded.
nullable: true
$ref: '#/components/schemas/Customer'
email:
description: The email associated with the order
type: string
format: email
billing_address_id:
description: The ID of the billing address associated with the order
nullable: true
type: string
example: addr_01G8ZH853YPY9B94857DY91YGW
billing_address:
description: Available if the relation `billing_address` is expanded.
nullable: true
$ref: '#/components/schemas/Address'
shipping_address_id:
description: The ID of the shipping address associated with the order
nullable: true
type: string
example: addr_01G8ZH853YPY9B94857DY91YGW
shipping_address:
description: Available if the relation `shipping_address` is expanded.
nullable: true
$ref: '#/components/schemas/Address'
region_id:
description: The region's ID
type: string
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: A region object. Available if the relation `region` is expanded.
nullable: true
$ref: '#/components/schemas/Region'
currency_code:
description: The 3 character currency code that is used in the order
type: string
example: usd
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
currency:
description: Available if the relation `currency` is expanded.
nullable: true
$ref: '#/components/schemas/Currency'
tax_rate:
description: The order's tax rate
nullable: true
type: number
example: 0
discounts:
description: >-
The discounts used in the order. Available if the relation
`discounts` is expanded.
type: array
items:
$ref: '#/components/schemas/Discount'
gift_cards:
description: >-
The gift cards used in the order. Available if the relation
`gift_cards` is expanded.
type: array
items:
$ref: '#/components/schemas/GiftCard'
shipping_methods:
description: >-
The shipping methods used in the order. Available if the relation
`shipping_methods` is expanded.
type: array
items:
$ref: '#/components/schemas/ShippingMethod'
payments:
description: >-
The payments used in the order. Available if the relation `payments`
is expanded.
type: array
items:
$ref: '#/components/schemas/Payment'
fulfillments:
description: >-
The fulfillments used in the order. Available if the relation
`fulfillments` is expanded.
type: array
items:
$ref: '#/components/schemas/Fulfillment'
returns:
description: >-
The returns associated with the order. Available if the relation
`returns` is expanded.
type: array
items:
$ref: '#/components/schemas/Return'
claims:
description: >-
The claims associated with the order. Available if the relation
`claims` is expanded.
type: array
items:
$ref: '#/components/schemas/ClaimOrder'
refunds:
description: >-
The refunds associated with the order. Available if the relation
`refunds` is expanded.
type: array
items:
$ref: '#/components/schemas/Refund'
swaps:
description: >-
The swaps associated with the order. Available if the relation
`swaps` is expanded.
type: array
items:
$ref: '#/components/schemas/Swap'
draft_order_id:
description: The ID of the draft order this order is associated with.
nullable: true
type: string
example: null
draft_order:
description: >-
A draft order object. Available if the relation `draft_order` is
expanded.
nullable: true
$ref: '#/components/schemas/DraftOrder'
items:
description: >-
The line items that belong to the order. Available if the relation
`items` is expanded.
type: array
items:
$ref: '#/components/schemas/LineItem'
edits:
description: >-
Order edits done on the order. Available if the relation `edits` is
expanded.
type: array
items:
$ref: '#/components/schemas/OrderEdit'
gift_card_transactions:
description: >-
The gift card transactions used in the order. Available if the
relation `gift_card_transactions` is expanded.
type: array
items:
$ref: '#/components/schemas/GiftCardTransaction'
canceled_at:
description: The date the order was canceled on.
nullable: true
type: string
format: date-time
no_notification:
description: >-
Flag for describing whether or not notifications related to this
should be send.
nullable: true
type: boolean
example: false
idempotency_key:
description: >-
Randomly generated key used to continue the processing of the order
in case of failure.
nullable: true
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
external_id:
description: The ID of an external order.
nullable: true
type: string
example: null
sales_channel_id:
description: The ID of the sales channel this order is associated with.
nullable: true
type: string
example: null
sales_channel:
description: >-
A sales channel object. Available if the relation `sales_channel` is
expanded.
nullable: true
$ref: '#/components/schemas/SalesChannel'
shipping_total:
type: integer
description: The total of shipping
example: 1000
discount_total:
description: The total of discount
type: integer
example: 800
tax_total:
description: The total of tax
type: integer
example: 0
refunded_total:
description: The total amount refunded if the order is returned.
type: integer
example: 0
total:
description: The total amount of the order
type: integer
example: 8200
subtotal:
description: The subtotal of the order
type: integer
example: 8000
paid_total:
description: The total amount paid
type: integer
example: 8000
refundable_amount:
description: The amount that can be refunded
type: integer
example: 8200
gift_card_total:
description: The total of gift cards
type: integer
example: 0
gift_card_tax_total:
description: The total of gift cards with taxes
type: integer
example: 0
returnable_items:
description: >-
The items that are returnable as part of the order, order swaps or
order claims
type: array
items:
$ref: '#/components/schemas/LineItem'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
PaymentCollection:
title: Payment Collection
description: Payment Collection
type: object
required:
- amount
- authorized_amount
- created_at
- created_by
- currency_code
- deleted_at
- description
- id
- metadata
- region_id
- status
- type
- updated_at
properties:
id:
description: The payment collection's ID
type: string
example: paycol_01G8TJSYT9M6AVS5N4EMNFS1EK
type:
description: The type of the payment collection
type: string
enum:
- order_edit
status:
description: The type of the payment collection
type: string
enum:
- not_paid
- awaiting
- authorized
- partially_authorized
- canceled
description:
description: Description of the payment collection
nullable: true
type: string
amount:
description: Amount of the payment collection.
type: integer
authorized_amount:
description: Authorized amount of the payment collection.
nullable: true
type: integer
region_id:
description: The region's ID
type: string
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: Available if the relation `region` is expanded.
nullable: true
$ref: '#/components/schemas/Region'
currency_code:
description: The 3 character ISO code for the currency.
type: string
example: usd
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
currency:
description: Available if the relation `currency` is expanded.
nullable: true
$ref: '#/components/schemas/Currency'
payment_sessions:
description: Available if the relation `payment_sessions` is expanded.
type: array
items:
$ref: '#/components/schemas/PaymentSession'
payments:
description: Available if the relation `payments` is expanded.
type: array
items:
$ref: '#/components/schemas/Payment'
created_by:
description: The ID of the user that created the payment collection.
type: string
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
PaymentProvider:
title: Payment Provider
description: Represents a Payment Provider plugin and holds its installation status.
type: object
required:
- id
- is_installed
properties:
id:
description: The id of the payment provider as given by the plugin.
type: string
example: manual
is_installed:
description: >-
Whether the plugin is installed in the current version. Plugins that
are no longer installed are not deleted by will have this field set
to `false`.
type: boolean
default: true
PaymentSession:
title: Payment Session
description: >-
Payment Sessions are created when a Customer initilizes the checkout
flow, and can be used to hold the state of a payment flow. Each Payment
Session is controlled by a Payment Provider, who is responsible for the
communication with external payment services. Authorized Payment
Sessions will eventually get promoted to Payments to indicate that they
are authorized for capture/refunds/etc.
type: object
required:
- amount
- cart_id
- created_at
- data
- id
- is_initiated
- is_selected
- idempotency_key
- payment_authorized_at
- provider_id
- status
- updated_at
properties:
id:
description: The payment session's ID
type: string
example: ps_01G901XNSRM2YS3ASN9H5KG3FZ
cart_id:
description: The id of the Cart that the Payment Session is created for.
nullable: true
type: string
example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
description: A cart object. Available if the relation `cart` is expanded.
nullable: true
$ref: '#/components/schemas/Cart'
provider_id:
description: >-
The id of the Payment Provider that is responsible for the Payment
Session
type: string
example: manual
is_selected:
description: >-
A flag to indicate if the Payment Session has been selected as the
method that will be used to complete the purchase.
nullable: true
type: boolean
example: true
is_initiated:
description: >-
A flag to indicate if a communication with the third party provider
has been initiated.
type: boolean
default: false
example: true
status:
description: >-
Indicates the status of the Payment Session. Will default to
`pending`, and will eventually become `authorized`. Payment Sessions
may have the status of `requires_more` to indicate that further
actions are to be completed by the Customer.
type: string
enum:
- authorized
- pending
- requires_more
- error
- canceled
example: pending
data:
description: >-
The data required for the Payment Provider to identify, modify and
process the Payment Session. Typically this will be an object that
holds an id to the external payment session, but can be an empty
object if the Payment Provider doesn't hold any state.
type: object
example: {}
idempotency_key:
description: >-
Randomly generated key used to continue the completion of a cart in
case of failure.
nullable: true
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
amount:
description: The amount that the Payment Session has been authorized for.
nullable: true
type: integer
example: 100
payment_authorized_at:
description: The date with timezone at which the Payment Session was authorized.
nullable: true
type: string
format: date-time
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
Payment:
title: Payment
description: >-
Payments represent an amount authorized with a given payment method,
Payments can be captured, canceled or refunded.
type: object
required:
- amount
- amount_refunded
- canceled_at
- captured_at
- cart_id
- created_at
- currency_code
- data
- id
- idempotency_key
- metadata
- order_id
- provider_id
- swap_id
- updated_at
properties:
id:
description: The payment's ID
type: string
example: pay_01G2SJNT6DEEWDFNAJ4XWDTHKE
swap_id:
description: The ID of the Swap that the Payment is used for.
nullable: true
type: string
example: null
swap:
description: A swap object. Available if the relation `swap` is expanded.
nullable: true
$ref: '#/components/schemas/Swap'
cart_id:
description: The id of the Cart that the Payment Session is created for.
nullable: true
type: string
cart:
description: A cart object. Available if the relation `cart` is expanded.
nullable: true
$ref: '#/components/schemas/Cart'
order_id:
description: The ID of the Order that the Payment is used for.
nullable: true
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
description: An order object. Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
amount:
description: The amount that the Payment has been authorized for.
type: integer
example: 100
currency_code:
description: The 3 character ISO currency code that the Payment is completed in.
type: string
example: usd
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
currency:
description: Available if the relation `currency` is expanded.
nullable: true
$ref: '#/components/schemas/Currency'
amount_refunded:
description: >-
The amount of the original Payment amount that has been refunded
back to the Customer.
type: integer
default: 0
example: 0
provider_id:
description: The id of the Payment Provider that is responsible for the Payment
type: string
example: manual
data:
description: >-
The data required for the Payment Provider to identify, modify and
process the Payment. Typically this will be an object that holds an
id to the external payment session, but can be an empty object if
the Payment Provider doesn't hold any state.
type: object
example: {}
captured_at:
description: The date with timezone at which the Payment was captured.
nullable: true
type: string
format: date-time
canceled_at:
description: The date with timezone at which the Payment was canceled.
nullable: true
type: string
format: date-time
idempotency_key:
description: >-
Randomly generated key used to continue the completion of a payment
in case of failure.
nullable: true
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
PriceList:
title: Price List
description: >-
Price Lists represents a set of prices that overrides the default price
for one or more product variants.
type: object
required:
- created_at
- deleted_at
- description
- ends_at
- id
- name
- starts_at
- status
- type
- updated_at
properties:
id:
description: The price list's ID
type: string
example: pl_01G8X3CKJXCG5VXVZ87H9KC09W
name:
description: The price list's name
type: string
example: VIP Prices
description:
description: The price list's description
type: string
example: Prices for VIP customers
type:
description: >-
The type of Price List. This can be one of either `sale` or
`override`.
type: string
enum:
- sale
- override
default: sale
status:
description: The status of the Price List
type: string
enum:
- active
- draft
default: draft
starts_at:
description: The date with timezone that the Price List starts being valid.
nullable: true
type: string
format: date-time
ends_at:
description: The date with timezone that the Price List stops being valid.
nullable: true
type: string
format: date-time
customer_groups:
description: >-
The Customer Groups that the Price List applies to. Available if the
relation `customer_groups` is expanded.
type: array
items:
$ref: '#/components/schemas/CustomerGroup'
prices:
description: >-
The Money Amounts that are associated with the Price List. Available
if the relation `prices` is expanded.
type: array
items:
$ref: '#/components/schemas/MoneyAmount'
includes_tax:
description: '[EXPERIMENTAL] Does the price list prices include tax'
type: boolean
default: false
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
ProductCategory:
title: ProductCategory
description: Represents a product category
x-resourceId: ProductCategory
type: object
required:
- category_children
- created_at
- deleted_at
- handle
- id
- is_active
- is_internal
- mpath
- name
- parent_category_id
- updated_at
properties:
id:
description: The product category's ID
type: string
example: pcat_01G2SG30J8C85S4A5CHM2S1NS2
name:
description: The product category's name
type: string
example: Regular Fit
handle:
description: >-
A unique string that identifies the Product Category - can for
example be used in slug structures.
type: string
example: regular-fit
mpath:
description: >-
A string for Materialized Paths - used for finding ancestors and
descendents
nullable: true
type: string
example: pcat_id1.pcat_id2.pcat_id3
is_internal:
type: boolean
description: A flag to make product category an internal category for admins
default: false
is_active:
type: boolean
description: A flag to make product category visible/hidden in the store front
default: false
category_children:
description: Available if the relation `category_children` are expanded.
type: array
items:
$ref: '#/components/schemas/ProductCategory'
parent_category_id:
description: The ID of the parent category.
nullable: true
type: string
default: null
parent_category:
description: >-
A product category object. Available if the relation
`parent_category` is expanded.
nullable: true
$ref: '#/components/schemas/ProductCategory'
products:
description: >-
Products associated with category. Available if the relation
`products` is expanded.
type: array
items:
$ref: '#/components/schemas/Product'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
ProductCollection:
title: Product Collection
description: Product Collections represents a group of Products that are related.
type: object
required:
- created_at
- deleted_at
- handle
- id
- metadata
- title
- updated_at
properties:
id:
description: The product collection's ID
type: string
example: pcol_01F0YESBFAZ0DV6V831JXWH0BG
title:
description: The title that the Product Collection is identified by.
type: string
example: Summer Collection
handle:
description: >-
A unique string that identifies the Product Collection - can for
example be used in slug structures.
nullable: true
type: string
example: summer-collection
products:
description: >-
The Products contained in the Product Collection. Available if the
relation `products` is expanded.
type: array
items:
$ref: '#/components/schemas/Product'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ProductOptionValue:
title: Product Option Value
description: >-
A value given to a Product Variant's option set. Product Variant have a
Product Option Value for each of the Product Options defined on the
Product.
type: object
required:
- created_at
- deleted_at
- id
- metadata
- option_id
- updated_at
- value
- variant_id
properties:
id:
description: The product option value's ID
type: string
example: optval_01F0YESHR7S6ECD03RF6W12DSJ
value:
description: >-
The value that the Product Variant has defined for the specific
Product Option (e.g. if the Product Option is \"Size\" this value
could be `Small`, `Medium` or `Large`).
type: string
example: large
option_id:
description: >-
The ID of the Product Option that the Product Option Value is
defined for.
type: string
example: opt_01F0YESHQBZVKCEXJ24BS6PCX3
option:
description: Available if the relation `option` is expanded.
nullable: true
$ref: '#/components/schemas/ProductOption'
variant_id:
description: >-
The ID of the Product Variant that the Product Option Value is
defined for.
type: string
example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
variant:
description: Available if the relation `variant` is expanded.
nullable: true
$ref: '#/components/schemas/ProductVariant'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ProductOption:
title: Product Option
description: >-
Product Options define properties that may vary between different
variants of a Product. Common Product Options are "Size" and "Color",
but Medusa doesn't limit what Product Options that can be defined.
type: object
required:
- created_at
- deleted_at
- id
- metadata
- product_id
- title
- updated_at
properties:
id:
description: The product option's ID
type: string
example: opt_01F0YESHQBZVKCEXJ24BS6PCX3
title:
description: The title that the Product Option is defined by (e.g. `Size`).
type: string
example: Size
values:
description: >-
The Product Option Values that are defined for the Product Option.
Available if the relation `values` is expanded.
type: array
items:
$ref: '#/components/schemas/ProductOptionValue'
product_id:
description: The ID of the Product that the Product Option is defined for.
type: string
example: prod_01G1G5V2MBA328390B5AXJ610F
product:
description: A product object. Available if the relation `product` is expanded.
nullable: true
$ref: '#/components/schemas/Product'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ProductTag:
title: Product Tag
description: Product Tags can be added to Products for easy filtering and grouping.
type: object
required:
- created_at
- deleted_at
- id
- metadata
- updated_at
- value
properties:
id:
description: The product tag's ID
type: string
example: ptag_01G8K2MTMG9168F2B70S1TAVK3
value:
description: The value that the Product Tag represents
type: string
example: Pants
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ProductTaxRate:
title: Product Tax Rate
description: >-
Associates a tax rate with a product to indicate that the product is
taxed in a certain way
type: object
required:
- created_at
- metadata
- product_id
- rate_id
- updated_at
properties:
product_id:
description: The ID of the Product
type: string
example: prod_01G1G5V2MBA328390B5AXJ610F
product:
description: Available if the relation `product` is expanded.
nullable: true
$ref: '#/components/schemas/Product'
rate_id:
description: The ID of the Tax Rate
type: string
example: txr_01G8XDBAWKBHHJRKH0AV02KXBR
tax_rate:
description: Available if the relation `tax_rate` is expanded.
nullable: true
$ref: '#/components/schemas/TaxRate'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ProductTypeTaxRate:
title: Product Type Tax Rate
description: >-
Associates a tax rate with a product type to indicate that the product
type is taxed in a certain way
type: object
required:
- created_at
- metadata
- product_type_id
- rate_id
- updated_at
properties:
product_type_id:
description: The ID of the Product type
type: string
example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A
product_type:
description: Available if the relation `product_type` is expanded.
nullable: true
$ref: '#/components/schemas/ProductType'
rate_id:
description: The id of the Tax Rate
type: string
example: txr_01G8XDBAWKBHHJRKH0AV02KXBR
tax_rate:
description: Available if the relation `tax_rate` is expanded.
nullable: true
$ref: '#/components/schemas/TaxRate'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ProductType:
title: Product Type
description: >-
Product Type can be added to Products for filtering and reporting
purposes.
type: object
required:
- created_at
- deleted_at
- id
- metadata
- updated_at
- value
properties:
id:
description: The product type's ID
type: string
example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A
value:
description: The value that the Product Type represents.
type: string
example: Clothing
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ProductVariantInventoryItem:
title: Product Variant Inventory Item
description: >-
Product Variant Inventory Items link variants with inventory items and
denote the number of inventory items constituting a variant.
type: object
required:
- created_at
- deleted_at
- id
- inventory_item_id
- required_quantity
- updated_at
- variant_id
properties:
id:
description: The product variant inventory item's ID
type: string
example: pvitem_01G8X9A7ESKAJXG2H0E6F1MW7A
inventory_item_id:
description: The id of the inventory item
type: string
variant_id:
description: The id of the variant.
type: string
variant:
description: >-
A ProductVariant object. Available if the relation `variant` is
expanded.
nullable: true
$ref: '#/components/schemas/ProductVariant'
required_quantity:
description: >-
The quantity of an inventory item required for one quantity of the
variant.
type: integer
default: 1
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
ProductVariant:
title: Product Variant
description: >-
Product Variants represent a Product with a specific set of Product
Option configurations. The maximum number of Product Variants that a
Product can have is given by the number of available Product Option
combinations.
type: object
required:
- allow_backorder
- barcode
- created_at
- deleted_at
- ean
- height
- hs_code
- id
- inventory_quantity
- length
- manage_inventory
- material
- metadata
- mid_code
- origin_country
- product_id
- sku
- title
- upc
- updated_at
- weight
- width
properties:
id:
description: The product variant's ID
type: string
example: variant_01G1G5V2MRX2V3PVSR2WXYPFB6
title:
description: >-
A title that can be displayed for easy identification of the Product
Variant.
type: string
example: Small
product_id:
description: The ID of the Product that the Product Variant belongs to.
type: string
example: prod_01G1G5V2MBA328390B5AXJ610F
product:
description: A product object. Available if the relation `product` is expanded.
nullable: true
$ref: '#/components/schemas/Product'
prices:
description: >-
The Money Amounts defined for the Product Variant. Each Money Amount
represents a price in a given currency or a price in a specific
Region. Available if the relation `prices` is expanded.
type: array
items:
$ref: '#/components/schemas/MoneyAmount'
sku:
description: >-
The unique stock keeping unit used to identify the Product Variant.
This will usually be a unqiue identifer for the item that is to be
shipped, and can be referenced across multiple systems.
nullable: true
type: string
example: shirt-123
barcode:
description: >-
A generic field for a GTIN number that can be used to identify the
Product Variant.
nullable: true
type: string
example: null
ean:
description: >-
An EAN barcode number that can be used to identify the Product
Variant.
nullable: true
type: string
example: null
upc:
description: >-
A UPC barcode number that can be used to identify the Product
Variant.
nullable: true
type: string
example: null
variant_rank:
description: The ranking of this variant
nullable: true
type: number
default: 0
inventory_quantity:
description: The current quantity of the item that is stocked.
type: integer
example: 100
allow_backorder:
description: >-
Whether the Product Variant should be purchasable when
`inventory_quantity` is 0.
type: boolean
default: false
manage_inventory:
description: Whether Medusa should manage inventory for the Product Variant.
type: boolean
default: true
hs_code:
description: >-
The Harmonized System code of the Product Variant. May be used by
Fulfillment Providers to pass customs information to shipping
carriers.
nullable: true
type: string
example: null
origin_country:
description: >-
The country in which the Product Variant was produced. May be used
by Fulfillment Providers to pass customs information to shipping
carriers.
nullable: true
type: string
example: null
mid_code:
description: >-
The Manufacturers Identification code that identifies the
manufacturer of the Product Variant. May be used by Fulfillment
Providers to pass customs information to shipping carriers.
nullable: true
type: string
example: null
material:
description: >-
The material and composition that the Product Variant is made of,
May be used by Fulfillment Providers to pass customs information to
shipping carriers.
nullable: true
type: string
example: null
weight:
description: >-
The weight of the Product Variant. May be used in shipping rate
calculations.
nullable: true
type: number
example: null
length:
description: >-
The length of the Product Variant. May be used in shipping rate
calculations.
nullable: true
type: number
example: null
height:
description: >-
The height of the Product Variant. May be used in shipping rate
calculations.
nullable: true
type: number
example: null
width:
description: >-
The width of the Product Variant. May be used in shipping rate
calculations.
nullable: true
type: number
example: null
options:
description: >-
The Product Option Values specified for the Product Variant.
Available if the relation `options` is expanded.
type: array
items:
$ref: '#/components/schemas/ProductOptionValue'
inventory_items:
description: >-
The Inventory Items related to the product variant. Available if the
relation `inventory_items` is expanded.
type: array
items:
$ref: '#/components/schemas/ProductVariantInventoryItem'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
Product:
title: Product
description: >-
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.
type: object
required:
- collection_id
- created_at
- deleted_at
- description
- discountable
- external_id
- handle
- height
- hs_code
- id
- is_giftcard
- length
- material
- metadata
- mid_code
- origin_country
- profile_id
- status
- subtitle
- type_id
- thumbnail
- title
- updated_at
- weight
- width
properties:
id:
description: The product's ID
type: string
example: prod_01G1G5V2MBA328390B5AXJ610F
title:
description: >-
A title that can be displayed for easy identification of the
Product.
type: string
example: Medusa Coffee Mug
subtitle:
description: >-
An optional subtitle that can be used to further specify the
Product.
nullable: true
type: string
description:
description: A short description of the Product.
nullable: true
type: string
example: Every programmer's best friend.
handle:
description: A unique identifier for the Product (e.g. for slug structure).
nullable: true
type: string
example: coffee-mug
is_giftcard:
description: >-
Whether the Product represents a Gift Card. Products that represent
Gift Cards will automatically generate a redeemable Gift Card code
once they are purchased.
type: boolean
default: false
status:
description: The status of the product
type: string
enum:
- draft
- proposed
- published
- rejected
default: draft
images:
description: >-
Images of the Product. Available if the relation `images` is
expanded.
type: array
items:
$ref: '#/components/schemas/Image'
thumbnail:
description: A URL to an image file that can be used to identify the Product.
nullable: true
type: string
format: uri
options:
description: >-
The Product Options that are defined for the Product. Product
Variants of the Product will have a unique combination of Product
Option Values. Available if the relation `options` is expanded.
type: array
items:
$ref: '#/components/schemas/ProductOption'
variants:
description: >-
The Product Variants that belong to the Product. Each will have a
unique combination of Product Option Values. Available if the
relation `variants` is expanded.
type: array
items:
$ref: '#/components/schemas/ProductVariant'
categories:
description: >-
The product's associated categories. Available if the relation
`categories` are expanded.
type: array
items:
$ref: '#/components/schemas/ProductCategory'
profile_id:
description: >-
The ID of the Shipping Profile that the Product belongs to. Shipping
Profiles have a set of defined Shipping Options that can be used to
Fulfill a given set of Products.
type: string
example: sp_01G1G5V239ENSZ5MV4JAR737BM
profile:
description: Available if the relation `profile` is expanded.
nullable: true
$ref: '#/components/schemas/ShippingProfile'
weight:
description: >-
The weight of the Product Variant. May be used in shipping rate
calculations.
nullable: true
type: number
example: null
length:
description: >-
The length of the Product Variant. May be used in shipping rate
calculations.
nullable: true
type: number
example: null
height:
description: >-
The height of the Product Variant. May be used in shipping rate
calculations.
nullable: true
type: number
example: null
width:
description: >-
The width of the Product Variant. May be used in shipping rate
calculations.
nullable: true
type: number
example: null
hs_code:
description: >-
The Harmonized System code of the Product Variant. May be used by
Fulfillment Providers to pass customs information to shipping
carriers.
nullable: true
type: string
example: null
origin_country:
description: >-
The country in which the Product Variant was produced. May be used
by Fulfillment Providers to pass customs information to shipping
carriers.
nullable: true
type: string
example: null
mid_code:
description: >-
The Manufacturers Identification code that identifies the
manufacturer of the Product Variant. May be used by Fulfillment
Providers to pass customs information to shipping carriers.
nullable: true
type: string
example: null
material:
description: >-
The material and composition that the Product Variant is made of,
May be used by Fulfillment Providers to pass customs information to
shipping carriers.
nullable: true
type: string
example: null
collection_id:
description: The Product Collection that the Product belongs to
nullable: true
type: string
example: pcol_01F0YESBFAZ0DV6V831JXWH0BG
collection:
description: >-
A product collection object. Available if the relation `collection`
is expanded.
nullable: true
$ref: '#/components/schemas/ProductCollection'
type_id:
description: The Product type that the Product belongs to
nullable: true
type: string
example: ptyp_01G8X9A7ESKAJXG2H0E6F1MW7A
type:
description: Available if the relation `type` is expanded.
nullable: true
$ref: '#/components/schemas/ProductType'
tags:
description: >-
The Product Tags assigned to the Product. Available if the relation
`tags` is expanded.
type: array
items:
$ref: '#/components/schemas/ProductTag'
discountable:
description: >-
Whether the Product can be discounted. Discounts will not apply to
Line Items of this Product when this flag is set to `false`.
type: boolean
default: true
external_id:
description: The external ID of the product
nullable: true
type: string
example: null
sales_channels:
description: >-
The sales channels the product is associated with. Available if the
relation `sales_channels` is expanded.
type: array
items:
$ref: '#/components/schemas/SalesChannel'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
PublishableApiKeySalesChannel:
title: Publishable API key sales channel
description: Holds mapping between Publishable API keys and Sales Channels
type: object
required:
- publishable_key_id
- sales_channel_id
properties:
sales_channel_id:
description: The sales channel's ID
type: string
example: sc_01G1G5V21KADXNGH29BJMAJ4B4
publishable_key_id:
description: The publishable API key's ID
type: string
example: pak_01G1G5V21KADXNGH29BJMAJ4B4
PublishableApiKey:
title: Publishable API key
description: >-
Publishable API key defines scopes (i.e. resources) that are available
within a request.
type: object
required:
- created_at
- created_by
- id
- revoked_by
- revoked_at
- title
- updated_at
properties:
id:
description: The key's ID
type: string
example: pk_01G1G5V27GYX4QXNARRQCW1N8T
created_by:
description: The unique identifier of the user that created the key.
nullable: true
type: string
example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
revoked_by:
description: The unique identifier of the user that revoked the key.
nullable: true
type: string
example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
revoked_at:
description: The date with timezone at which the key was revoked.
nullable: true
type: string
format: date-time
title:
description: The key's title.
type: string
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
Refund:
title: Refund
description: >-
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.
type: object
required:
- amount
- created_at
- id
- idempotency_key
- metadata
- note
- order_id
- payment_id
- reason
- updated_at
properties:
id:
description: The refund's ID
type: string
example: ref_01G1G5V27GYX4QXNARRQCW1N8T
order_id:
description: The id of the Order that the Refund is related to.
nullable: true
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
description: An order object. Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
payment_id:
description: The payment's ID if available
nullable: true
type: string
example: pay_01G8ZCC5W42ZNY842124G7P5R9
payment:
description: Available if the relation `payment` is expanded.
nullable: true
$ref: '#/components/schemas/Payment'
amount:
description: The amount that has be refunded to the Customer.
type: integer
example: 1000
note:
description: An optional note explaining why the amount was refunded.
nullable: true
type: string
example: I didn't like it
reason:
description: >-
The reason given for the Refund, will automatically be set when
processed as part of a Swap, Claim or Return.
type: string
enum:
- discount
- return
- swap
- claim
- other
example: return
idempotency_key:
description: >-
Randomly generated key used to continue the completion of the refund
in case of failure.
nullable: true
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
Region:
title: Region
description: >-
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.
type: object
required:
- automatic_taxes
- created_at
- currency_code
- deleted_at
- gift_cards_taxable
- id
- metadata
- name
- tax_code
- tax_provider_id
- tax_rate
- updated_at
properties:
id:
description: The region's ID
type: string
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
name:
description: >-
The name of the region as displayed to the customer. If the Region
only has one country it is recommended to write the country name.
type: string
example: EU
currency_code:
description: The 3 character currency code that the Region uses.
type: string
example: usd
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
currency:
description: Available if the relation `currency` is expanded.
nullable: true
$ref: '#/components/schemas/Currency'
tax_rate:
description: The tax rate that should be charged on purchases in the Region.
type: number
example: 0
tax_rates:
description: >-
The tax rates that are included in the Region. Available if the
relation `tax_rates` is expanded.
type: array
items:
$ref: '#/components/schemas/TaxRate'
tax_code:
description: >-
The tax code used on purchases in the Region. This may be used by
other systems for accounting purposes.
nullable: true
type: string
example: null
gift_cards_taxable:
description: Whether the gift cards are taxable or not in this region.
type: boolean
default: true
automatic_taxes:
description: Whether taxes should be automated in this region.
type: boolean
default: true
countries:
description: >-
The countries that are included in the Region. Available if the
relation `countries` is expanded.
type: array
items:
$ref: '#/components/schemas/Country'
tax_provider_id:
description: The ID of the tax provider used in this region
nullable: true
type: string
example: null
tax_provider:
description: Available if the relation `tax_provider` is expanded.
nullable: true
$ref: '#/components/schemas/TaxProvider'
payment_providers:
description: >-
The Payment Providers that can be used to process Payments in the
Region. Available if the relation `payment_providers` is expanded.
type: array
items:
$ref: '#/components/schemas/PaymentProvider'
fulfillment_providers:
description: >-
The Fulfillment Providers that can be used to fulfill orders in the
Region. Available if the relation `fulfillment_providers` is
expanded.
type: array
items:
$ref: '#/components/schemas/FulfillmentProvider'
includes_tax:
description: '[EXPERIMENTAL] Does the prices for the region include tax'
type: boolean
default: false
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ReturnItem:
title: Return Item
description: >-
Correlates a Line Item with a Return, keeping track of the quantity of
the Line Item that will be returned.
type: object
required:
- is_requested
- item_id
- metadata
- note
- quantity
- reason_id
- received_quantity
- requested_quantity
- return_id
properties:
return_id:
description: The id of the Return that the Return Item belongs to.
type: string
example: ret_01F0YET7XPCMF8RZ0Y151NZV2V
item_id:
description: The id of the Line Item that the Return Item references.
type: string
example: item_01G8ZC9GWT6B2GP5FSXRXNFNGN
return_order:
description: Available if the relation `return_order` is expanded.
nullable: true
$ref: '#/components/schemas/Return'
item:
description: Available if the relation `item` is expanded.
nullable: true
$ref: '#/components/schemas/LineItem'
quantity:
description: The quantity of the Line Item that is included in the Return.
type: integer
example: 1
is_requested:
description: >-
Whether the Return Item was requested initially or received
unexpectedly in the warehouse.
type: boolean
default: true
requested_quantity:
description: The quantity that was originally requested to be returned.
nullable: true
type: integer
example: 1
received_quantity:
description: The quantity that was received in the warehouse.
nullable: true
type: integer
example: 1
reason_id:
description: The ID of the reason for returning the item.
nullable: true
type: string
example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ
reason:
description: Available if the relation `reason` is expanded.
nullable: true
$ref: '#/components/schemas/ReturnReason'
note:
description: An optional note with additional details about the Return.
nullable: true
type: string
example: I didn't like it.
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ReturnReason:
title: Return Reason
description: >-
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.
type: object
required:
- created_at
- deleted_at
- description
- id
- label
- metadata
- parent_return_reason_id
- updated_at
- value
properties:
id:
description: The return reason's ID
type: string
example: rr_01G8X82GCCV2KSQHDBHSSAH5TQ
value:
description: The value to identify the reason by.
type: string
example: damaged
label:
description: A text that can be displayed to the Customer as a reason.
type: string
example: Damaged goods
description:
description: A description of the Reason.
nullable: true
type: string
example: Items that are damaged
parent_return_reason_id:
description: The ID of the parent reason.
nullable: true
type: string
example: null
parent_return_reason:
description: Available if the relation `parent_return_reason` is expanded.
nullable: true
$ref: '#/components/schemas/ReturnReason'
return_reason_children:
description: Available if the relation `return_reason_children` is expanded.
$ref: '#/components/schemas/ReturnReason'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
Return:
title: Return
description: >-
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.
type: object
required:
- claim_order_id
- created_at
- id
- idempotency_key
- location_id
- metadata
- no_notification
- order_id
- received_at
- refund_amount
- shipping_data
- status
- swap_id
- updated_at
properties:
id:
description: The return's ID
type: string
example: ret_01F0YET7XPCMF8RZ0Y151NZV2V
status:
description: Status of the Return.
type: string
enum:
- requested
- received
- requires_action
- canceled
default: requested
items:
description: >-
The Return Items that will be shipped back to the warehouse.
Available if the relation `items` is expanded.
type: array
items:
$ref: '#/components/schemas/ReturnItem'
swap_id:
description: The ID of the Swap that the Return is a part of.
nullable: true
type: string
example: null
swap:
description: A swap object. Available if the relation `swap` is expanded.
nullable: true
$ref: '#/components/schemas/Swap'
claim_order_id:
description: The ID of the Claim that the Return is a part of.
nullable: true
type: string
example: null
claim_order:
description: >-
A claim order object. Available if the relation `claim_order` is
expanded.
nullable: true
$ref: '#/components/schemas/ClaimOrder'
order_id:
description: The ID of the Order that the Return is made from.
nullable: true
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
description: An order object. Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
shipping_method:
description: >-
The Shipping Method that will be used to send the Return back. Can
be null if the Customer facilitates the return shipment themselves.
Available if the relation `shipping_method` is expanded.
nullable: true
$ref: '#/components/schemas/ShippingMethod'
shipping_data:
description: >-
Data about the return shipment as provided by the Fulfilment
Provider that handles the return shipment.
nullable: true
type: object
example: {}
location_id:
description: The id of the stock location the return will be added back.
nullable: true
type: string
example: sloc_01G8TJSYT9M6AVS5N4EMNFS1EK
refund_amount:
description: The amount that should be refunded as a result of the return.
type: integer
example: 1000
no_notification:
description: >-
When set to true, no notification will be sent related to this
return.
nullable: true
type: boolean
example: false
idempotency_key:
description: >-
Randomly generated key used to continue the completion of the return
in case of failure.
nullable: true
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
received_at:
description: The date with timezone at which the return was received.
nullable: true
type: string
format: date-time
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
SalesChannelLocation:
title: Sales Channel Stock Location
description: Sales Channel Stock Location link sales channels with stock locations.
type: object
required:
- created_at
- deleted_at
- id
- location_id
- sales_channel_id
- updated_at
properties:
id:
description: The Sales Channel Stock Location's ID
type: string
example: scloc_01G8X9A7ESKAJXG2H0E6F1MW7A
sales_channel_id:
description: The id of the Sales Channel
type: string
example: sc_01G8X9A7ESKAJXG2H0E6F1MW7A
location_id:
description: The id of the Location Stock.
type: string
sales_channel:
description: >-
The sales channel the location is associated with. Available if the
relation `sales_channel` is expanded.
nullable: true
$ref: '#/components/schemas/SalesChannel'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
SalesChannel:
title: Sales Channel
description: A Sales Channel
type: object
required:
- created_at
- deleted_at
- description
- id
- is_disabled
- name
- updated_at
properties:
id:
description: The sales channel's ID
type: string
example: sc_01G8X9A7ESKAJXG2H0E6F1MW7A
name:
description: The name of the sales channel.
type: string
example: Market
description:
description: The description of the sales channel.
nullable: true
type: string
example: Multi-vendor market
is_disabled:
description: Specify if the sales channel is enabled or disabled.
type: boolean
default: false
locations:
description: >-
The Stock Locations related to the sales channel. Available if the
relation `locations` is expanded.
type: array
items:
$ref: '#/components/schemas/SalesChannelLocation'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
ShippingMethodTaxLine:
title: Shipping Method Tax Line
description: Shipping Method Tax Line
type: object
required:
- code
- created_at
- id
- shipping_method_id
- metadata
- name
- rate
- updated_at
properties:
id:
description: The line item tax line's ID
type: string
example: smtl_01G1G5V2DRX1SK6NQQ8VVX4HQ8
code:
description: A code to identify the tax type by
nullable: true
type: string
example: tax01
name:
description: A human friendly name for the tax
type: string
example: Tax Example
rate:
description: The numeric rate to charge tax by
type: number
example: 10
shipping_method_id:
description: The ID of the line item
type: string
example: sm_01F0YET7DR2E7CYVSDHM593QG2
shipping_method:
description: Available if the relation `shipping_method` is expanded.
nullable: true
$ref: '#/components/schemas/ShippingMethod'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ShippingMethod:
title: Shipping Method
description: >-
Shipping Methods represent a way in which an Order or Return can be
shipped. Shipping Methods are built from a Shipping Option, but may
contain additional details, that can be necessary for the Fulfillment
Provider to handle the shipment.
type: object
required:
- cart_id
- claim_order_id
- data
- id
- order_id
- price
- return_id
- shipping_option_id
- swap_id
properties:
id:
description: The shipping method's ID
type: string
example: sm_01F0YET7DR2E7CYVSDHM593QG2
shipping_option_id:
description: >-
The id of the Shipping Option that the Shipping Method is built
from.
type: string
example: so_01G1G5V27GYX4QXNARRQCW1N8T
order_id:
description: The id of the Order that the Shipping Method is used on.
nullable: true
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
description: An order object. Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
claim_order_id:
description: The id of the Claim that the Shipping Method is used on.
nullable: true
type: string
example: null
claim_order:
description: >-
A claim order object. Available if the relation `claim_order` is
expanded.
nullable: true
$ref: '#/components/schemas/ClaimOrder'
cart_id:
description: The id of the Cart that the Shipping Method is used on.
nullable: true
type: string
example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
description: A cart object. Available if the relation `cart` is expanded.
nullable: true
$ref: '#/components/schemas/Cart'
swap_id:
description: The id of the Swap that the Shipping Method is used on.
nullable: true
type: string
example: null
swap:
description: A swap object. Available if the relation `swap` is expanded.
nullable: true
$ref: '#/components/schemas/Swap'
return_id:
description: The id of the Return that the Shipping Method is used on.
nullable: true
type: string
example: null
return_order:
description: >-
A return object. Available if the relation `return_order` is
expanded.
nullable: true
$ref: '#/components/schemas/Return'
shipping_option:
description: Available if the relation `shipping_option` is expanded.
nullable: true
$ref: '#/components/schemas/ShippingOption'
tax_lines:
description: Available if the relation `tax_lines` is expanded.
type: array
items:
$ref: '#/components/schemas/ShippingMethodTaxLine'
price:
description: >-
The amount to charge for the Shipping Method. The currency of the
price is defined by the Region that the Order that the Shipping
Method belongs to is a part of.
type: integer
example: 200
data:
description: >-
Additional data that the Fulfillment Provider needs to fulfill the
shipment. This is used in combination with the Shipping Options
data, and may contain information such as a drop point id.
type: object
example: {}
includes_tax:
description: '[EXPERIMENTAL] Indicates if the shipping method price include tax'
type: boolean
default: false
subtotal:
description: The subtotal of the shipping
type: integer
example: 8000
total:
description: The total amount of the shipping
type: integer
example: 8200
tax_total:
description: The total of tax
type: integer
example: 0
ShippingOptionRequirement:
title: Shipping Option Requirement
description: >-
A requirement that a Cart must satisfy for the Shipping Option to be
available to the Cart.
type: object
required:
- amount
- deleted_at
- id
- shipping_option_id
- type
properties:
id:
description: The shipping option requirement's ID
type: string
example: sor_01G1G5V29AB4CTNDRFSRWSRKWD
shipping_option_id:
description: >-
The id of the Shipping Option that the hipping option requirement
belongs to
type: string
example: so_01G1G5V27GYX4QXNARRQCW1N8T
shipping_option:
description: Available if the relation `shipping_option` is expanded.
nullable: true
$ref: '#/components/schemas/ShippingOption'
type:
description: >-
The type of the requirement, this defines how the value will be
compared to the Cart's total. `min_subtotal` requirements define the
minimum subtotal that is needed for the Shipping Option to be
available, while the `max_subtotal` defines the maximum subtotal
that the Cart can have for the Shipping Option to be available.
type: string
enum:
- min_subtotal
- max_subtotal
example: min_subtotal
amount:
description: The amount to compare the Cart subtotal to.
type: integer
example: 100
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
ShippingOption:
title: Shipping Option
description: >-
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.
type: object
required:
- admin_only
- amount
- created_at
- data
- deleted_at
- id
- is_return
- metadata
- name
- price_type
- profile_id
- provider_id
- region_id
- updated_at
properties:
id:
description: The shipping option's ID
type: string
example: so_01G1G5V27GYX4QXNARRQCW1N8T
name:
description: >-
The name given to the Shipping Option - this may be displayed to the
Customer.
type: string
example: PostFake Standard
region_id:
description: The region's ID
type: string
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: A region object. Available if the relation `region` is expanded.
nullable: true
$ref: '#/components/schemas/Region'
profile_id:
description: >-
The ID of the Shipping Profile that the shipping option belongs to.
Shipping Profiles have a set of defined Shipping Options that can be
used to Fulfill a given set of Products.
type: string
example: sp_01G1G5V239ENSZ5MV4JAR737BM
profile:
description: Available if the relation `profile` is expanded.
nullable: true
$ref: '#/components/schemas/ShippingProfile'
provider_id:
description: >-
The id of the Fulfillment Provider, that will be used to process
Fulfillments from the Shipping Option.
type: string
example: manual
provider:
description: Available if the relation `provider` is expanded.
nullable: true
$ref: '#/components/schemas/FulfillmentProvider'
price_type:
description: >-
The type of pricing calculation that is used when creatin Shipping
Methods from the Shipping Option. Can be `flat_rate` for fixed
prices or `calculated` if the Fulfillment Provider can provide price
calulations.
type: string
enum:
- flat_rate
- calculated
example: flat_rate
amount:
description: >-
The amount to charge for shipping when the Shipping Option price
type is `flat_rate`.
nullable: true
type: integer
example: 200
is_return:
description: >-
Flag to indicate if the Shipping Option can be used for Return
shipments.
type: boolean
default: false
admin_only:
description: >-
Flag to indicate if the Shipping Option usage is restricted to admin
users.
type: boolean
default: false
requirements:
description: >-
The requirements that must be satisfied for the Shipping Option to
be available for a Cart. Available if the relation `requirements` is
expanded.
type: array
items:
$ref: '#/components/schemas/ShippingOptionRequirement'
data:
description: >-
The data needed for the Fulfillment Provider to identify the
Shipping Option.
type: object
example: {}
includes_tax:
description: '[EXPERIMENTAL] Does the shipping option price include tax'
type: boolean
default: false
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ShippingProfile:
title: Shipping Profile
description: >-
Shipping Profiles have a set of defined Shipping Options that can be
used to fulfill a given set of Products.
type: object
required:
- created_at
- deleted_at
- id
- metadata
- name
- type
- updated_at
properties:
id:
description: The shipping profile's ID
type: string
example: sp_01G1G5V239ENSZ5MV4JAR737BM
name:
description: >-
The name given to the Shipping profile - this may be displayed to
the Customer.
type: string
example: Default Shipping Profile
type:
description: >-
The type of the Shipping Profile, may be `default`, `gift_card` or
`custom`.
type: string
enum:
- default
- gift_card
- custom
example: default
products:
description: >-
The Products that the Shipping Profile defines Shipping Options for.
Available if the relation `products` is expanded.
type: array
items:
$ref: '#/components/schemas/Product'
shipping_options:
description: >-
The Shipping Options that can be used to fulfill the Products in the
Shipping Profile. Available if the relation `shipping_options` is
expanded.
type: array
items:
$ref: '#/components/schemas/ShippingOption'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
ShippingTaxRate:
title: Shipping Tax Rate
description: >-
Associates a tax rate with a shipping option to indicate that the
shipping option is taxed in a certain way
type: object
required:
- created_at
- metadata
- rate_id
- shipping_option_id
- updated_at
properties:
shipping_option_id:
description: The ID of the Shipping Option
type: string
example: so_01G1G5V27GYX4QXNARRQCW1N8T
shipping_option:
description: Available if the relation `shipping_option` is expanded.
nullable: true
$ref: '#/components/schemas/ShippingOption'
rate_id:
description: The ID of the Tax Rate
type: string
example: txr_01G8XDBAWKBHHJRKH0AV02KXBR
tax_rate:
description: Available if the relation `tax_rate` is expanded.
nullable: true
$ref: '#/components/schemas/TaxRate'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
StagedJob:
title: Staged Job
description: A staged job resource
type: object
required:
- data
- event_name
- id
- options
properties:
id:
description: The staged job's ID
type: string
example: job_01F0YET7BZTARY9MKN1SJ7AAXF
event_name:
description: The name of the event
type: string
example: order.placed
data:
description: Data necessary for the job
type: object
example: {}
option:
description: The staged job's option
type: object
example: {}
Store:
title: Store
description: 'Holds settings for the Store, such as name, currencies, etc.'
type: object
required:
- created_at
- default_currency_code
- default_location_id
- id
- invite_link_template
- metadata
- name
- payment_link_template
- swap_link_template
- updated_at
properties:
id:
description: The store's ID
type: string
example: store_01G1G5V21KADXNGH29BJMAJ4B4
name:
description: The name of the Store - this may be displayed to the Customer.
type: string
example: Medusa Store
default_currency_code:
description: The 3 character currency code that is the default of the store.
type: string
example: usd
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
default_currency:
description: Available if the relation `default_currency` is expanded.
nullable: true
$ref: '#/components/schemas/Currency'
currencies:
description: >-
The currencies that are enabled for the Store. Available if the
relation `currencies` is expanded.
type: array
items:
$ref: '#/components/schemas/Currency'
swap_link_template:
description: >-
A template to generate Swap links from. Use {{cart_id}} to include
the Swap's `cart_id` in the link.
nullable: true
type: string
example: null
payment_link_template:
description: >-
A template to generate Payment links from. Use {{cart_id}} to
include the payment's `cart_id` in the link.
nullable: true
type: string
example: null
invite_link_template:
description: A template to generate Invite links from
nullable: true
type: string
example: null
default_location_id:
description: The location ID the store is associated with.
nullable: true
type: string
example: null
default_sales_channel_id:
description: The sales channel ID the cart is associated with.
nullable: true
type: string
example: null
default_sales_channel:
description: >-
A sales channel object. Available if the relation
`default_sales_channel` is expanded.
nullable: true
$ref: '#/components/schemas/SalesChannel'
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
Swap:
title: Swap
description: >-
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.
type: object
required:
- allow_backorder
- canceled_at
- cart_id
- confirmed_at
- created_at
- deleted_at
- difference_due
- fulfillment_status
- id
- idempotency_key
- metadata
- no_notification
- order_id
- payment_status
- shipping_address_id
- updated_at
properties:
id:
description: The swap's ID
type: string
example: swap_01F0YET86Y9G92D3YDR9Y6V676
fulfillment_status:
description: The status of the Fulfillment of the Swap.
type: string
enum:
- not_fulfilled
- fulfilled
- shipped
- partially_shipped
- canceled
- requires_action
example: not_fulfilled
payment_status:
description: >-
The status of the Payment of the Swap. The payment may either refer
to the refund of an amount or the authorization of a new amount.
type: string
enum:
- not_paid
- awaiting
- captured
- confirmed
- canceled
- difference_refunded
- partially_refunded
- refunded
- requires_action
example: not_paid
order_id:
description: >-
The ID of the Order where the Line Items to be returned where
purchased.
type: string
example: order_01G8TJSYT9M6AVS5N4EMNFS1EK
order:
description: An order object. Available if the relation `order` is expanded.
nullable: true
$ref: '#/components/schemas/Order'
additional_items:
description: >-
The new Line Items to ship to the Customer. Available if the
relation `additional_items` is expanded.
type: array
items:
$ref: '#/components/schemas/LineItem'
return_order:
description: >-
A return order object. The Return that is issued for the return part
of the Swap. Available if the relation `return_order` is expanded.
nullable: true
$ref: '#/components/schemas/Return'
fulfillments:
description: >-
The Fulfillments used to send the new Line Items. Available if the
relation `fulfillments` is expanded.
type: array
items:
$ref: '#/components/schemas/Fulfillment'
payment:
description: >-
The Payment authorized when the Swap requires an additional amount
to be charged from the Customer. Available if the relation `payment`
is expanded.
nullable: true
$ref: '#/components/schemas/Payment'
difference_due:
description: >-
The difference that is paid or refunded as a result of the Swap. May
be negative when the amount paid for the returned items exceed the
total of the new Products.
nullable: true
type: integer
example: 0
shipping_address_id:
description: >-
The Address to send the new Line Items to - in most cases this will
be the same as the shipping address on the Order.
nullable: true
type: string
example: addr_01G8ZH853YPY9B94857DY91YGW
shipping_address:
description: Available if the relation `shipping_address` is expanded.
nullable: true
$ref: '#/components/schemas/Address'
shipping_methods:
description: >-
The Shipping Methods used to fulfill the additional items purchased.
Available if the relation `shipping_methods` is expanded.
type: array
items:
$ref: '#/components/schemas/ShippingMethod'
cart_id:
description: The id of the Cart that the Customer will use to confirm the Swap.
nullable: true
type: string
example: cart_01G8ZH853Y6TFXWPG5EYE81X63
cart:
description: A cart object. Available if the relation `cart` is expanded.
nullable: true
$ref: '#/components/schemas/Cart'
confirmed_at:
description: >-
The date with timezone at which the Swap was confirmed by the
Customer.
nullable: true
type: string
format: date-time
canceled_at:
description: The date with timezone at which the Swap was canceled.
nullable: true
type: string
format: date-time
no_notification:
description: 'If set to true, no notification will be sent related to this swap'
nullable: true
type: boolean
example: false
allow_backorder:
description: 'If true, swaps can be completed with items out of stock'
type: boolean
default: false
idempotency_key:
description: >-
Randomly generated key used to continue the completion of the swap
in case of failure.
nullable: true
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
TaxLine:
title: Tax Line
description: Line item that specifies an amount of tax to add to a line item.
type: object
required:
- code
- created_at
- id
- metadata
- name
- rate
- updated_at
properties:
id:
description: The tax line's ID
type: string
example: tl_01G1G5V2DRX1SK6NQQ8VVX4HQ8
code:
description: A code to identify the tax type by
nullable: true
type: string
example: tax01
name:
description: A human friendly name for the tax
type: string
example: Tax Example
rate:
description: The numeric rate to charge tax by
type: number
example: 10
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
TaxProvider:
title: Tax Provider
description: The tax service used to calculate taxes
type: object
required:
- id
- is_installed
properties:
id:
description: The id of the tax provider as given by the plugin.
type: string
example: manual
is_installed:
description: >-
Whether the plugin is installed in the current version. Plugins that
are no longer installed are not deleted by will have this field set
to `false`.
type: boolean
default: true
TaxRate:
title: Tax Rate
description: >-
A Tax Rate can be used to associate a certain rate to charge on products
within a given Region
type: object
required:
- code
- created_at
- id
- metadata
- name
- rate
- region_id
- updated_at
properties:
id:
description: The tax rate's ID
type: string
example: txr_01G8XDBAWKBHHJRKH0AV02KXBR
rate:
description: The numeric rate to charge
nullable: true
type: number
example: 10
code:
description: A code to identify the tax type by
nullable: true
type: string
example: tax01
name:
description: A human friendly name for the tax
type: string
example: Tax Example
region_id:
description: The id of the Region that the rate belongs to
type: string
example: reg_01G1G5V26T9H8Y0M4JNE3YGA4G
region:
description: A region object. Available if the relation `region` is expanded.
nullable: true
$ref: '#/components/schemas/Region'
products:
description: >-
The products that belong to this tax rate. Available if the relation
`products` is expanded.
type: array
items:
$ref: '#/components/schemas/Product'
product_types:
description: >-
The product types that belong to this tax rate. Available if the
relation `product_types` is expanded.
type: array
items:
$ref: '#/components/schemas/ProductType'
shipping_options:
type: array
description: >-
The shipping options that belong to this tax rate. Available if the
relation `shipping_options` is expanded.
items:
$ref: '#/components/schemas/ShippingOption'
product_count:
description: The count of products
type: integer
example: 10
product_type_count:
description: The count of product types
type: integer
example: 2
shipping_option_count:
description: The count of shipping options
type: integer
example: 1
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
TrackingLink:
title: Tracking Link
description: >-
Tracking Link holds information about tracking numbers for a
Fulfillment. Tracking Links can optionally contain a URL that can be
visited to see the status of the shipment.
type: object
required:
- created_at
- deleted_at
- fulfillment_id
- id
- idempotency_key
- metadata
- tracking_number
- updated_at
- url
properties:
id:
description: The tracking link's ID
type: string
example: tlink_01G8ZH853Y6TFXWPG5EYE81X63
url:
description: The URL at which the status of the shipment can be tracked.
nullable: true
type: string
format: uri
tracking_number:
description: The tracking number given by the shipping carrier.
type: string
format: RH370168054CN
fulfillment_id:
description: The id of the Fulfillment that the Tracking Link references.
type: string
example: ful_01G8ZRTMQCA76TXNAT81KPJZRF
fulfillment:
description: Available if the relation `fulfillment` is expanded.
nullable: true
$ref: '#/components/schemas/Fulfillment'
idempotency_key:
description: >-
Randomly generated key used to continue the completion of a process
in case of failure.
nullable: true
type: string
externalDocs:
url: >-
https://docs.medusajs.com/advanced/backend/payment/overview#idempotency-key
description: Learn more how to use the idempotency key.
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
User:
title: User
description: Represents a User who can manage store settings.
type: object
required:
- api_token
- created_at
- deleted_at
- email
- first_name
- id
- last_name
- metadata
- role
- updated_at
properties:
id:
description: The user's ID
type: string
example: usr_01G1G5V26F5TB3GPAPNJ8X1S3V
role:
description: The user's role
type: string
enum:
- admin
- member
- developer
default: member
email:
description: The email of the User
type: string
format: email
first_name:
description: The first name of the User
nullable: true
type: string
example: Levi
last_name:
description: The last name of the User
nullable: true
type: string
example: Bogan
api_token:
description: An API token associated with the user.
nullable: true
type: string
example: null
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
nullable: true
type: string
format: date-time
metadata:
description: An optional key-value map with additional details
nullable: true
type: object
example:
car: white
InventoryItemDTO:
type: object
required:
- sku
properties:
sku:
description: The Stock Keeping Unit (SKU) code of the Inventory Item.
type: string
hs_code:
description: >-
The Harmonized System code of the Inventory Item. May be used by
Fulfillment Providers to pass customs information to shipping
carriers.
type: string
origin_country:
description: >-
The country in which the Inventory Item was produced. May be used by
Fulfillment Providers to pass customs information to shipping
carriers.
type: string
mid_code:
description: >-
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.
type: string
material:
description: >-
The material and composition that the Inventory Item is made of, May
be used by Fulfillment Providers to pass customs information to
shipping carriers.
type: string
weight:
description: >-
The weight of the Inventory Item. May be used in shipping rate
calculations.
type: number
height:
description: >-
The height of the Inventory Item. May be used in shipping rate
calculations.
type: number
width:
description: >-
The width of the Inventory Item. May be used in shipping rate
calculations.
type: number
length:
description: >-
The length of the Inventory Item. May be used in shipping rate
calculations.
type: number
requires_shipping:
description: Whether the item requires shipping.
type: boolean
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
ReservationItemDTO:
title: Reservation item
description: Represents a reservation of an inventory item at a stock location
type: object
required:
- id
- location_id
- inventory_item_id
- quantity
properties:
id:
description: The id of the reservation item
type: string
location_id:
description: The id of the location of the reservation
type: string
inventory_item_id:
description: The id of the inventory item the reservation relates to
type: string
quantity:
description: The id of the reservation item
type: number
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
InventoryLevelDTO:
type: object
required:
- inventory_item_id
- location_id
- stocked_quantity
- reserved_quantity
- incoming_quantity
properties:
location_id:
description: the item location ID
type: string
stocked_quantity:
description: >-
the total stock quantity of an inventory item at the given location
ID
type: number
reserved_quantity:
description: >-
the reserved stock quantity of an inventory item at the given
location ID
type: number
incoming_quantity:
description: >-
the incoming stock quantity of an inventory item at the given
location ID
type: number
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
PricedVariant:
title: Priced Product Variant
type: object
allOf:
- $ref: '#/components/schemas/ProductVariant'
- type: object
properties:
original_price:
type: number
description: >-
The original price of the variant without any discounted prices
applied.
calculated_price:
type: number
description: The calculated price of the variant. Can be a discounted price.
original_price_incl_tax:
type: number
description: The original price of the variant including taxes.
calculated_price_incl_tax:
type: number
description: The calculated price of the variant including taxes.
original_tax:
type: number
description: The taxes applied on the original price.
calculated_tax:
type: number
description: The taxes applied on the calculated price.
tax_rates:
type: array
description: An array of applied tax rates
items:
type: object
properties:
rate:
type: number
description: The tax rate value
name:
type: string
description: The name of the tax rate
code:
type: string
description: The code of the tax rate
PricedProduct:
title: Priced Product
type: object
allOf:
- $ref: '#/components/schemas/Product'
- type: object
properties:
variants:
type: array
items:
$ref: '#/components/schemas/PricedVariant'
StockLocationAddressDTO:
title: Stock Location Address
description: Represents a Stock Location Address
type: object
required:
- address_1
- country_code
- created_at
- updated_at
properties:
id:
type: string
description: The stock location address' ID
example: laddr_51G4ZW853Y6TFXWPG5ENJ81X42
address_1:
type: string
description: Stock location address
example: '35, Jhon Doe Ave'
address_2:
type: string
description: Stock location address' complement
example: apartment 4432
company:
type: string
description: Stock location company' name
example: Medusa
city:
type: string
description: Stock location address' city
example: Mexico city
country_code:
type: string
description: Stock location address' country
example: MX
phone:
type: string
description: Stock location address' phone number
example: +1 555 61646
postal_code:
type: string
description: Stock location address' postal code
example: HD3-1G8
province:
type: string
description: Stock location address' province
example: Sinaloa
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
StockLocationDTO:
title: Stock Location
description: Represents a Stock Location
type: object
required:
- id
- name
- address_id
- created_at
- updated_at
properties:
id:
type: string
description: The stock location's ID
example: sloc_51G4ZW853Y6TFXWPG5ENJ81X42
address_id:
type: string
description: Stock location address' ID
example: laddr_05B2ZE853Y6FTXWPW85NJ81A44
name:
type: string
description: The name of the stock location
example: Main Warehouse
address:
description: The Address of the Stock Location
allOf:
- $ref: '#/components/schemas/StockLocationAddressDTO'
- type: object
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
created_at:
type: string
description: The date with timezone at which the resource was created.
format: date-time
updated_at:
type: string
description: The date with timezone at which the resource was updated.
format: date-time
deleted_at:
type: string
description: The date with timezone at which the resource was deleted.
format: date-time
StockLocationAddressInput:
title: Stock Location Address Input
description: Represents a Stock Location Address Input
type: object
required:
- address_1
- country_code
properties:
address_1:
type: string
description: Stock location address
example: '35, Jhon Doe Ave'
address_2:
type: string
description: Stock location address' complement
example: apartment 4432
city:
type: string
description: Stock location address' city
example: Mexico city
country_code:
type: string
description: Stock location address' country
example: MX
phone:
type: string
description: Stock location address' phone number
example: +1 555 61646
postal_code:
type: string
description: Stock location address' postal code
example: HD3-1G8
province:
type: string
description: Stock location address' province
example: Sinaloa
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
CreateStockLocationInput:
title: Create Stock Location Input
description: Represents the Input to create a Stock Location
type: object
required:
- name
properties:
name:
type: string
description: The stock location name
address_id:
type: string
description: The Stock location address ID
address:
description: Stock location address object
allOf:
- $ref: '#/components/schemas/StockLocationAddressInput'
- type: object
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
UpdateStockLocationInput:
title: Update Stock Location Input
description: Represents the Input to update a Stock Location
type: object
properties:
name:
type: string
description: The stock location name
address_id:
type: string
description: The Stock location address ID
address:
description: Stock location address object
allOf:
- $ref: '#/components/schemas/StockLocationAddressInput'
- type: object
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
MultipleErrors:
title: Multiple Errors
type: object
properties:
errors:
type: array
description: Array of errors
items:
$ref: '#/components/schemas/Error'
message:
type: string
default: >-
Provided request body contains errors. Please check the data and
retry the request
Error:
title: Response Error
type: object
properties:
code:
type: string
description: A slug code to indicate the type of the error.
message:
type: string
description: Description of the error that occurred.
type:
type: string
description: A slug indicating the type of the error.
AdminPostAppsReq:
type: object
required:
- application_name
- state
- code
properties:
application_name:
type: string
description: Name of the application for the token to be generated for.
state:
type: string
description: State of the application.
code:
type: string
description: The code for the generated token.
AdminAppsRes:
type: object
properties:
apps:
$ref: '#/components/schemas/OAuth'
AdminAppsListRes:
type: object
properties:
apps:
type: array
items:
$ref: '#/components/schemas/OAuth'
AdminPostAuthReq:
type: object
required:
- email
- password
properties:
email:
type: string
description: The User's email.
format: email
password:
type: string
description: The User's password.
format: password
AdminAuthRes:
type: object
properties:
user:
$ref: '#/components/schemas/User'
AdminPostBatchesReq:
type: object
required:
- type
- context
properties:
type:
type: string
description: The type of batch job to start.
example: product-export
context:
type: object
description: >-
Additional infomration regarding the batch to be used for
processing.
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
dry_run:
type: boolean
description: >-
Set a batch job in dry_run mode to get some information on what will
be done without applying any modifications.
default: false
AdminBatchJobRes:
type: object
properties:
batch_job:
$ref: '#/components/schemas/BatchJob'
AdminBatchJobListRes:
type: object
properties:
batch_jobs:
type: array
items:
$ref: '#/components/schemas/BatchJob'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostProductsToCollectionReq:
type: object
required:
- product_ids
properties:
product_ids:
description: An array of Product IDs to add to the Product Collection.
type: array
items:
description: The ID of a Product to add to the Product Collection.
type: string
AdminPostCollectionsReq:
type: object
required:
- title
properties:
title:
type: string
description: The title to identify the Collection by.
handle:
type: string
description: >-
An optional handle to be used in slugs, if none is provided we will
kebab-case the title.
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminCollectionsListRes:
type: object
properties:
collections:
type: array
items:
$ref: '#/components/schemas/ProductCollection'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminCollectionsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Collection
object:
type: string
description: The type of the object that was deleted.
default: product-collection
deleted:
type: boolean
description: Whether the collection was deleted successfully or not.
default: true
AdminDeleteProductsFromCollectionRes:
type: object
properties:
id:
type: string
description: The ID of the collection
object:
type: string
description: The type of object the removal was executed on
default: product-collection
removed_products:
description: The IDs of the products removed from the collection
type: array
items:
description: The ID of a Product to add to the Product Collection.
type: string
AdminCollectionsRes:
type: object
properties:
collection:
$ref: '#/components/schemas/ProductCollection'
AdminDeleteProductsFromCollectionReq:
type: object
required:
- product_ids
properties:
product_ids:
description: An array of Product IDs to remove from the Product Collection.
type: array
items:
description: The ID of a Product to add to the Product Collection.
type: string
AdminPostCollectionsCollectionReq:
type: object
properties:
title:
type: string
description: The title to identify the Collection by.
handle:
type: string
description: >-
An optional handle to be used in slugs, if none is provided we will
kebab-case the title.
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminCurrenciesListRes:
type: object
properties:
currencies:
type: array
items:
$ref: '#/components/schemas/Currency'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminCurrenciesRes:
type: object
properties:
currency:
$ref: '#/components/schemas/Currency'
AdminPostCurrenciesCurrencyReq:
type: object
properties:
includes_tax:
type: boolean
description: '[EXPERIMENTAL] Tax included in prices of currency.'
AdminPostCustomerGroupsGroupCustomersBatchReq:
type: object
required:
- customer_ids
properties:
customer_ids:
description: The ids of the customers to add
type: array
items:
type: object
required:
- id
properties:
id:
description: ID of the customer
type: string
AdminPostCustomerGroupsReq:
type: object
required:
- name
properties:
name:
type: string
description: Name of the customer group
metadata:
type: object
description: Metadata for the customer.
AdminDeleteCustomerGroupsGroupCustomerBatchReq:
type: object
required:
- customer_ids
properties:
customer_ids:
description: The ids of the customers to remove
type: array
items:
type: object
required:
- id
properties:
id:
description: ID of the customer
type: string
AdminCustomerGroupsRes:
type: object
properties:
customer_group:
$ref: '#/components/schemas/CustomerGroup'
AdminCustomerGroupsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted customer group.
object:
type: string
description: The type of the object that was deleted.
default: customer_group
deleted:
type: boolean
description: Whether the customer group was deleted successfully or not.
default: true
AdminCustomerGroupsListRes:
type: object
properties:
customer_groups:
type: array
items:
$ref: '#/components/schemas/CustomerGroup'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostCustomerGroupsGroupReq:
type: object
properties:
name:
description: Name of the customer group
type: string
metadata:
description: Metadata for the customer.
type: object
AdminPostCustomersReq:
type: object
required:
- email
- first_name
- last_name
- password
properties:
email:
type: string
description: The customer's email.
format: email
first_name:
type: string
description: The customer's first name.
last_name:
type: string
description: The customer's last name.
password:
type: string
description: The customer's password.
format: password
phone:
type: string
description: The customer's phone number.
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminCustomersRes:
type: object
properties:
customer:
$ref: '#/components/schemas/Customer'
AdminCustomersListRes:
type: object
properties:
customers:
type: array
items:
$ref: '#/components/schemas/Customer'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostCustomersCustomerReq:
type: object
properties:
email:
type: string
description: The Customer's email.
format: email
first_name:
type: string
description: The Customer's first name.
last_name:
type: string
description: The Customer's last name.
phone:
type: string
description: The Customer's phone number.
password:
type: string
description: The Customer's password.
format: password
groups:
type: array
items:
type: object
required:
- id
properties:
id:
description: The ID of a customer group
type: string
description: A list of customer groups to which the customer belongs.
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminPostDiscountsDiscountConditionsConditionBatchReq:
type: object
required:
- resources
properties:
resources:
description: The resources to be added to the discount condition
type: array
items:
type: object
required:
- id
properties:
id:
description: The id of the item
type: string
AdminPostDiscountsDiscountConditions:
type: object
required:
- operator
properties:
operator:
description: Operator of the condition
type: string
enum:
- in
- not_in
products:
type: array
description: list of product IDs if the condition is applied on products.
items:
type: string
product_types:
type: array
description: >-
list of product type IDs if the condition is applied on product
types.
items:
type: string
product_collections:
type: array
description: >-
list of product collection IDs if the condition is applied on
product collections.
items:
type: string
product_tags:
type: array
description: list of product tag IDs if the condition is applied on product tags.
items:
type: string
customer_groups:
type: array
description: >-
list of customer group IDs if the condition is applied on customer
groups.
items:
type: string
AdminPostDiscountsReq:
type: object
required:
- code
- rule
- regions
properties:
code:
type: string
description: A unique code that will be used to redeem the Discount
is_dynamic:
type: boolean
description: >-
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.
default: false
rule:
description: The Discount Rule that defines how Discounts are calculated
type: object
required:
- type
- value
- allocation
properties:
description:
type: string
description: A short description of the discount
type:
type: string
description: >-
The type of the Discount, can be `fixed` for discounts that
reduce the price by a fixed amount, `percentage` for percentage
reductions or `free_shipping` for shipping vouchers.
enum:
- fixed
- percentage
- free_shipping
value:
type: number
description: >-
The value that the discount represents; this will depend on the
type of the discount
allocation:
type: string
description: The scope that the discount should apply to.
enum:
- total
- item
conditions:
type: array
description: >-
A set of conditions that can be used to limit when the discount
can be used. Only one of `products`, `product_types`,
`product_collections`, `product_tags`, and `customer_groups`
should be provided.
items:
type: object
required:
- operator
properties:
operator:
type: string
description: Operator of the condition
enum:
- in
- not_in
products:
type: array
description: >-
list of product IDs if the condition is applied on
products.
items:
type: string
product_types:
type: array
description: >-
list of product type IDs if the condition is applied on
product types.
items:
type: string
product_collections:
type: array
description: >-
list of product collection IDs if the condition is applied
on product collections.
items:
type: string
product_tags:
type: array
description: >-
list of product tag IDs if the condition is applied on
product tags.
items:
type: string
customer_groups:
type: array
description: >-
list of customer group IDs if the condition is applied on
customer groups.
items:
type: string
is_disabled:
type: boolean
description: >-
Whether the Discount code is disabled on creation. You will have to
enable it later to make it available to Customers.
default: false
starts_at:
type: string
format: date-time
description: The time at which the Discount should be available.
ends_at:
type: string
format: date-time
description: The time at which the Discount should no longer be available.
valid_duration:
type: string
description: Duration the discount runs between
example: P3Y6M4DT12H30M5S
regions:
description: >-
A list of Region ids representing the Regions in which the Discount
can be used.
type: array
items:
type: string
usage_limit:
type: number
description: Maximum times the discount can be used
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminPostDiscountsDiscountDynamicCodesReq:
type: object
required:
- code
properties:
code:
type: string
description: A unique code that will be used to redeem the Discount
usage_limit:
type: number
description: Maximum times the discount can be used
default: 1
metadata:
type: object
description: An optional set of key-value pairs to hold additional information.
AdminDeleteDiscountsDiscountConditionsConditionBatchReq:
type: object
required:
- resources
properties:
resources:
description: The resources to be deleted from the discount condition
type: array
items:
type: object
required:
- id
properties:
id:
description: The id of the item
type: string
AdminDiscountsRes:
type: object
properties:
discount:
$ref: '#/components/schemas/Discount'
AdminDiscountConditionsRes:
type: object
properties:
discount_condition:
$ref: '#/components/schemas/DiscountCondition'
AdminDiscountsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Discount
object:
type: string
description: The type of the object that was deleted.
default: discount
deleted:
type: boolean
description: Whether the discount was deleted successfully or not.
default: true
AdminDiscountConditionsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted DiscountCondition
object:
type: string
description: The type of the object that was deleted.
default: discount-condition
deleted:
type: boolean
description: Whether the discount condition was deleted successfully or not.
default: true
discount:
description: The Discount to which the condition used to belong
$ref: '#/components/schemas/Discount'
AdminDiscountsListRes:
type: object
properties:
discounts:
type: array
items:
$ref: '#/components/schemas/Discount'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostDiscountsDiscountConditionsCondition:
type: object
properties:
products:
type: array
description: list of product IDs if the condition is applied on products.
items:
type: string
product_types:
type: array
description: >-
list of product type IDs if the condition is applied on product
types.
items:
type: string
product_collections:
type: array
description: >-
list of product collection IDs if the condition is applied on
product collections.
items:
type: string
product_tags:
type: array
description: list of product tag IDs if the condition is applied on product tags.
items:
type: string
customer_groups:
type: array
description: >-
list of customer group IDs if the condition is applied on customer
groups.
items:
type: string
AdminPostDiscountsDiscountReq:
type: object
properties:
code:
type: string
description: A unique code that will be used to redeem the Discount
rule:
description: The Discount Rule that defines how Discounts are calculated
type: object
required:
- id
properties:
id:
type: string
description: The ID of the Rule
description:
type: string
description: A short description of the discount
value:
type: number
description: >-
The value that the discount represents; this will depend on the
type of the discount
allocation:
type: string
description: The scope that the discount should apply to.
enum:
- total
- item
conditions:
type: array
description: >-
A set of conditions that can be used to limit when the discount
can be used. Only one of `products`, `product_types`,
`product_collections`, `product_tags`, and `customer_groups`
should be provided.
items:
type: object
required:
- operator
properties:
id:
type: string
description: The ID of the Rule
operator:
type: string
description: Operator of the condition
enum:
- in
- not_in
products:
type: array
description: >-
list of product IDs if the condition is applied on
products.
items:
type: string
product_types:
type: array
description: >-
list of product type IDs if the condition is applied on
product types.
items:
type: string
product_collections:
type: array
description: >-
list of product collection IDs if the condition is applied
on product collections.
items:
type: string
product_tags:
type: array
description: >-
list of product tag IDs if the condition is applied on
product tags.
items:
type: string
customer_groups:
type: array
description: >-
list of customer group IDs if the condition is applied on
customer groups.
items:
type: string
is_disabled:
type: boolean
description: >-
Whether the Discount code is disabled on creation. You will have to
enable it later to make it available to Customers.
starts_at:
type: string
format: date-time
description: The time at which the Discount should be available.
ends_at:
type: string
format: date-time
description: The time at which the Discount should no longer be available.
valid_duration:
type: string
description: Duration the discount runs between
example: P3Y6M4DT12H30M5S
usage_limit:
type: number
description: Maximum times the discount can be used
regions:
description: >-
A list of Region ids representing the Regions in which the Discount
can be used.
type: array
items:
type: string
metadata:
description: An object containing metadata of the discount
type: object
AdminPostDraftOrdersReq:
type: object
required:
- email
- region_id
- shipping_methods
properties:
status:
description: The status of the draft order
type: string
enum:
- open
- completed
email:
description: The email of the customer of the draft order
type: string
format: email
billing_address:
description: The Address to be used for billing purposes.
anyOf:
- $ref: '#/components/schemas/AddressFields'
- type: string
shipping_address:
description: The Address to be used for shipping.
anyOf:
- $ref: '#/components/schemas/AddressFields'
- type: string
items:
description: The Line Items that have been received.
type: array
items:
type: object
required:
- quantity
properties:
variant_id:
description: The ID of the Product Variant to generate the Line Item from.
type: string
unit_price:
description: The potential custom price of the item.
type: integer
title:
description: The potential custom title of the item.
type: string
quantity:
description: The quantity of the Line Item.
type: integer
metadata:
description: >-
The optional key-value map with additional details about the
Line Item.
type: object
region_id:
description: The ID of the region for the draft order
type: string
discounts:
description: The discounts to add on the draft order
type: array
items:
type: object
required:
- code
properties:
code:
description: The code of the discount to apply
type: string
customer_id:
description: The ID of the customer to add on the draft order
type: string
no_notification_order:
description: >-
An optional flag passed to the resulting order to determine use of
notifications.
type: boolean
shipping_methods:
description: The shipping methods for the draft order
type: array
items:
type: object
required:
- option_id
properties:
option_id:
description: The ID of the shipping option in use
type: string
data:
description: The optional additional data needed for the shipping method
type: object
price:
description: The potential custom price of the shipping
type: integer
metadata:
description: >-
The optional key-value map with additional details about the Draft
Order.
type: object
AdminPostDraftOrdersDraftOrderLineItemsReq:
type: object
required:
- quantity
properties:
variant_id:
description: The ID of the Product Variant to generate the Line Item from.
type: string
unit_price:
description: The potential custom price of the item.
type: integer
title:
description: The potential custom title of the item.
type: string
default: Custom item
quantity:
description: The quantity of the Line Item.
type: integer
metadata:
description: >-
The optional key-value map with additional details about the Line
Item.
type: object
AdminPostDraftOrdersDraftOrderRegisterPaymentRes:
type: object
properties:
order:
$ref: '#/components/schemas/Order'
AdminDraftOrdersRes:
type: object
properties:
draft_order:
$ref: '#/components/schemas/DraftOrder'
AdminDraftOrdersDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Draft Order.
object:
type: string
description: The type of the object that was deleted.
default: draft-order
deleted:
type: boolean
description: Whether the draft order was deleted successfully or not.
default: true
AdminDraftOrdersListRes:
type: object
properties:
draft_orders:
type: array
items:
$ref: '#/components/schemas/DraftOrder'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostDraftOrdersDraftOrderReq:
type: object
properties:
region_id:
type: string
description: The ID of the Region to create the Draft Order in.
country_code:
type: string
description: The 2 character ISO code for the Country.
externalDocs:
url: >-
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
description: See a list of codes.
email:
type: string
description: An email to be used on the Draft Order.
format: email
billing_address:
description: The Address to be used for billing purposes.
anyOf:
- $ref: '#/components/schemas/AddressFields'
- type: string
shipping_address:
description: The Address to be used for shipping.
anyOf:
- $ref: '#/components/schemas/AddressFields'
- type: string
discounts:
description: An array of Discount codes to add to the Draft Order.
type: array
items:
type: object
required:
- code
properties:
code:
description: The code that a Discount is identifed by.
type: string
no_notification_order:
description: >-
An optional flag passed to the resulting order to determine use of
notifications.
type: boolean
customer_id:
description: The ID of the Customer to associate the Draft Order with.
type: string
AdminPostDraftOrdersDraftOrderLineItemsItemReq:
type: object
properties:
unit_price:
description: The potential custom price of the item.
type: integer
title:
description: The potential custom title of the item.
type: string
quantity:
description: The quantity of the Line Item.
type: integer
metadata:
description: >-
The optional key-value map with additional details about the Line
Item.
type: object
AdminPostGiftCardsReq:
type: object
required:
- region_id
properties:
value:
type: integer
description: The value (excluding VAT) that the Gift Card should represent.
is_disabled:
type: boolean
description: >-
Whether the Gift Card is disabled on creation. You will have to
enable it later to make it available to Customers.
ends_at:
type: string
format: date-time
description: The time at which the Gift Card should no longer be available.
region_id:
description: The ID of the Region in which the Gift Card can be used.
type: string
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminGiftCardsRes:
type: object
properties:
gift_card:
$ref: '#/components/schemas/GiftCard'
AdminGiftCardsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Gift Card
object:
type: string
description: The type of the object that was deleted.
default: gift-card
deleted:
type: boolean
description: Whether the gift card was deleted successfully or not.
default: true
AdminGiftCardsListRes:
type: object
properties:
gift_cards:
type: array
items:
$ref: '#/components/schemas/GiftCard'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostGiftCardsGiftCardReq:
type: object
properties:
balance:
type: integer
description: The value (excluding VAT) that the Gift Card should represent.
is_disabled:
type: boolean
description: >-
Whether the Gift Card is disabled on creation. You will have to
enable it later to make it available to Customers.
ends_at:
type: string
format: date-time
description: The time at which the Gift Card should no longer be available.
region_id:
description: The ID of the Region in which the Gift Card can be used.
type: string
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminPostInventoryItemsItemLocationLevelsReq:
type: object
required:
- location_id
- stocked_quantity
properties:
location_id:
description: the item location ID
type: string
stocked_quantity:
description: the stock quantity of an inventory item at the given location ID
type: number
incoming_quantity:
description: >-
the incoming stock quantity of an inventory item at the given
location ID
type: number
AdminInventoryItemsRes:
type: object
properties:
inventory_item:
$ref: '#/components/schemas/InventoryItemDTO'
AdminInventoryItemsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Inventory Item.
object:
type: string
description: The type of the object that was deleted.
format: inventory_item
deleted:
type: boolean
description: Whether or not the Inventory Item was deleted.
default: true
AdminInventoryItemsListRes:
type: object
properties:
inventory_items:
type: array
items:
$ref: '#/components/schemas/InventoryItemDTO'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminInventoryItemsListWithVariantsAndLocationLevelsRes:
type: object
properties:
inventory_items:
type: array
items:
allOf:
- $ref: '#/components/schemas/InventoryItemDTO'
- type: object
properties:
location_levels:
type: array
items:
allOf:
- $ref: '#/components/schemas/InventoryLevelDTO'
variants:
type: array
items:
allOf:
- $ref: '#/components/schemas/ProductVariant'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminInventoryItemsLocationLevelsRes:
type: object
properties:
id:
description: The id of the location
location_levels:
description: List of stock levels at a given location
type: array
items:
$ref: '#/components/schemas/InventoryLevelDTO'
AdminPostInventoryItemsInventoryItemReq:
type: object
properties:
hs_code:
description: >-
The Harmonized System code of the Inventory Item. May be used by
Fulfillment Providers to pass customs information to shipping
carriers.
type: string
origin_country:
description: >-
The country in which the Inventory Item was produced. May be used by
Fulfillment Providers to pass customs information to shipping
carriers.
type: string
mid_code:
description: >-
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.
type: string
material:
description: >-
The material and composition that the Inventory Item is made of, May
be used by Fulfillment Providers to pass customs information to
shipping carriers.
type: string
weight:
description: >-
The weight of the Inventory Item. May be used in shipping rate
calculations.
type: number
height:
description: >-
The height of the Inventory Item. May be used in shipping rate
calculations.
type: number
width:
description: >-
The width of the Inventory Item. May be used in shipping rate
calculations.
type: number
length:
description: >-
The length of the Inventory Item. May be used in shipping rate
calculations.
type: number
requires_shipping:
description: Whether the item requires shipping.
type: boolean
AdminPostInventoryItemsItemLocationLevelsLevelReq:
type: object
properties:
stocked_quantity:
description: >-
the total stock quantity of an inventory item at the given location
ID
type: number
incoming_quantity:
description: >-
the incoming stock quantity of an inventory item at the given
location ID
type: number
AdminPostInvitesInviteAcceptReq:
type: object
required:
- token
- user
properties:
token:
description: The invite token provided by the admin.
type: string
user:
description: The User to create.
type: object
required:
- first_name
- last_name
- password
properties:
first_name:
type: string
description: the first name of the User
last_name:
type: string
description: the last name of the User
password:
description: The desired password for the User
type: string
format: password
AdminPostInvitesReq:
type: object
required:
- user
- role
properties:
user:
description: The email for the user to be created.
type: string
format: email
role:
description: The role of the user to be created.
type: string
enum:
- admin
- member
- developer
AdminInviteDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Invite.
object:
type: string
description: The type of the object that was deleted.
default: invite
deleted:
type: boolean
description: Whether or not the Invite was deleted.
default: true
AdminListInvitesRes:
type: object
properties:
invites:
type: array
items:
$ref: '#/components/schemas/Invite'
AdminPostNotesReq:
type: object
required:
- resource_id
- resource_type
- value
properties:
resource_id:
type: string
description: The ID of the resource which the Note relates to.
resource_type:
type: string
description: The type of resource which the Note relates to.
value:
type: string
description: The content of the Note to create.
AdminNotesRes:
type: object
properties:
note:
$ref: '#/components/schemas/Note'
AdminNotesDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Note.
object:
type: string
description: The type of the object that was deleted.
default: note
deleted:
type: boolean
description: Whether or not the Note was deleted.
default: true
AdminNotesListRes:
type: object
properties:
notes:
type: array
items:
$ref: '#/components/schemas/Note'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostNotesNoteReq:
type: object
required:
- value
properties:
value:
type: string
description: The updated description of the Note.
AdminNotificationsListRes:
type: object
properties:
notifications:
type: array
items:
$ref: '#/components/schemas/Notification'
AdminNotificationsRes:
type: object
properties:
notification:
$ref: '#/components/schemas/Notification'
AdminPostNotificationsNotificationResendReq:
type: object
properties:
to:
description: >-
A new address or user identifier that the Notification should be
sent to
type: string
AdminPostOrderEditsEditLineItemsReq:
type: object
required:
- variant_id
- quantity
properties:
variant_id:
description: The ID of the variant ID to add
type: string
quantity:
description: The quantity to add
type: number
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminPostOrderEditsReq:
type: object
required:
- order_id
properties:
order_id:
description: The ID of the order to create the edit for.
type: string
internal_note:
description: An optional note to create for the order edit.
type: string
AdminOrderEditsRes:
type: object
properties:
order_edit:
$ref: '#/components/schemas/OrderEdit'
AdminOrderEditsListRes:
type: object
properties:
order_edits:
type: array
items:
$ref: '#/components/schemas/OrderEdit'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminOrderEditDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Order Edit.
object:
type: string
description: The type of the object that was deleted.
default: order_edit
deleted:
type: boolean
description: Whether or not the Order Edit was deleted.
default: true
AdminOrderEditItemChangeDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Order Edit Item Change.
object:
type: string
description: The type of the object that was deleted.
default: item_change
deleted:
type: boolean
description: Whether or not the Order Edit Item Change was deleted.
default: true
AdminPostOrderEditsEditLineItemsLineItemReq:
type: object
required:
- quantity
properties:
quantity:
description: The quantity to update
type: number
AdminPostOrderEditsOrderEditReq:
type: object
properties:
internal_note:
description: An optional note to create or update for the order edit.
type: string
AdminPostOrdersOrderShippingMethodsReq:
type: object
required:
- price
- option_id
properties:
price:
type: number
description: >-
The price (excluding VAT) that should be charged for the Shipping
Method
option_id:
type: string
description: The ID of the Shipping Option to create the Shipping Method from.
date:
type: object
description: >-
The data required for the Shipping Option to create a Shipping
Method. This will depend on the Fulfillment Provider.
AdminPostOrdersOrderClaimsClaimShipmentsReq:
type: object
required:
- fulfillment_id
properties:
fulfillment_id:
description: The ID of the Fulfillment.
type: string
tracking_numbers:
description: The tracking numbers for the shipment.
type: array
items:
type: string
AdminPostOrdersOrderClaimsReq:
type: object
required:
- type
- claim_items
properties:
type:
description: >-
The type of the Claim. This will determine how the Claim is treated:
`replace` Claims will result in a Fulfillment with new items being
created, while a `refund` Claim will refund the amount paid for the
claimed items.
type: string
enum:
- replace
- refund
claim_items:
description: The Claim Items that the Claim will consist of.
type: array
items:
type: object
required:
- item_id
- quantity
properties:
item_id:
description: The ID of the Line Item that will be claimed.
type: string
quantity:
description: The number of items that will be returned
type: integer
note:
description: Short text describing the Claim Item in further detail.
type: string
reason:
description: The reason for the Claim
type: string
enum:
- missing_item
- wrong_item
- production_failure
- other
tags:
description: A list o tags to add to the Claim Item
type: array
items:
type: string
images:
description: A list of image URL's that will be associated with the Claim
items:
type: string
return_shipping:
description: >-
Optional details for the Return Shipping Method, if the items are to
be sent back.
type: object
properties:
option_id:
type: string
description: >-
The ID of the Shipping Option to create the Shipping Method
from.
price:
type: integer
description: The price to charge for the Shipping Method.
additional_items:
description: >-
The new items to send to the Customer when the Claim type is
Replace.
type: array
items:
type: object
required:
- variant_id
- quantity
properties:
variant_id:
description: The ID of the Product Variant to ship.
type: string
quantity:
description: The quantity of the Product Variant to ship.
type: integer
shipping_methods:
description: The Shipping Methods to send the additional Line Items with.
type: array
items:
type: object
properties:
id:
description: The ID of an existing Shipping Method
type: string
option_id:
description: The ID of the Shipping Option to create a Shipping Method from
type: string
price:
description: The price to charge for the Shipping Method
type: integer
data:
description: >-
An optional set of key-value pairs to hold additional
information.
type: object
shipping_address:
type: object
description: >-
An optional shipping address to send the claim to. Defaults to the
parent order's shipping address
$ref: '#/components/schemas/Address'
refund_amount:
description: The amount to refund the Customer when the Claim type is `refund`.
type: integer
no_notification:
description: If set to true no notification will be send related to this Claim.
type: boolean
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminPostOrdersOrderFulfillmentsReq:
type: object
required:
- items
properties:
items:
description: The Line Items to include in the Fulfillment.
type: array
items:
type: object
required:
- item_id
- quantity
properties:
item_id:
description: The ID of Line Item to fulfill.
type: string
quantity:
description: The quantity of the Line Item to fulfill.
type: integer
no_notification:
description: If set to true no notification will be send related to this Swap.
type: boolean
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminOrdersOrderLineItemReservationReq:
type: object
required:
- location_id
properties:
location_id:
description: The id of the location of the reservation
type: string
quantity:
description: The quantity to reserve
type: number
AdminPostOrdersOrderShipmentReq:
type: object
required:
- fulfillment_id
properties:
fulfillment_id:
description: The ID of the Fulfillment.
type: string
tracking_numbers:
description: The tracking numbers for the shipment.
type: array
items:
type: string
no_notification:
description: >-
If set to true no notification will be send related to this
Shipment.
type: boolean
AdminPostOrdersOrderSwapsSwapShipmentsReq:
type: object
required:
- fulfillment_id
properties:
fulfillment_id:
description: The ID of the Fulfillment.
type: string
tracking_numbers:
description: The tracking numbers for the shipment.
type: array
items:
type: string
no_notification:
description: If set to true no notification will be sent related to this Claim.
type: boolean
AdminPostOrdersOrderSwapsReq:
type: object
required:
- return_items
properties:
return_items:
description: The Line Items to return as part of the Swap.
type: array
items:
type: object
required:
- item_id
- quantity
properties:
item_id:
description: The ID of the Line Item that will be claimed.
type: string
quantity:
description: The number of items that will be returned
type: integer
reason_id:
description: The ID of the Return Reason to use.
type: string
note:
description: An optional note with information about the Return.
type: string
return_shipping:
description: How the Swap will be returned.
type: object
required:
- option_id
properties:
option_id:
type: string
description: >-
The ID of the Shipping Option to create the Shipping Method
from.
price:
type: integer
description: The price to charge for the Shipping Method.
additional_items:
description: The new items to send to the Customer.
type: array
items:
type: object
required:
- variant_id
- quantity
properties:
variant_id:
description: The ID of the Product Variant to ship.
type: string
quantity:
description: The quantity of the Product Variant to ship.
type: integer
custom_shipping_options:
description: >-
The custom shipping options to potentially create a Shipping Method
from.
type: array
items:
type: object
required:
- option_id
- price
properties:
option_id:
description: The ID of the Shipping Option to override with a custom price.
type: string
price:
description: The custom price of the Shipping Option.
type: integer
no_notification:
description: If set to true no notification will be send related to this Swap.
type: boolean
allow_backorder:
description: 'If true, swaps can be completed with items out of stock'
type: boolean
default: true
AdminPostOrdersOrderClaimsClaimFulfillmentsReq:
type: object
properties:
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
no_notification:
description: If set to true no notification will be send related to this Claim.
type: boolean
AdminPostOrdersOrderSwapsSwapFulfillmentsReq:
type: object
properties:
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
no_notification:
description: If set to true no notification will be send related to this Claim.
type: boolean
AdminOrdersRes:
type: object
properties:
order:
$ref: '#/components/schemas/Order'
AdminOrdersListRes:
type: object
properties:
orders:
type: array
items:
$ref: '#/components/schemas/Order'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostOrdersOrderRefundsReq:
type: object
required:
- amount
- reason
properties:
amount:
description: The amount to refund.
type: integer
reason:
description: The reason for the Refund.
type: string
note:
description: A note with additional details about the Refund.
type: string
no_notification:
description: If set to true no notification will be send related to this Refund.
type: boolean
AdminPostOrdersOrderReturnsReq:
type: object
required:
- items
properties:
items:
description: The Line Items that will be returned.
type: array
items:
type: object
required:
- item_id
- quantity
properties:
item_id:
description: The ID of the Line Item.
type: string
reason_id:
description: The ID of the Return Reason to use.
type: string
note:
description: An optional note with information about the Return.
type: string
quantity:
description: The quantity of the Line Item.
type: integer
return_shipping:
description: The Shipping Method to be used to handle the return shipment.
type: object
properties:
option_id:
type: string
description: >-
The ID of the Shipping Option to create the Shipping Method
from.
price:
type: integer
description: The price to charge for the Shipping Method.
note:
description: An optional note with information about the Return.
type: string
receive_now:
description: >-
A flag to indicate if the Return should be registerd as received
immediately.
type: boolean
default: false
no_notification:
description: >-
A flag to indicate if no notifications should be emitted related to
the requested Return.
type: boolean
refund:
description: The amount to refund.
type: integer
AdminPostOrdersOrderClaimsClaimReq:
type: object
properties:
claim_items:
description: The Claim Items that the Claim will consist of.
type: array
items:
type: object
required:
- id
- images
- tags
properties:
id:
description: The ID of the Claim Item.
type: string
item_id:
description: The ID of the Line Item that will be claimed.
type: string
quantity:
description: The number of items that will be returned
type: integer
note:
description: Short text describing the Claim Item in further detail.
type: string
reason:
description: The reason for the Claim
type: string
enum:
- missing_item
- wrong_item
- production_failure
- other
tags:
description: A list o tags to add to the Claim Item
type: array
items:
type: object
properties:
id:
type: string
description: Tag ID
value:
type: string
description: Tag value
images:
description: A list of image URL's that will be associated with the Claim
type: array
items:
type: object
properties:
id:
type: string
description: Image ID
url:
type: string
description: Image URL
metadata:
description: >-
An optional set of key-value pairs to hold additional
information.
type: object
shipping_methods:
description: The Shipping Methods to send the additional Line Items with.
type: array
items:
type: object
properties:
id:
description: The ID of an existing Shipping Method
type: string
option_id:
description: The ID of the Shipping Option to create a Shipping Method from
type: string
price:
description: The price to charge for the Shipping Method
type: integer
data:
description: >-
An optional set of key-value pairs to hold additional
information.
type: object
no_notification:
description: If set to true no notification will be send related to this Swap.
type: boolean
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminPostOrdersOrderReq:
type: object
properties:
email:
description: the email for the order
type: string
billing_address:
description: Billing address
anyOf:
- $ref: '#/components/schemas/AddressFields'
shipping_address:
description: Shipping address
anyOf:
- $ref: '#/components/schemas/AddressFields'
items:
description: The Line Items for the order
type: array
items:
$ref: '#/components/schemas/LineItem'
region:
description: ID of the region where the order belongs
type: string
discounts:
description: Discounts applied to the order
type: array
items:
$ref: '#/components/schemas/Discount'
customer_id:
description: ID of the customer
type: string
payment_method:
description: payment method chosen for the order
type: object
properties:
provider_id:
type: string
description: ID of the payment provider
data:
description: Data relevant for the given payment method
type: object
shipping_method:
description: The Shipping Method used for shipping the order.
type: object
properties:
provider_id:
type: string
description: The ID of the shipping provider.
profile_id:
type: string
description: The ID of the shipping profile.
price:
type: integer
description: The price of the shipping.
data:
type: object
description: Data relevant to the specific shipping method.
items:
type: array
items:
$ref: '#/components/schemas/LineItem'
description: Items to ship
no_notification:
description: >-
A flag to indicate if no notifications should be emitted related to
the updated order.
type: boolean
AdminPaymentCollectionsRes:
type: object
properties:
payment_collection:
$ref: '#/components/schemas/PaymentCollection'
AdminPaymentCollectionDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Payment Collection.
object:
type: string
description: The type of the object that was deleted.
default: payment_collection
deleted:
type: boolean
description: Whether or not the Payment Collection was deleted.
default: true
AdminUpdatePaymentCollectionsReq:
type: object
properties:
description:
description: An optional description to create or update the payment collection.
type: string
metadata:
description: An optional set of key-value pairs to hold additional information.
type: object
AdminPaymentRes:
type: object
properties:
payment:
$ref: '#/components/schemas/Payment'
AdminRefundRes:
type: object
properties:
refund:
$ref: '#/components/schemas/Refund'
AdminPostPaymentRefundsReq:
type: object
required:
- amount
- reason
properties:
amount:
description: The amount to refund.
type: integer
reason:
description: The reason for the Refund.
type: string
note:
description: A note with additional details about the Refund.
type: string
AdminPostPriceListPricesPricesReq:
type: object
properties:
prices:
description: The prices to update or add.
type: array
items:
type: object
required:
- amount
- variant_id
properties:
id:
description: The ID of the price.
type: string
region_id:
description: >-
The ID of the Region for which the price is used. Only
required if currecny_code is not provided.
type: string
currency_code:
description: >-
The 3 character ISO currency code for which the price will be
used. Only required if region_id is not provided.
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
variant_id:
description: The ID of the Variant for which the price is used.
type: string
amount:
description: The amount to charge for the Product Variant.
type: integer
min_quantity:
description: The minimum quantity for which the price will be used.
type: integer
max_quantity:
description: The maximum quantity for which the price will be used.
type: integer
override:
description: >-
If true the prices will replace all existing prices associated with
the Price List.
type: boolean
AdminPostPriceListsPriceListReq:
type: object
required:
- name
- description
- type
- prices
properties:
name:
description: The name of the Price List
type: string
description:
description: A description of the Price List.
type: string
starts_at:
description: The date with timezone that the Price List starts being valid.
type: string
format: date
ends_at:
description: The date with timezone that the Price List ends being valid.
type: string
format: date
type:
description: The type of the Price List.
type: string
enum:
- sale
- override
status:
description: The status of the Price List.
type: string
enum:
- active
- draft
prices:
description: The prices of the Price List.
type: array
items:
type: object
required:
- amount
- variant_id
properties:
region_id:
description: >-
The ID of the Region for which the price is used. Only
required if currecny_code is not provided.
type: string
currency_code:
description: >-
The 3 character ISO currency code for which the price will be
used. Only required if region_id is not provided.
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
amount:
description: The amount to charge for the Product Variant.
type: integer
variant_id:
description: The ID of the Variant for which the price is used.
type: string
min_quantity:
description: The minimum quantity for which the price will be used.
type: integer
max_quantity:
description: The maximum quantity for which the price will be used.
type: integer
customer_groups:
type: array
description: A list of customer groups that the Price List applies to.
items:
type: object
required:
- id
properties:
id:
description: The ID of a customer group
type: string
includes_tax:
description: '[EXPERIMENTAL] Tax included in prices of price list'
type: boolean
AdminDeletePriceListPricesPricesReq:
type: object
properties:
price_ids:
description: The price id's of the Money Amounts to delete.
type: array
items:
type: string
AdminPriceListRes:
type: object
properties:
price_list:
$ref: '#/components/schemas/PriceList'
AdminPriceListDeleteBatchRes:
type: object
properties:
ids:
type: array
items:
type: string
description: The IDs of the deleted Money Amounts (Prices).
object:
type: string
description: The type of the object that was deleted.
default: money-amount
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminPriceListDeleteProductPricesRes:
type: object
properties:
ids:
type: array
description: The price ids that have been deleted.
items:
type: string
object:
type: string
description: The type of the object that was deleted.
default: money-amount
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminPriceListDeleteVariantPricesRes:
type: object
properties:
ids:
type: array
description: The price ids that have been deleted.
items:
type: string
object:
type: string
description: The type of the object that was deleted.
default: money-amount
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminPriceListDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Price List.
object:
type: string
description: The type of the object that was deleted.
default: price-list
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminPriceListsListRes:
type: object
properties:
price_lists:
type: array
items:
$ref: '#/components/schemas/PriceList'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPriceListsProductsListRes:
type: object
properties:
products:
type: array
items:
$ref: '#/components/schemas/Product'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostPriceListsPriceListPriceListReq:
type: object
properties:
name:
description: The name of the Price List
type: string
description:
description: A description of the Price List.
type: string
starts_at:
description: The date with timezone that the Price List starts being valid.
type: string
format: date
ends_at:
description: The date with timezone that the Price List ends being valid.
type: string
format: date
type:
description: The type of the Price List.
type: string
enum:
- sale
- override
status:
description: The status of the Price List.
type: string
enum:
- active
- draft
prices:
description: The prices of the Price List.
type: array
items:
type: object
required:
- amount
- variant_id
properties:
id:
description: The ID of the price.
type: string
region_id:
description: >-
The ID of the Region for which the price is used. Only
required if currecny_code is not provided.
type: string
currency_code:
description: >-
The 3 character ISO currency code for which the price will be
used. Only required if region_id is not provided.
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
variant_id:
description: The ID of the Variant for which the price is used.
type: string
amount:
description: The amount to charge for the Product Variant.
type: integer
min_quantity:
description: The minimum quantity for which the price will be used.
type: integer
max_quantity:
description: The maximum quantity for which the price will be used.
type: integer
customer_groups:
type: array
description: A list of customer groups that the Price List applies to.
items:
type: object
required:
- id
properties:
id:
description: The ID of a customer group
type: string
includes_tax:
description: '[EXPERIMENTAL] Tax included in prices of price list'
type: boolean
AdminPostProductCategoriesCategoryProductsBatchReq:
type: object
required:
- product_ids
properties:
product_ids:
description: The IDs of the products to add to the Product Category
type: array
items:
type: object
required:
- id
properties:
id:
type: string
description: The ID of the product
AdminPostProductCategoriesReq:
type: object
required:
- name
properties:
name:
type: string
description: The name to identify the Product Category by.
handle:
type: string
description: >-
An optional handle to be used in slugs, if none is provided we will
kebab-case the title.
is_internal:
type: boolean
description: A flag to make product category an internal category for admins
is_active:
type: boolean
description: A flag to make product category visible/hidden in the store front
parent_category_id:
type: string
description: The ID of the parent product category
AdminDeleteProductCategoriesCategoryProductsBatchReq:
type: object
required:
- product_ids
properties:
product_ids:
description: The IDs of the products to delete from the Product Category.
type: array
items:
type: object
required:
- id
properties:
id:
description: The ID of a product
type: string
AdminProductCategoriesCategoryRes:
type: object
properties:
product_category:
$ref: '#/components/schemas/ProductCategory'
AdminProductCategoriesCategoryDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted product category
object:
type: string
description: The type of the object that was deleted.
default: product-category
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminProductCategoriesListRes:
type: object
properties:
product_categories:
type: array
items:
$ref: '#/components/schemas/ProductCategory'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostProductCategoriesCategoryReq:
type: object
properties:
name:
type: string
description: The name to identify the Product Category by.
handle:
type: string
description: A handle to be used in slugs.
is_internal:
type: boolean
description: A flag to make product category an internal category for admins
is_active:
type: boolean
description: A flag to make product category visible/hidden in the store front
parent_category_id:
type: string
description: The ID of the parent product category
AdminProductTagsListRes:
type: object
properties:
product_tags:
type: array
items:
$ref: '#/components/schemas/ProductTag'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminProductTypesListRes:
type: object
properties:
product_types:
type: array
items:
$ref: '#/components/schemas/ProductType'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostProductsProductOptionsReq:
type: object
required:
- title
properties:
title:
description: The title the Product Option will be identified by i.e. "Size"
type: string
AdminPostProductsReq:
type: object
required:
- title
properties:
title:
description: The title of the Product
type: string
subtitle:
description: The subtitle of the Product
type: string
description:
description: A description of the Product.
type: string
is_giftcard:
description: >-
A flag to indicate if the Product represents a Gift Card. Purchasing
Products with this flag set to `true` will result in a Gift Card
being created.
type: boolean
default: false
discountable:
description: >-
A flag to indicate if discounts can be applied to the LineItems
generated from this Product
type: boolean
default: true
images:
description: Images of the Product.
type: array
items:
type: string
thumbnail:
description: The thumbnail to use for the Product.
type: string
handle:
description: A unique handle to identify the Product by.
type: string
status:
description: The status of the product.
type: string
enum:
- draft
- proposed
- published
- rejected
default: draft
type:
description: The Product Type to associate the Product with.
type: object
required:
- value
properties:
id:
description: The ID of the Product Type.
type: string
value:
description: The value of the Product Type.
type: string
collection_id:
description: The ID of the Collection the Product should belong to.
type: string
tags:
description: Tags to associate the Product with.
type: array
items:
type: object
required:
- value
properties:
id:
description: The ID of an existing Tag.
type: string
value:
description: 'The value of the Tag, these will be upserted.'
type: string
sales_channels:
description: '[EXPERIMENTAL] Sales channels to associate the Product with.'
type: array
items:
type: object
required:
- id
properties:
id:
description: The ID of an existing Sales channel.
type: string
categories:
description: Categories to add the Product to.
type: array
items:
required:
- id
properties:
id:
description: The ID of a Product Category.
type: string
options:
description: >-
The Options that the Product should have. These define on which
properties the Product's Product Variants will differ.
type: array
items:
type: object
required:
- title
properties:
title:
description: The title to identify the Product Option by.
type: string
variants:
description: A list of Product Variants to create with the Product.
type: array
items:
type: object
required:
- title
properties:
title:
description: The title to identify the Product Variant by.
type: string
sku:
description: The unique SKU for the Product Variant.
type: string
ean:
description: The EAN number of the item.
type: string
upc:
description: The UPC number of the item.
type: string
barcode:
description: A generic GTIN field for the Product Variant.
type: string
hs_code:
description: The Harmonized System code for the Product Variant.
type: string
inventory_quantity:
description: The amount of stock kept for the Product Variant.
type: integer
default: 0
allow_backorder:
description: >-
Whether the Product Variant can be purchased when out of
stock.
type: boolean
manage_inventory:
description: >-
Whether Medusa should keep track of the inventory for this
Product Variant.
type: boolean
weight:
description: The wieght of the Product Variant.
type: number
length:
description: The length of the Product Variant.
type: number
height:
description: The height of the Product Variant.
type: number
width:
description: The width of the Product Variant.
type: number
origin_country:
description: The country of origin of the Product Variant.
type: string
mid_code:
description: The Manufacturer Identification code for the Product Variant.
type: string
material:
description: The material composition of the Product Variant.
type: string
metadata:
description: >-
An optional set of key-value pairs with additional
information.
type: object
prices:
type: array
items:
type: object
required:
- amount
properties:
region_id:
description: >-
The ID of the Region for which the price is used. Only
required if currency_code is not provided.
type: string
currency_code:
description: >-
The 3 character ISO currency code for which the price
will be used. Only required if region_id is not
provided.
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
amount:
description: The amount to charge for the Product Variant.
type: integer
min_quantity:
description: The minimum quantity for which the price will be used.
type: integer
max_quantity:
description: The maximum quantity for which the price will be used.
type: integer
options:
type: array
items:
type: object
required:
- value
properties:
value:
description: >-
The value to give for the Product Option at the same
index in the Product's `options` field.
type: string
weight:
description: The weight of the Product.
type: number
length:
description: The length of the Product.
type: number
height:
description: The height of the Product.
type: number
width:
description: The width of the Product.
type: number
hs_code:
description: The Harmonized System code for the Product Variant.
type: string
origin_country:
description: The country of origin of the Product.
type: string
mid_code:
description: The Manufacturer Identification code for the Product.
type: string
material:
description: The material composition of the Product.
type: string
metadata:
description: An optional set of key-value pairs with additional information.
type: object
AdminPostProductsProductVariantsReq:
type: object
required:
- title
- prices
- options
properties:
title:
description: The title to identify the Product Variant by.
type: string
sku:
description: The unique SKU for the Product Variant.
type: string
ean:
description: The EAN number of the item.
type: string
upc:
description: The UPC number of the item.
type: string
barcode:
description: A generic GTIN field for the Product Variant.
type: string
hs_code:
description: The Harmonized System code for the Product Variant.
type: string
inventory_quantity:
description: The amount of stock kept for the Product Variant.
type: integer
default: 0
allow_backorder:
description: Whether the Product Variant can be purchased when out of stock.
type: boolean
manage_inventory:
description: >-
Whether Medusa should keep track of the inventory for this Product
Variant.
type: boolean
default: true
weight:
description: The wieght of the Product Variant.
type: number
length:
description: The length of the Product Variant.
type: number
height:
description: The height of the Product Variant.
type: number
width:
description: The width of the Product Variant.
type: number
origin_country:
description: The country of origin of the Product Variant.
type: string
mid_code:
description: The Manufacturer Identification code for the Product Variant.
type: string
material:
description: The material composition of the Product Variant.
type: string
metadata:
description: An optional set of key-value pairs with additional information.
type: object
prices:
type: array
items:
type: object
required:
- amount
properties:
id:
description: The ID of the price.
type: string
region_id:
description: >-
The ID of the Region for which the price is used. Only
required if currency_code is not provided.
type: string
currency_code:
description: >-
The 3 character ISO currency code for which the price will be
used. Only required if region_id is not provided.
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
amount:
description: The amount to charge for the Product Variant.
type: integer
min_quantity:
description: The minimum quantity for which the price will be used.
type: integer
max_quantity:
description: The maximum quantity for which the price will be used.
type: integer
options:
type: array
items:
type: object
required:
- option_id
- value
properties:
option_id:
description: The ID of the Product Option to set the value for.
type: string
value:
description: The value to give for the Product Option.
type: string
AdminProductsDeleteOptionRes:
type: object
properties:
option_id:
type: string
description: The ID of the deleted Product Option
object:
type: string
description: The type of the object that was deleted.
default: option
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
product:
$ref: '#/components/schemas/Product'
AdminProductsDeleteVariantRes:
type: object
properties:
variant_id:
type: string
description: The ID of the deleted Product Variant.
object:
type: string
description: The type of the object that was deleted.
default: product-variant
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
product:
$ref: '#/components/schemas/Product'
AdminProductsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Product.
object:
type: string
description: The type of the object that was deleted.
default: product
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminProductsListRes:
type: object
properties:
products:
type: array
items:
oneOf:
- $ref: '#/components/schemas/Product'
- $ref: '#/components/schemas/PricedProduct'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminProductsListVariantsRes:
type: object
properties:
variants:
type: array
items:
$ref: '#/components/schemas/ProductVariant'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminProductsListTypesRes:
type: object
properties:
types:
type: array
items:
$ref: '#/components/schemas/ProductType'
AdminProductsListTagsRes:
type: object
properties:
tags:
type: array
items:
type: object
properties:
id:
description: The ID of the tag.
type: string
usage_count:
description: The number of products that use this tag.
type: string
value:
description: The value of the tag.
type: string
AdminProductsRes:
type: object
properties:
product:
$ref: '#/components/schemas/Product'
AdminPostProductsProductMetadataReq:
type: object
required:
- key
- value
properties:
key:
description: The metadata key
type: string
value:
description: The metadata value
type: string
AdminPostProductsProductOptionsOption:
type: object
required:
- title
properties:
title:
description: The title of the Product Option
type: string
AdminPostProductsProductReq:
type: object
properties:
title:
description: The title of the Product
type: string
subtitle:
description: The subtitle of the Product
type: string
description:
description: A description of the Product.
type: string
discountable:
description: >-
A flag to indicate if discounts can be applied to the LineItems
generated from this Product
type: boolean
images:
description: Images of the Product.
type: array
items:
type: string
thumbnail:
description: The thumbnail to use for the Product.
type: string
handle:
description: A unique handle to identify the Product by.
type: string
status:
description: The status of the product.
type: string
enum:
- draft
- proposed
- published
- rejected
type:
description: The Product Type to associate the Product with.
type: object
required:
- value
properties:
id:
description: The ID of the Product Type.
type: string
value:
description: The value of the Product Type.
type: string
collection_id:
description: The ID of the Collection the Product should belong to.
type: string
tags:
description: Tags to associate the Product with.
type: array
items:
type: object
required:
- value
properties:
id:
description: The ID of an existing Tag.
type: string
value:
description: 'The value of the Tag, these will be upserted.'
type: string
sales_channels:
description: '[EXPERIMENTAL] Sales channels to associate the Product with.'
type: array
items:
type: object
required:
- id
properties:
id:
description: The ID of an existing Sales channel.
type: string
categories:
description: Categories to add the Product to.
type: array
items:
required:
- id
properties:
id:
description: The ID of a Product Category.
type: string
variants:
description: A list of Product Variants to create with the Product.
type: array
items:
type: object
properties:
id:
description: The ID of the Product Variant.
type: string
title:
description: The title to identify the Product Variant by.
type: string
sku:
description: The unique SKU for the Product Variant.
type: string
ean:
description: The EAN number of the item.
type: string
upc:
description: The UPC number of the item.
type: string
barcode:
description: A generic GTIN field for the Product Variant.
type: string
hs_code:
description: The Harmonized System code for the Product Variant.
type: string
inventory_quantity:
description: The amount of stock kept for the Product Variant.
type: integer
allow_backorder:
description: >-
Whether the Product Variant can be purchased when out of
stock.
type: boolean
manage_inventory:
description: >-
Whether Medusa should keep track of the inventory for this
Product Variant.
type: boolean
weight:
description: The wieght of the Product Variant.
type: number
length:
description: The length of the Product Variant.
type: number
height:
description: The height of the Product Variant.
type: number
width:
description: The width of the Product Variant.
type: number
origin_country:
description: The country of origin of the Product Variant.
type: string
mid_code:
description: The Manufacturer Identification code for the Product Variant.
type: string
material:
description: The material composition of the Product Variant.
type: string
metadata:
description: >-
An optional set of key-value pairs with additional
information.
type: object
prices:
type: array
items:
type: object
required:
- amount
properties:
id:
description: The ID of the Price.
type: string
region_id:
description: >-
The ID of the Region for which the price is used. Only
required if currency_code is not provided.
type: string
currency_code:
description: >-
The 3 character ISO currency code for which the price
will be used. Only required if region_id is not
provided.
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
amount:
description: The amount to charge for the Product Variant.
type: integer
min_quantity:
description: The minimum quantity for which the price will be used.
type: integer
max_quantity:
description: The maximum quantity for which the price will be used.
type: integer
options:
type: array
items:
type: object
required:
- option_id
- value
properties:
option_id:
description: The ID of the Option.
type: string
value:
description: >-
The value to give for the Product Option at the same
index in the Product's `options` field.
type: string
weight:
description: The wieght of the Product.
type: number
length:
description: The length of the Product.
type: number
height:
description: The height of the Product.
type: number
width:
description: The width of the Product.
type: number
origin_country:
description: The country of origin of the Product.
type: string
mid_code:
description: The Manufacturer Identification code for the Product.
type: string
material:
description: The material composition of the Product.
type: string
metadata:
description: An optional set of key-value pairs with additional information.
type: object
AdminPostProductsProductVariantsVariantReq:
type: object
required:
- prices
properties:
title:
description: The title to identify the Product Variant by.
type: string
sku:
description: The unique SKU for the Product Variant.
type: string
ean:
description: The EAN number of the item.
type: string
upc:
description: The UPC number of the item.
type: string
barcode:
description: A generic GTIN field for the Product Variant.
type: string
hs_code:
description: The Harmonized System code for the Product Variant.
type: string
inventory_quantity:
description: The amount of stock kept for the Product Variant.
type: integer
allow_backorder:
description: Whether the Product Variant can be purchased when out of stock.
type: boolean
manage_inventory:
description: >-
Whether Medusa should keep track of the inventory for this Product
Variant.
type: boolean
weight:
description: The weight of the Product Variant.
type: number
length:
description: The length of the Product Variant.
type: number
height:
description: The height of the Product Variant.
type: number
width:
description: The width of the Product Variant.
type: number
origin_country:
description: The country of origin of the Product Variant.
type: string
mid_code:
description: The Manufacturer Identification code for the Product Variant.
type: string
material:
description: The material composition of the Product Variant.
type: string
metadata:
description: An optional set of key-value pairs with additional information.
type: object
prices:
type: array
items:
type: object
required:
- amount
properties:
id:
description: The ID of the price.
type: string
region_id:
description: >-
The ID of the Region for which the price is used. Only
required if currency_code is not provided.
type: string
currency_code:
description: >-
The 3 character ISO currency code for which the price will be
used. Only required if region_id is not provided.
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
amount:
description: The amount to charge for the Product Variant.
type: integer
min_quantity:
description: The minimum quantity for which the price will be used.
type: integer
max_quantity:
description: The maximum quantity for which the price will be used.
type: integer
options:
type: array
items:
type: object
required:
- option_id
- value
properties:
option_id:
description: The ID of the Product Option to set the value for.
type: string
value:
description: The value to give for the Product Option.
type: string
AdminPostPublishableApiKeySalesChannelsBatchReq:
type: object
required:
- sales_channel_ids
properties:
sales_channel_ids:
description: The IDs of the sales channels to add to the publishable api key
type: array
items:
type: object
required:
- id
properties:
id:
type: string
description: The ID of the sales channel
AdminPostPublishableApiKeysReq:
type: object
required:
- title
properties:
title:
description: A title for the publishable api key
type: string
AdminDeletePublishableApiKeySalesChannelsBatchReq:
type: object
required:
- sales_channel_ids
properties:
sales_channel_ids:
description: The IDs of the sales channels to delete from the publishable api key
type: array
items:
type: object
required:
- id
properties:
id:
type: string
description: The ID of the sales channel
AdminPublishableApiKeysRes:
type: object
properties:
publishable_api_key:
$ref: '#/components/schemas/PublishableApiKey'
AdminPublishableApiKeysListRes:
type: object
properties:
publishable_api_keys:
type: array
items:
$ref: '#/components/schemas/PublishableApiKey'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPublishableApiKeyDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted PublishableApiKey.
object:
type: string
description: The type of the object that was deleted.
default: publishable_api_key
deleted:
type: boolean
description: Whether the PublishableApiKeys was deleted.
default: true
AdminPublishableApiKeysListSalesChannelsRes:
type: object
properties:
sales_channels:
type: array
items:
$ref: '#/components/schemas/SalesChannel'
AdminPostPublishableApiKeysPublishableApiKeyReq:
type: object
properties:
title:
description: A title to update for the key.
type: string
AdminPostRegionsRegionCountriesReq:
type: object
required:
- country_code
properties:
country_code:
description: The 2 character ISO code for the Country.
type: string
externalDocs:
url: >-
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
description: See a list of codes.
AdminPostRegionsRegionFulfillmentProvidersReq:
type: object
required:
- provider_id
properties:
provider_id:
description: The ID of the Fulfillment Provider to add.
type: string
AdminPostRegionsRegionPaymentProvidersReq:
type: object
required:
- provider_id
properties:
provider_id:
description: The ID of the Payment Provider to add.
type: string
AdminPostRegionsReq:
type: object
required:
- name
- currency_code
- tax_rate
- payment_providers
- fulfillment_providers
- countries
properties:
name:
description: The name of the Region
type: string
currency_code:
description: The 3 character ISO currency code to use for the Region.
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
tax_code:
description: An optional tax code the Region.
type: string
tax_rate:
description: The tax rate to use on Orders in the Region.
type: number
payment_providers:
description: A list of Payment Provider IDs that should be enabled for the Region
type: array
items:
type: string
fulfillment_providers:
description: >-
A list of Fulfillment Provider IDs that should be enabled for the
Region
type: array
items:
type: string
countries:
description: >-
A list of countries' 2 ISO Characters that should be included in the
Region.
example:
- US
type: array
items:
type: string
includes_tax:
description: '[EXPERIMENTAL] Tax included in prices of region'
type: boolean
AdminRegionsRes:
type: object
properties:
region:
$ref: '#/components/schemas/Region'
AdminRegionsListRes:
type: object
properties:
regions:
type: array
items:
$ref: '#/components/schemas/Region'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminRegionsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Region.
object:
type: string
description: The type of the object that was deleted.
default: region
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminGetRegionsRegionFulfillmentOptionsRes:
type: object
properties:
fulfillment_options:
type: array
items:
type: object
properties:
provider_id:
type: string
description: ID of the fulfillment provider
options:
type: array
description: fulfillment provider options
example:
- id: manual-fulfillment
- id: manual-fulfillment-return
is_return: true
AdminPostRegionsRegionReq:
type: object
properties:
name:
description: The name of the Region
type: string
currency_code:
description: The 3 character ISO currency code to use for the Region.
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
automatic_taxes:
description: >-
If true Medusa will automatically calculate taxes for carts in this
region. If false you have to manually call POST /carts/:id/taxes.
type: boolean
gift_cards_taxable:
description: >-
Whether gift cards in this region should be applied sales tax when
purchasing a gift card
type: boolean
tax_provider_id:
description: >-
The ID of the tax provider to use; if null the system tax provider
is used
type: string
tax_code:
description: An optional tax code the Region.
type: string
tax_rate:
description: The tax rate to use on Orders in the Region.
type: number
includes_tax:
description: '[EXPERIMENTAL] Tax included in prices of region'
type: boolean
payment_providers:
description: A list of Payment Provider IDs that should be enabled for the Region
type: array
items:
type: string
fulfillment_providers:
description: >-
A list of Fulfillment Provider IDs that should be enabled for the
Region
type: array
items:
type: string
countries:
description: >-
A list of countries' 2 ISO Characters that should be included in the
Region.
type: array
items:
type: string
AdminPostReservationsReq:
type: object
required:
- reservation
properties:
reservation:
$ref: '#/components/schemas/ReservationItemDTO'
AdminGetReservationReservationsReq:
type: object
properties:
reservations:
type: array
items:
$ref: '#/components/schemas/ReservationItemDTO'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostReservationsReservationReq:
type: object
properties:
location_id:
description: The id of the location of the reservation
type: string
quantity:
description: The id of the reservation item
type: number
metadata:
description: An optional set of key-value pairs with additional information.
type: object
AdminPostReturnReasonsReq:
type: object
required:
- label
- value
properties:
label:
description: The label to display to the Customer.
type: string
value:
description: >-
The value that the Return Reason will be identified by. Must be
unique.
type: string
parent_return_reason_id:
description: The ID of the parent return reason.
type: string
description:
description: An optional description to for the Reason.
type: string
metadata:
description: An optional set of key-value pairs with additional information.
type: object
AdminReturnReasonsRes:
type: object
properties:
return_reason:
$ref: '#/components/schemas/ReturnReason'
AdminReturnReasonsListRes:
type: object
properties:
return_reasons:
type: array
items:
$ref: '#/components/schemas/ReturnReason'
AdminReturnReasonsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted return reason
object:
type: string
description: The type of the object that was deleted.
default: return_reason
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminPostReturnReasonsReasonReq:
type: object
properties:
label:
description: The label to display to the Customer.
type: string
value:
description: >-
The value that the Return Reason will be identified by. Must be
unique.
type: string
description:
description: An optional description to for the Reason.
type: string
metadata:
description: An optional set of key-value pairs with additional information.
type: object
AdminReturnsCancelRes:
type: object
properties:
order:
$ref: '#/components/schemas/Order'
AdminReturnsListRes:
type: object
properties:
returns:
type: array
items:
$ref: '#/components/schemas/Return'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminReturnsRes:
type: object
properties:
return:
$ref: '#/components/schemas/Return'
AdminPostReturnsReturnReceiveReq:
type: object
required:
- items
properties:
items:
description: The Line Items that have been received.
type: array
items:
type: object
required:
- item_id
- quantity
properties:
item_id:
description: The ID of the Line Item.
type: string
quantity:
description: The quantity of the Line Item.
type: integer
refund:
description: The amount to refund.
type: number
AdminPostSalesChannelsChannelProductsBatchReq:
type: object
required:
- product_ids
properties:
product_ids:
description: The IDs of the products to add to the Sales Channel
type: array
items:
type: object
required:
- id
properties:
id:
type: string
description: The ID of the product
AdminPostSalesChannelsChannelStockLocationsReq:
type: object
required:
- location_id
properties:
location_id:
description: The ID of the stock location
type: string
AdminPostSalesChannelsReq:
type: object
required:
- name
properties:
name:
description: The name of the Sales Channel
type: string
description:
description: The description of the Sales Channel
type: string
is_disabled:
description: Whether the Sales Channel is disabled or not.
type: boolean
AdminDeleteSalesChannelsChannelProductsBatchReq:
type: object
required:
- product_ids
properties:
product_ids:
description: The IDs of the products to delete from the Sales Channel.
type: array
items:
type: object
required:
- id
properties:
id:
description: The ID of a product
type: string
AdminSalesChannelsRes:
type: object
properties:
sales_channel:
$ref: '#/components/schemas/SalesChannel'
AdminSalesChannelsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted sales channel
object:
type: string
description: The type of the object that was deleted.
default: sales-channel
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminSalesChannelsDeleteLocationRes:
type: object
properties:
id:
type: string
description: The ID of the removed stock location from a sales channel
object:
type: string
description: The type of the object that was removed.
default: stock-location
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminSalesChannelsListRes:
type: object
properties:
sales_channels:
type: array
items:
$ref: '#/components/schemas/SalesChannel'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminDeleteSalesChannelsChannelStockLocationsReq:
type: object
required:
- location_id
properties:
location_id:
description: The ID of the stock location
type: string
AdminPostSalesChannelsSalesChannelReq:
type: object
properties:
name:
type: string
description: Name of the sales channel.
description:
type: string
description: Sales Channel description.
is_disabled:
type: boolean
description: Indication of if the sales channel is active.
AdminPostShippingOptionsReq:
type: object
required:
- name
- region_id
- provider_id
- data
- price_type
properties:
name:
description: The name of the Shipping Option
type: string
region_id:
description: The ID of the Region in which the Shipping Option will be available.
type: string
provider_id:
description: The ID of the Fulfillment Provider that handles the Shipping Option.
type: string
profile_id:
description: The ID of the Shipping Profile to add the Shipping Option to.
type: number
data:
description: >-
The data needed for the Fulfillment Provider to handle shipping with
this Shipping Option.
type: object
price_type:
description: The type of the Shipping Option price.
type: string
enum:
- flat_rate
- calculated
amount:
description: The amount to charge for the Shipping Option.
type: integer
requirements:
description: >-
The requirements that must be satisfied for the Shipping Option to
be available.
type: array
items:
type: object
required:
- type
- amount
properties:
type:
description: The type of the requirement
type: string
enum:
- max_subtotal
- min_subtotal
amount:
description: The amount to compare with.
type: integer
is_return:
description: Whether the Shipping Option defines a return shipment.
type: boolean
default: false
admin_only:
description: 'If true, the option can be used for draft orders'
type: boolean
default: false
metadata:
description: An optional set of key-value pairs with additional information.
type: object
includes_tax:
description: '[EXPERIMENTAL] Tax included in prices of shipping option'
type: boolean
AdminShippingOptionsListRes:
type: object
properties:
shipping_options:
type: array
items:
$ref: '#/components/schemas/ShippingOption'
count:
type: integer
description: The total number of items available
AdminShippingOptionsRes:
type: object
properties:
shipping_option:
$ref: '#/components/schemas/ShippingOption'
AdminShippingOptionsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Shipping Option.
object:
type: string
description: The type of the object that was deleted.
default: shipping-option
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminPostShippingOptionsOptionReq:
type: object
required:
- requirements
properties:
name:
description: The name of the Shipping Option
type: string
amount:
description: The amount to charge for the Shipping Option.
type: integer
admin_only:
description: 'If true, the option can be used for draft orders'
type: boolean
metadata:
description: An optional set of key-value pairs with additional information.
type: object
requirements:
description: >-
The requirements that must be satisfied for the Shipping Option to
be available.
type: array
items:
type: object
required:
- type
- amount
properties:
id:
description: The ID of the requirement
type: string
type:
description: The type of the requirement
type: string
enum:
- max_subtotal
- min_subtotal
amount:
description: The amount to compare with.
type: integer
includes_tax:
description: '[EXPERIMENTAL] Tax included in prices of shipping option'
type: boolean
AdminPostShippingProfilesReq:
type: object
required:
- name
- type
properties:
name:
description: The name of the Shipping Profile
type: string
type:
description: The type of the Shipping Profile
type: string
enum:
- default
- gift_card
- custom
AdminDeleteShippingProfileRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Shipping Profile.
object:
type: string
description: The type of the object that was deleted.
default: shipping_profile
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminShippingProfilesRes:
type: object
properties:
shipping_profile:
$ref: '#/components/schemas/ShippingProfile'
AdminShippingProfilesListRes:
type: object
properties:
shipping_profiles:
type: array
items:
$ref: '#/components/schemas/ShippingProfile'
AdminPostShippingProfilesProfileReq:
type: object
properties:
name:
description: The name of the Shipping Profile
type: string
metadata:
description: An optional set of key-value pairs with additional information.
type: object
type:
description: The type of the Shipping Profile
type: string
enum:
- default
- gift_card
- custom
products:
description: >-
An optional array of product ids to associate with the Shipping
Profile
type: array
shipping_options:
description: >-
An optional array of shipping option ids to associate with the
Shipping Profile
type: array
AdminPostStockLocationsReq:
type: object
required:
- name
properties:
name:
description: the name of the stock location
type: string
address_id:
description: the stock location address ID
type: string
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
address:
$ref: '#/components/schemas/StockLocationAddressInput'
AdminStockLocationsDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Stock Location.
object:
type: string
description: The type of the object that was deleted.
default: stock_location
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminStockLocationsRes:
type: object
properties:
stock_location:
$ref: '#/components/schemas/StockLocationDTO'
AdminStockLocationsListRes:
type: object
properties:
stock_locations:
type: array
items:
$ref: '#/components/schemas/StockLocationDTO'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminPostStockLocationsLocationReq:
type: object
properties:
name:
description: the name of the stock location
type: string
address_id:
description: the stock location address ID
type: string
metadata:
type: object
description: An optional key-value map with additional details
example:
car: white
address:
$ref: '#/components/schemas/StockLocationAddressInput'
AdminStoresRes:
type: object
properties:
store:
$ref: '#/components/schemas/Store'
AdminTaxProvidersList:
type: object
properties:
tax_providers:
type: array
items:
$ref: '#/components/schemas/TaxProvider'
AdminPaymentProvidersList:
type: object
properties:
payment_providers:
type: array
items:
$ref: '#/components/schemas/PaymentProvider'
AdminPostStoreReq:
type: object
properties:
name:
description: The name of the Store
type: string
swap_link_template:
description: >-
A template for Swap links - use `{{cart_id}}` to insert the Swap
Cart id
type: string
payment_link_template:
description: >-
A template for payment links links - use `{{cart_id}}` to insert the
Cart id
type: string
invite_link_template:
description: >-
A template for invite links - use `{{invite_token}}` to insert the
invite token
type: string
default_currency_code:
description: The default currency code for the Store.
type: string
externalDocs:
url: 'https://en.wikipedia.org/wiki/ISO_4217#Active_codes'
description: See a list of codes.
currencies:
description: Array of currencies in 2 character ISO code format.
type: array
items:
type: string
metadata:
description: An optional set of key-value pairs with additional information.
type: object
AdminSwapsListRes:
type: object
properties:
swaps:
type: array
items:
$ref: '#/components/schemas/Swap'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminSwapsRes:
type: object
properties:
swap:
$ref: '#/components/schemas/Swap'
AdminPostTaxRatesTaxRateProductTypesReq:
type: object
required:
- product_types
properties:
product_types:
type: array
description: The IDs of the types of products to associate with this tax rate
items:
type: string
AdminPostTaxRatesTaxRateProductsReq:
type: object
required:
- products
properties:
products:
type: array
description: The IDs of the products to associate with this tax rate
items:
type: string
AdminPostTaxRatesTaxRateShippingOptionsReq:
type: object
required:
- shipping_options
properties:
shipping_options:
type: array
description: The IDs of the shipping options to associate with this tax rate
items:
type: string
AdminPostTaxRatesReq:
type: object
required:
- code
- name
- region_id
properties:
code:
type: string
description: A code to identify the tax type by
name:
type: string
description: A human friendly name for the tax
region_id:
type: string
description: The ID of the Region that the rate belongs to
rate:
type: number
description: The numeric rate to charge
products:
type: array
description: The IDs of the products associated with this tax rate
items:
type: string
shipping_options:
type: array
description: The IDs of the shipping options associated with this tax rate
items:
type: string
product_types:
type: array
description: The IDs of the types of products associated with this tax rate
items:
type: string
AdminTaxRatesDeleteRes:
type: object
properties:
id:
type: string
description: The ID of the deleted Shipping Option.
object:
type: string
description: The type of the object that was deleted.
default: tax-rate
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminTaxRatesListRes:
type: object
properties:
tax_rates:
type: array
items:
$ref: '#/components/schemas/TaxRate'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page
AdminTaxRatesRes:
type: object
properties:
tax_rate:
$ref: '#/components/schemas/TaxRate'
AdminDeleteTaxRatesTaxRateProductTypesReq:
type: object
required:
- product_types
properties:
product_types:
type: array
description: >-
The IDs of the types of products to remove association with this tax
rate
items:
type: string
AdminDeleteTaxRatesTaxRateProductsReq:
type: object
required:
- products
properties:
products:
type: array
description: The IDs of the products to remove association with this tax rate
items:
type: string
AdminDeleteTaxRatesTaxRateShippingOptionsReq:
type: object
required:
- shipping_options
properties:
shipping_options:
type: array
description: >-
The IDs of the shipping options to remove association with this tax
rate
items:
type: string
AdminPostTaxRatesTaxRateReq:
type: object
properties:
code:
type: string
description: A code to identify the tax type by
name:
type: string
description: A human friendly name for the tax
region_id:
type: string
description: The ID of the Region that the rate belongs to
rate:
type: number
description: The numeric rate to charge
products:
type: array
description: The IDs of the products associated with this tax rate
items:
type: string
shipping_options:
type: array
description: The IDs of the shipping options associated with this tax rate
items:
type: string
product_types:
type: array
description: The IDs of the types of products associated with this tax rate
items:
type: string
AdminDeleteUploadsReq:
type: object
required:
- file_key
properties:
file_key:
description: key of the file to delete
type: string
AdminPostUploadsDownloadUrlReq:
type: object
required:
- file_key
properties:
file_key:
description: key of the file to obtain the download link for
type: string
AdminUploadsRes:
type: object
properties:
uploads:
type: array
items:
type: object
properties:
url:
type: string
description: The URL of the uploaded file.
format: uri
AdminDeleteUploadsRes:
type: object
properties:
id:
type: string
description: The file key of the upload deleted
object:
type: string
description: The type of the object that was deleted.
default: file
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminUploadsDownloadUrlRes:
type: object
properties:
download_url:
type: string
description: The Download URL of the file
AdminCreateUserRequest:
type: object
required:
- email
- password
properties:
email:
description: The Users email.
type: string
format: email
first_name:
description: The name of the User.
type: string
last_name:
description: The name of the User.
type: string
role:
description: Userrole assigned to the user.
type: string
enum:
- admin
- member
- developer
password:
description: The Users password.
type: string
format: password
AdminUserRes:
type: object
properties:
user:
$ref: '#/components/schemas/User'
AdminUsersListRes:
type: object
properties:
users:
type: array
items:
$ref: '#/components/schemas/User'
AdminDeleteUserRes:
type: object
properties:
id:
type: string
description: The ID of the deleted user.
object:
type: string
description: The type of the object that was deleted.
default: user
deleted:
type: boolean
description: Whether or not the items were deleted.
default: true
AdminResetPasswordTokenRequest:
type: object
required:
- email
properties:
email:
description: The Users email.
type: string
format: email
AdminResetPasswordRequest:
type: object
required:
- token
- password
properties:
email:
description: The Users email.
type: string
format: email
token:
description: The token generated from the 'password-token' endpoint.
type: string
password:
description: The Users new password.
type: string
format: password
AdminUpdateUserRequest:
type: object
properties:
first_name:
description: The name of the User.
type: string
last_name:
description: The name of the User.
type: string
role:
description: Userrole assigned to the user.
type: string
enum:
- admin
- member
- developer
api_token:
description: The api token of the User.
type: string
metadata:
description: An optional set of key-value pairs with additional information.
type: object
AdminGetVariantsVariantInventoryRes:
type: object
properties:
id:
description: the id of the variant
type: string
inventory:
description: the stock location address ID
type: string
sales_channel_availability:
type: object
description: An optional key-value map with additional details
properties:
channel_name:
description: Sales channel name
type: string
channel_id:
description: Sales channel id
type: string
available_quantity:
description: Available quantity in sales channel
type: number
AdminVariantsListRes:
type: object
properties:
variants:
type: array
items:
$ref: '#/components/schemas/ProductVariant'
count:
type: integer
description: The total number of items available
offset:
type: integer
description: The number of items skipped before these items
limit:
type: integer
description: The number of items per page